Behat, Mink Contributor to Symfony2 framework [email protected] http://github.com/everzet http://card.everzet.com AM who i @everzet senior from-birth web developer in
need to be able to buy rating on site In order to get latest news As a visitor I need to be able to see last 3 articles on homepage In order to see top users As a visitor I need to be able to sort them by rating
need to be able to buy rating on site In order to get latest news As a visitor I need to be able to see last 3 articles on homepage In order to see top users As a visitor I need to be able to sort them by rating
a user I need to be able to buy rating on site In order to get latest news As a visitor I need to be able to see last 3 articles on homepage In order to see top users As a visitor I need to be able to sort them by rating define priorities
Then ensure some outcomes. In order to [X] As a [Y] I need [Z] Given some initial context (the givens), When an event occurs, Then ensure some outcomes. UserStory:
Scenario 1: Scenario 2: Given some initial context (the givens), When an event occurs, Then ensure some outcomes. Given some initial context (the givens), When an event occurs, Then ensure some outcomes. UserStory:
Scenario: 1st scenario title Scenario: 2nd scenario title Feature: Feature description Given some initial context (the givens) When an event occurs Then ensure some outcomes Given some initial context (the givens) When an event occurs Then ensure some outcomes
3. step ... ... Given some initial context (the givens) When an event occurs Then ensure some outcomes In order to ... As a ... I need ... Given some initial context (the givens) When an event occurs Then ensure some outcomes Scenario: 1st scenario title Scenario: 2nd scenario title Feature: Feature description feature tree
new BankAccount(); } ); <?php $steps->When('/^I deposit (\d+)\$$/', function($world, $dollars) { $world->account->deposit($dollars); } ); Given I have a bank account When I deposit 35$
I am on the “/login” When I fill in “username” with “everzet” And I fill in “password” with “qwerty” And I press “login” in login form Then I should see “Welcome, everzet” In order to have extended abilities As a site user I need to be able to login Scenario: Existing user can login Given a site have “everzet” user with “qwerty” password And I am on the “/login” When I fill in “username” with “someone” And I fill in “password” with “qwerty” And I press “login” in login form Then I should see “Login or password is incorrect” Scenario: Non-existing user can’t login Feature: User logins
I am on the “/login” When I fill in “username” with “everzet” And I fill in “password” with “qwerty” And I press “login” in login form Then I should see “Welcome, everzet” In order to have extended abilities As a site user I need to be able to login Scenario: Existing user can login Given a site have “everzet” user with “qwerty” password And I am on the “/login” When I fill in “username” with “someone” And I fill in “password” with “qwerty” And I press “login” in login form Then I should see “Login or password is incorrect” Scenario: Non-existing user can’t login Feature: User logins
in “username” with “everzet” And I fill in “password” with “qwerty” And I press “login” in login form Then I should see “Welcome, everzet” In order to have extended abilities As a site user I need to be able to login Scenario: Existing user can login Given I am on the “/login” page When I fill in “username” with “someone” And I fill in “password” with “qwerty” And I press “login” in login form Then I should see “Login or password is incorrect” Scenario: Non-existing user can’t login Feature: User logins
in “username” with “everzet” And I fill in “password” with “qwerty” And I press “login” in login form Then I should see “Welcome, everzet” In order to have extended abilities As a site user I need to be able to login Scenario: Existing user can login Given a site have “everzet” user with “qwerty” password Background: Given I am on the “/login” page When I fill in “username” with “someone” And I fill in “password” with “qwerty” And I press “login” in login form Then I should see “Login or password is incorrect” Scenario: Non-existing user can’t login Feature: User logins
in “username” with “everzet” And I fill in “password” with “qwerty” And I press “login” in login form Then I should see “Welcome, everzet” In order to have extended abilities As a site user I need to be able to login Scenario: Existing user can login Given a site have users: Background: Given I am on the “/login” page When I fill in “username” with “someone” And I fill in “password” with “qwerty” And I press “login” in login form Then I should see “Login or password is incorrect” Scenario: Non-existing user can’t login | username | password | | everzet | qwerty | Feature: User logins
in “username” with “<username>” And I fill in “password” with “<password>” And I press “login” in login form Then I should see “<message>” In order to have extended abilities As a site user I need to be able to login Scenario Outline: Only existing users can login Given a site have users: Background: | username | password | | everzet | qwerty | Feature: User logins
in “username” with “<username>” And I fill in “password” with “<password>” And I press “login” in login form Then I should see “<message>” In order to have extended abilities As a site user I need to be able to login Scenario Outline: Only existing users can login Given a site have users: Background: | username | password | | everzet | qwerty | Examples: Feature: User logins
in “username” with “<username>” And I fill in “password” with “<password>” And I press “login” in login form Then I should see “<message>” In order to have extended abilities As a site user I need to be able to login Scenario Outline: Only existing users can login Feature: User logins Given a site have users: Background: | username | password | | everzet | qwerty | Examples: | username | password | message | | everzet | qwerty | Welcome, everzet | | someone | pa$$word | Login or password is incorrect |
in “username” with “<username>” And I fill in “password” with “<password>” And I press “login” in login form Then I should see “<message>” In order to have extended abilities As a site user I need to be able to login Scenario Outline: Only existing users can login Feature: User logins Given a site have users: Background: | username | password | | everzet | qwerty | Examples: | username | password | message | | everzet | qwerty | Welcome, everzet | | someone | pa$$word | Login or password is incorrect |
in “username” with “<username>” And I fill in “password” with “<password>” And I press “login” in login form Then I should see “<message>” In order to have extended abilities As a site user I need to be able to login Scenario Outline: Only existing users can login Feature: User logins Given a site have users: Background: | username | password | | everzet | qwerty | Examples: | username | password | message | | everzet | qwerty | Welcome, everzet | | someone | pa$$word | Login or password is incorrect | @javascript