how to activate mink in behat
Asked Answered
M

1

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

Merola answered 16/9, 2012 at 15:34 Comment(1)
Thanks, this got me past a bit of confusion that I was having.Zilber
E
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-

Esse answered 16/9, 2012 at 15:54 Comment(3)
You can also [use this mink example][1] [1]: github.com/Behat/MinkExtension-exampleTervalent
Following this tutorial I ran into the same issue. Funny they don't say specifically to put behat.yml in the root directory... Thanks!Douty
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.Zilber

© 2022 - 2024 — McMap. All rights reserved.