5

I've got some problems with Behat (2.4.*@dev) init process inside Symfony2 bundle (ver 2.2.2). After command:

bin/behat --init "@CompanyAppBundle"

behat directories are created inside application root directory, not in bundle. The output is:

+d features - place your *.feature files here
+d features/bootstrap - place bootstrap scripts and static files here
+f features/bootstrap/FeatureContext.php - place your feature related code here

Where is the problem?

mariuszgil
  • 49
  • 1
  • Problem solved. I put behat.yml in app/config/ directory, so bin/behat can't find it. – mariuszgil Jun 05 '13 at 17:48
  • 1
    You could keep the `behat.yml` file in the `app/config` directory if you wanted to. `--config` option to the rescue! http://docs.behat.org/guides/6.cli.html#initialization-options – Jakub Zalas Jun 06 '13 at 22:49

2 Answers2

2

Not sure about Behat v2.4, but for Behat v3.0, add the bundle to the 'suites' directive of behat.yml:

# behat.yml
default:
  suites:
    company_app_suite:
      type: symfony_bundle
      bundle: CompanyAppBundle
  extensions:
    Behat\Symfony2Extension: ~
Andrew
  • 1,226
  • 2
  • 13
  • 20
  • I'd tried that one and the Features folder was added to the bundle. But when Im running the suite, it cannot find the FeatureContext. can you show me the directory structure and how to setup further? – Jaime Sangcap Jun 16 '15 at 07:56
  • My directory structure is: /features/bootstrap/{project_name}/Bundle/{bundle}Bundle/Features/Context/FeatureContext.php where {project_name}/Bundle/{bundle}Bundle is the same structure as under the src directory. – Andrew Jun 17 '15 at 22:44
  • I see. I thought they should live inside the src/ folder. Btw are you familiar with Domain Drive Design? Because Im wondering where should I put the test for my Domain Models – Jaime Sangcap Jun 19 '15 at 19:49
0

Either Behat can't find your configuration, try specifying it like so:

bin/behat -c alternative/location/to/behat.yml --init "@CompanyAppBundle"

Or you haven't enabled the Symfony2Extension in your (default) configuration, try specifying it like so:

default:
    extensions:
        Behat\Symfony2Extension\Extension:
Boy Baukema
  • 2,908
  • 1
  • 27
  • 38