Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Behat & Mink : Use the test environment

I'm current using Behat with Mink & Goutte Driver. When i'm trying to use it with my dev environment, via the app_dev.php file, which is a typical app_dev.php file from a Symfony2 Standard Edition, my tests are working just fine (Gists).

But, if I want to use a app_test file (which is the same as the app_dev file, except for the environment parameter set to "test" instead of "dev", and debug mode disabled), on the logout scenario, it seems that Goutte can't find the "user_signup" identifier, and in the "login" scenario, it does not find the "Root" text node. Indeed, when i'm using a print last response, it seems that the user is just not logged in : I still see the forms to log in an user...

When i'm on my dev environment (app_dev) or prod environment (app), everything seems to be working just fine though... Any idea ?

(If you think you need some other files, please tell me).

like image 612
Talus Avatar asked Oct 22 '12 12:10

Talus


People also ask

What does behat mean?

behatverb. To place a hat (upon someone's head)

What is behat testing?

Behat is a PHP testing framework which can be used to automate acceptance tests in a human readable language called Gherkin. Since it is based on Cucumber, it also helps teams to adopt and implement Behavioral Driven Development (BDD).

What is behat tool?

Behat is a tool that makes behavior driven development (BDD) possible. With BDD, you write human-readable stories that describe the behavior of your application. These stories can then be auto-tested against your application.

What is BDD approach in testing?

What is BDD (Behavior-Driven Development)? Behavior-driven development is a testing practice that follows the idea of specification by example (e.g., Test-Driven Development [TDD]). The idea is to describe how the application should behave in a very simple user/business-focused language.


Video Answer


1 Answers

By default, Mink uses session called "symfony2". That's why you get different results accessing from browser and using Behat. You can change that in your behat.yml file. Check this doc for more info: http://extensions.behat.org/symfony2/index.html#symfony2-mink-session

like image 173
ualinker Avatar answered Sep 20 '22 11:09

ualinker