---
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
published: true
og:
  determiner: Automatic
  site_name: Metadrop
  'image:alt': 'Utilities for Behat 3.x "tips & tricks"'
  street_address: 'Calle Manuel Luna, 12, 3 Dcha'
  locality: Madrid
  region: Madrid
  postal_code: '28020'
  country_name: España
  email: hola@metadrop.net
  phone_number: '910053180'
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
      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://twitter.com/metadrop'
        - 'https://asociaciondrupal.es/partner/metadrop'
        - 'https://www.linkedin.com/company/metadrop'
      logo:
        '@type': ImageObject
        url: 'https://metadrop.net/themes/custom/mdrop_radix/logo-metadrop-500-500.jpg'
        width: '500'
        height: '500'
    -
      '@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)