0

I installed behat with mink and selenium2-driver for my Symfony2 project.

Is it possible to use the /app/config/behat.yml instead of the /behat.yml file?

I searched on google but I can't find anything else this command.

php bin/behat --config app/config/behat.yml

But the command isn't working either.
I think there must be a config-path in composer.json.

Touki
  • 7,465
  • 3
  • 41
  • 63
PatrickB
  • 3,225
  • 5
  • 31
  • 55

1 Answers1

2

Yes, you can configure which config file you want to use. Look at this part of the doc. http://docs.behat.org/guides/7.config.html#paths

What error do you get when running your command?

php bin/behat --config app/config/behat.yml

This error?

[RuntimeException]                                                         
Context class not found.                                                   
Maybe you have provided a wrong or no `bootstrap` path in your behat.yml:  
http://docs.behat.org/guides/7.config.html#paths

If that's the case, I think if might be because you need to specify where to find the features in your behat.yml file.

Now you moved the file to /app/config/behat.yml, the related path from behat.yml to the feature directory has changed, so you should add the following to the file:

default:
    paths:
         features: ../features/
         bootstrap: ../features/bootstrap
user2707671
  • 1,694
  • 13
  • 12
  • It's not possible to run the command without `--config app/config/behat.yml`? – PatrickB Oct 25 '13 at 13:55
  • Yes, it also works. By default behat looks for a file behat.yml in the root directory of the project or in config/behat.yml. But the path from the behat.yml to the feature directory would still be broken, so you still need to edit the path inside the file. – user2707671 Oct 25 '13 at 14:21
  • Doesn't work... I'm in `/var/www`, the `behat.yml` is in `/var/www/app/config/behat.yml` and the binary is in `/var/www/bin/behat`. The config contains `default: paths: features: ../features bootstrap: ../features/asd` (i renamed the bootstrap directory to asd for test) – PatrickB Oct 25 '13 at 14:31
  • Try using `%behat.paths.base%/../../features` – Jakub Zalas Oct 26 '13 at 09:09
  • Doesnt work, too.... The problem is that behat ignore the app/config/behat.yml file! If i write "test" in the file (no yaml format) and execute `php bin/behat --config app/config/behat.yml` i get this `Unable to parse in "app\/config\/behat.yml" at line 2 (near "test").` But if i use `php bin/behat` i get `Context class not found.`. Because that behat ignores the behat.yml. – PatrickB Oct 28 '13 at 10:00