Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Behat Testing

Sponsored · Ship Features Fearlessly Turn features on and off without deploys. Used by thousands of Ruby developers.

Behat Testing

Avatar for Matthew Loberg

Matthew Loberg

June 05, 2015
Tweet

More Decks by Matthew Loberg

Other Decks in Programming

Transcript

  1. Feature: Login In order to view my upcoming concerts As

    a registered user I need to be able to login Scenario: Successful login with correct credentials Given there is a user "mloberg" with password "testing" When I view the login page And I fill in "username" with "mloberg" And I fill in "password" with "testing" And I press "login" Then I should see "Hello, mloberg" Scenario: Can't login with invalid credentials ...
  2. Feature: Login In order to view my upcoming concerts As

    a registered user I need to be able to login Scenario: Successful login with correct credentials Given there is a user "mloberg" with password "testing" When I view the login page And I fill in "username" with "mloberg" And I fill in "password" with "testing" And I press "login" Then I should see "Hello, mloberg" Scenario: Can't login with invalid credentials ...
  3. Feature: Login In order to view my upcoming concerts As

    a registered user I need to be able to login Scenario: Successful login with correct credentials Given there is a user "mloberg" with password "testing" When I view the login page And I fill in "username" with "mloberg" And I fill in "password" with "testing" And I press "login" Then I should see "Hello, mloberg" Scenario: Can't login with invalid credentials ...
  4. Feature: Login In order to view my upcoming concerts As

    a registered user I need to be able to login Scenario: Successful login with correct credentials Given there is a user "mloberg" with password "testing" When I view the login page And I fill in "username" with "mloberg" And I fill in "password" with "testing" And I press "login" Then I should see "Hello, mloberg" Scenario: Can't login with invalid credentials ...
  5. Feature: Login In order to view my upcoming concerts As

    a registered user I need to be able to login Scenario: Successful login with correct credentials Given there is a user "mloberg" with password "testing" When I view the login page And I fill in "username" with "mloberg" And I fill in "password" with "testing" And I press "login" Then I should see "Hello, mloberg" Scenario: Can't login with invalid credentials ...
  6. Feature: Login In order to view my upcoming concerts As

    a registered user I need to be able to login Scenario: Successful login with correct credentials Given there is a user "mloberg" with password "testing" When I view the login page And I fill in "username" with "mloberg" And I fill in "password" with "testing" And I press "login" Then I should see "Hello, mloberg" Scenario: Can't login with invalid credentials ...
  7. Feature: Login In order to view my upcoming concerts As

    a registered user I need to be able to login Scenario: Successful login with correct credentials Given there is a user "mloberg" with password "testing" When I view the login page And I fill in "username" with "mloberg" And I fill in "password" with "testing" And I press "login" Then I should see "Hello, mloberg" Scenario: Can't login with invalid credentials ...
  8. Feature: Login In order to view my upcoming concerts As

    a registered user I need to be able to login Scenario: Successful login with correct credentials Given there is a user "mloberg" with password "testing" When I view the login page And I fill in "username" with "mloberg" And I fill in "password" with "testing" And I press "login" Then I should see "Hello, mloberg" Scenario: Can't login with invalid credentials ...
  9. Feature: Login In order to view my upcoming concerts As

    a registered user I need to be able to login Scenario: Successful login with correct credentials Given there is a user "mloberg" with password "testing" When I view the login page And I fill in "username" with "mloberg" And I fill in "password" with "testing" And I press "login" Then I should see "Hello, mloberg" Scenario: Can't login with invalid credentials ...
  10. /** * @When I do something with :argument */ public

    function iDoSomethingWith($argument) { // do something with $argument }
  11. /** * @When I do something with :argument */ public

    function iDoSomethingWith($argument) { // do something with $argument }
  12. /** * @When I do something with :argument */ public

    function iDoSomethingWith($argument) { // do something with $argument }
  13. /** * @When /^I do something with "([^"]*)"$/ */ public

    function iDoSomethingWith($argument) { // do something with $argument }
  14. /** * @Then This thing should happen */ public function

    thisThingShouldHappen() { // Test that the thing happened }
  15. /** * @Given The user :username has :password */ public

    function userExists($username, $password) { // Create a user with a password }