---
url: 'https://metadrop.net/en/articles/utilities-for-behat-3x-tips-tricks'
title: 'Utilities for Behat 3.x "tips & tricks"'
author: 'Carlos Montes'
date: '2017-01-27T11:13:56+00:00'
updated: '2026-08-04T07:54:06+00:00'
type: article
summary: 'Article with some tricks that will help us to understand and improve our knowledge about Behat.'
tags:
  - Behat
  - Testing
image: 'https://metadrop.net/modules/custom/metadrop_schema/images/metadropnet-social.jpg'
published: true
og:
  site_name: Metadrop
  'image:type': image/jpeg
  'image:width': '1200'
  'image:height': '630'
  'image:alt': Metadrop
  locale: en_US
  'locale:alternate': es_ES
schema:
  '@context': 'https://schema.org'
  '@graph':
    -
      '@type': Article
      '@id': 'https://metadrop.net/en/articles/utilities-for-behat-3x-tips-tricks#article'
      name: 'Utilities for Behat 3.x "tips & tricks"'
      headline: 'Utilities for Behat 3.x "tips & tricks"'
      description: 'Article with some tricks that will help us to understand and improve our knowledge about Behat.'
      about:
        - Behat
        - Testing
      image:
        '@type': ImageObject
        url: 'https://metadrop.net/modules/custom/metadrop_schema/images/metadropnet-social.jpg'
        width: '1200'
        height: '630'
      datePublished: '2017-01-27T14:35:56+0100'
      dateModified: '2026-08-04T09:54:06+0200'
      author:
        '@type': Person
        name: 'Carlos Montes'
      publisher:
        '@type': Organization
        '@id': 'https://metadrop.net/#organization'
      mainEntityOfPage: 'https://metadrop.net/en/articles/utilities-for-behat-3x-tips-tricks'
    -
      '@type': Organization
      '@id': 'https://metadrop.net/#organization'
      url: 'https://metadrop.net/'
      name: Metadrop
      sameAs:
        - 'https://www.drupal.org/metadrop'
        - 'https://x.com/metadrop'
        - 'https://asociaciondrupal.es/partner/metadrop'
        - 'https://www.linkedin.com/company/metadrop'
      telephone: '+34910053180'
      contactPoint:
        '@type': ContactPoint
        telephone: '+34910053180'
        email: hola@metadrop.net
        availableLanguage:
          - Spanish
          - English
        contactType: 'customer service'
      logo:
        '@type': ImageObject
        url: 'https://metadrop.net/modules/custom/metadrop_schema/images/logo-metadrop-500-500.jpg'
        width: '500'
        height: '500'
      address:
        '@type': PostalAddress
        streetAddress: 'Calle Virgen de Nuria 23'
        addressLocality: Madrid
        addressRegion: Madrid
        postalCode: '28027'
        addressCountry: ES
    -
      '@type': ItemPage
      '@id': 'https://metadrop.net/en/articles/utilities-for-behat-3x-tips-tricks'
      breadcrumb:
        '@type': BreadcrumbList
        itemListElement:
          -
            '@type': ListItem
            position: 1
            name: Home
            item: 'https://metadrop.net/en'
          -
            '@type': ListItem
            position: 2
            name: 'Expert Drupal & Tech Articles'
            item: 'https://metadrop.net/en/articles'
      publisher:
        '@type': Organization
        '@id': 'https://metadrop.net/#organization'
---
 1. [Articles](https://metadrop.net/en/articles)
 
  

# Utilities for Behat 3.x "tips &amp; tricks"

Friday, January 27, 2017

 

 



Article with some tricks that will help us to understand and improve our knowledge about Behat.



   



## Key commands list for behat

Run the tests with the configuration have given by the yml file

```ini
behat --config [path/to/yml]
```

Example: behat --config sites/default/default.behat.yml

Initialize the feature suite structure inside your project,

```ini
behat --config [path/to/yml] --init
```

Behat will automatically add all missing pass methods to your FeatureContext class

```ini
behat --config [patt/to/yml] --dry-run --append-snippets
```

We generate a template of a Yml file by default with its specifications, if we also export it, we will quickly have a predefined configuration file.

```ini
behat --config-reference
# Example
behat --config-reference > default.behat.yml
```

## Multitag


We can use the tags that give us Behat to manage which Scenarios we want to execute and which omit
To understand it, here is what is evaluated as Boolean expression in the different cases:

```plaintext
~test,test2: (NOT test) OR test2
~@test,~@test2: (NOT test) OR (NOT test2) which is equivalent to NOT (test AND test2)
~@test&&~@test2: (NOT test) AND (NOT test2)
```

*\* The @ in the tag name is optional in all cases: @ `is replaced by an empty string.*



[Behat](https://metadrop.net/en/articles?text=Behat)

[Testing](https://metadrop.net/en/articles?text=Testing)