When writing functionnal tests, some parts are repeated quite frequently. 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 those 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 behaviour still encouraged for Behat 3? Is there a better way to do this?