11

I'm trying to use behat and mink together, reading that link:

http://docs.behat.org/cookbook/behat_and_mink.html#method-1-composer

and trying to activate Mink in Behat framework, but it does not work for me :(

here is text form manual

    And this executable will already autoload all the needed classes in order to activate MinkExtension through behat.yml.

Now lets activate it:

I'm thinking he is talking about /vendor/behat/mink-extension/behat.yml ?

I had added these lines into that file

# behat.yml
default:
    extensions:
        Behat\MinkExtension\Extension:
            goutte: ~
            selenium2: ~

But when i'm doing $bin/behat -dl i can see only

Given /^I am in a directory "([^"]*)"$/
Given /^I have a file named "([^"]*)"$/
 When /^I run "([^"]*)"$/
 Then /^I should get:$/

Seems mink-extension do not activated...but how i can activate it, if i did everything what is written in the manual :(

P.S. I just tried to follow instruction (from here http://docs.behat.org/cookbook/behat_and_mink.html) in totally new clean place (new folder) but it does not work it shows me next error

bin/behat -dl

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

But in tutorial nothing says about paths and yml modifications :( Maybe is there exist any updated tutorial version ?

based on error message I have to make some php file in bootstrap folder, but it was not describe in tutorial :( strange

SOLVED:

$ mkdir behat_mink_test && cd behat_mink_test
$ touch composer.json
$ echo '{
>     "require": {
>         "behat/behat": "2.4.*@stable",
>         "behat/mink": "1.4.*@stable",
>         "behat/mink-extension": "*",
>         "behat/mink-goutte-driver": "*",
>         "behat/mink-selenium2-driver": "*"
>     },
>     "minimum-stability": "dev",
>     "config": {
>         "bin-dir": "bin/"
>     }
> }' > composer.json
$ curl http://getcomposer.org/installer | php
$ php composer.phar install
$ bin/behat -h
$ touch behat.yml
$ echo 'default:
>     extensions:
>         Behat\MinkExtension\Extension:
>             goutte: ~
>             selenium2: ~' > behat.yml
$ bin/behat -dl

and finally it works now :) thanks

user1016265
  • 2,169
  • 3
  • 26
  • 47

1 Answers1

9

You should not edit the behat.yml file located in /vendor/behat/mink-extension/behat.yml. You should add these lines to the behat.yml file at the root of your proyect (the directory where the bin subdirectory is). If there is no behat.yml file there, just create it-

Carlos Granados
  • 11,038
  • 1
  • 35
  • 41
  • You can also [use this mink example][1] [1]: https://github.com/Behat/MinkExtension-example – slatunje Nov 15 '12 at 08:10
  • Following [this](http://docs.behat.org/cookbook/behat_and_mink.html) tutorial I ran into the same issue. Funny they don't say specifically to put behat.yml in the root directory... Thanks! – Michael Gruber Apr 12 '13 at 22:20
  • Yeah, this wasn't very clear in the behat documentation. It sounded more like you had to modify an existing file. Kinda threw me off for awhile. – Patrick May 20 '13 at 15:56