Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to activate mink in behat

Tags:

php

bdd

behat

mink

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

like image 824
user1016265 Avatar asked Sep 16 '12 15:09

user1016265


1 Answers

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-

like image 162
Carlos Granados Avatar answered Nov 11 '22 15:11

Carlos Granados