When writing functional tests, some parts are repeated quite often. For example, users logging in:
I go to "/login"
I fill in "login" with "username"
I fill in "password" with "password"
I press "Login"
I would like to define these steps as:
Given I am logged in as "userA"
Now on Behat 2.x I would define a step in php:
return array(
new Step\Given('I go to "/login"'),
new Step\Then('I fill in "login" with "username"'),
new Step\Then('I fill in "password" with "password"'),
new Step\Then('I press "Login"'),
);
Is this behavior still encouraged for Behat 3? Is there a better way to do this?
source
share