Skip to main content

Basic Configuration for behat.yml file

Behat has a very powerful configuration system based on YAML configuration files and profiles. You would have seen several variation of behat.yml project to project. This is basic configuration for behat.yml to starts with the project.

# behat.yml
        features: features
        bootstrap: 'features/bootstrap'
        - Behat\MinkExtension\Context\MinkContext
      goutte: ~
      default_session: goutte

default: All configuration parameters in behat.yml file are defined under a profile name default. All other profiles inherit parameters from the default profile. If you only need one profile, define all of your parameters under the default.

suites: With suites you can configure Behat to test different kinds of features using different kinds of contexts and doing so in one run.

paths: Parameters under this configuration block tell Behat where to find your feature and bootstrap files:

  • features: The features parameter defines where Behat will look for your *.feature files. The given directory will be scanned recursively.
  • bootstrap: The bootstrap parameter defines the directory from which Behat will automatically load all *.php files.

contexts: You can define multiple context. Here we are using Mink to use the mink default functions.

extension: The extensions block allows you to activate extensions for your suite or for specific profile of the suite:

Submitted by tgoswami on September 26, 2020

Tarun has 11+ years of experience in Quality Assurance in different domains like Banking, E-commerce, Health and Education.


At ProgramsBuzz, you can learn, share and grow with millions of techie around the world from different domain like Data Science, Software Development, QA and Digital Marketing. You can ask doubt and get the answer for your queries from our experts.