15. Scenario: search by director
Given the store has movies directed
by āSteven Spielbergā
When I search for āSteven Spielbergā
Then I should see all of the movies
directed by āSteven Spielbergā
16. Scenario: no results
Given the store has no movies
directed by āSteven Spielbergā
When I search for āSteven Spielbergā
Then I should see āSorry, but no
movies were foundā
18. Scenario: search by director
Given movies directed by "Steven Spielberg" are
in stock
When I search for "Spielberg" under "Director"
Then I the search results should be "E.T., and Jaws"
19.
20. Step Tables
Scenario: search by director
Given the following movies are in stock:
| Title | Director | Year |
| Jaws | Steven Spielberg | 1975 |
| Star Wars | George Lucas | 1975 |
| Dawn of the Dead | George Romero | 1978 |
| E.T. | Steven Spielberg | 1982 |
When I search for "Spielberg" under "Director"
Then I the search results should be "E.T., and Jaws"
21. Step Tables
Scenario: search by director
Given the following movies are in stock:
| Title | Director | Year |
| Jaws | Steven Spielberg | 1975 |
| Star Wars | George Lucas | 1975 |
| Dawn of the Dead | George Romero | 1978 |
| E.T. | Steven Spielberg | 1982 |
When I search for "Spielberg" under "Director"
Then I should see the following table:
| Title | Director | Year |
| Jaws | Steven Spielberg | 1975 |
| E.T. | Steven Spielberg | 1982 |
22. Scenario: search by director
Given the following movies are in stock:
| Title | Director | Year |
| Jaws | Steven Spielberg | 1975 |
| Star Wars | George Lucas | 1975 |
| Dawn of the Dead | George Romero | 1978 |
| E.T. | Steven Spielberg | 1982 |
When I search for "Spielberg" under "Director"
Then I the search results should be "E.T., and Jaws"
23. Scenario: search by director
Given the following movies are in stock:
| Title | Director | Year |
| Jaws | Steven Spielberg | 1975 |
| Star Wars | George Lucas | 1975 |
| Dawn of the Dead | George Romero | 1978 |
| E.T. | Steven Spielberg | 1982 |
When I search for "Spielberg" under "Director"
Then I the search results should be "E.T., and Jaws"
I only want to change
the search query and
results part...
24. Scenario Outlines
Scenario Outline: search by director
Given the following movies are in stock:
| Title | Director | Year |
| Jaws | Steven Spielberg | 1975 |
| Star Wars | George Lucas | 1975 |
| Dawn of the Dead | George Romero | 1978 |
| E.T. | Steven Spielberg | 1982 |
When I search for "<Director Query>" under "Director"
Then I the search results should be "<Search Results>"
Examples:
| Director Query | Search Results |
| Steve | E.T., Jaws |
| George | Dawn of the Dead, Star Wars |
| Lucas | Star Wars |
25. Scenario Outlines
Scenario Outline: search by director
Given the following movies are in stock:
| Title | Director | Year |
| Jaws | Steven Spielberg | 1975 |
| Star Wars | George Lucas | 1975 |
| Dawn of the Dead | George Romero | 1978 |
| E.T. | Steven Spielberg | 1982 |
When I search for "<Director Query>" under "Director"
Then I the search results should be "<Search Results>"
Examples:
| Director Query | Search Results |
| Steve | E.T., Jaws |
| George | Dawn of the Dead, Star Wars |
| Lucas | Star Wars |
26. Background
Feature: Account Profile
Scenario: change password success
Given I'm logged in
...
Scenario: update contact info
Given I'm logged in
...
28. Multi-Line String
Steps
Scenario: register successfully
Given I am on on the registration page
When I sign up as "Jojo Binks"
Then I should receive the following email:
"""
Thanks for signing up Jojo!
Important information about here.
"""
43. Step Deļ¬nition
Given /^a widget$/ do
Given a widget #codes go here
end
44. When /^I search by director for "([^"]*)"$/ do |director|
end
45. Regexp Capture -> Yielded Variable
When /^I search by director for "([^"]*)"$/ do |director|
end
46. When /^I search by director for "([^"]*)"$/ do |director|
Ā Ā visit advanced_search_path
Ā Ā fill_in "By Director", :with => director
Ā Ā click_button "Search"
end
Webrat, Webdriver, Watir, etc..
48. When /^I search by director for "([^"]*)"$/ do |director|
end
[Given(@"^I search by director for "([^"]*)"$")]
public void searchDirector(String director) {
}
http://wiki.github.com/richardlawrence/Cuke4Nuke/
54. When /^I search by director for "([^"]*)"$/ do |director|
end
@When("^I search by director for "([^"]*)"$")
public void searchDirector(String director) {
}
When("^I search by director for "([^"]*)"$"{ String d ->
}
(When #"^I search by director for "([^"]*)"$"
Ā Ā (fn [director] ))
When("^I search by director for "([^"]*)"$"{ d: String =>
}
56. Scenario Outline: search by director
Given the following movies are in stock:
| Title | Director | Year |
| Jaws | Steven Spielberg | 1975 |
| Star Wars | George Lucas | 1975 |
| Dawn of the Dead | George Romero | 1978 |
| E.T. | Steven Spielberg | 1982 |
When I search for "<Director Query>" under "Director"
Then I the search results should be "<Search Results>"
Examples:
| Director Query | Search Results |
| Steve | E.T., Jaws |
| George | Dawn of the Dead, Star Wars |
| Zombie guy | Dawn of the Dead |
| Lucas | Star Wars |
Scenario: search by director on a full moon
Given that it is a full moon
...
57. Scenario Outline: search by director
Given the following movies are in stock:
| Title | Director | Year |
| Jaws | Steven Spielberg | 1975 |
| Star Wars | George Lucas | 1975 |
| Dawn of the Dead | George Romero | 1978 |
| E.T. | Steven Spielberg | 1982 |
When I search for "<Director Query>" under "Director"
Then I the search results should be "<Search Results>"
Examples:
| Director Query | Search Results |
| Steve | E.T., Jaws |
| George | Dawn of the Dead, Star Wars |
| Zombie guy | Dawn of the Dead |
| Lucas | Star Wars |
Scenario: search by director on a full moon
Given that it is a full moon
...
81. Next set of slides stolen from
Aslak HellesĆøy, creator of
http://www.slideshare.net/aslak.hellesoy/cuke4duke-javazone-2009
82. Feature: code-breaker submits guess
In order to make time pass when I'm alone
As a player
I want to play the against a machine
Scenario: all correct
Given the secret code is "r g y c"
When I guess "r g y c"
Then the mark should be "bbbb"
89. Feature: code-breaker submits guess
In order to make time pass when I'm alone
As a player
I want to play the against a machine
Scenario: all correct # features/c..s.feature:6
Given the secret code is "r g y c" # features/c..s.feature:7
When I guess "r g y c" # features/c..s.feature:8
Then the mark should be "bbbb" # features/c..s.feature:9
1 scenario (1 undefined)
3 steps (3 undefined)
0m0.076s
90. You can implement step definitions for undefined steps with these
snippets:
@Given("^the secret code is "([^"]*)"$")
@Pending
public void theSecretCodeIsRGYC_(String arg1) {
}
@When("^I guess "([^"]*)"$")
@Pending
public void iGuessRGYC_(String arg1) {
}
@Then("^the mark should be "([^"]*)"$")
@Pending
public void theMarkShouldBeBbbb_(String arg1) {
}
91. package codebreaker;
import cuke4duke.*;
public class CodeBreakerSteps {
@Given("^the secret code is "([^"]*)"$")
@Pending
public void theSecretCodeIs(String code) {
}
@When("^I guess "([^"]*)"$")
@Pending
public void iGuess(String guess) {
}
@Then("^the mark should be "([^"]*)"$")
@Pending
public void theMarkShouldBe(String mark) {
}
}
92. $ mvn integration-test
Feature: code-breaker submits guess
In order to make time pass when I'm alone
As a player
I want to play the against a machine
Scenario: all correct # features/c..s.feature:6
Given the secret code is "r g y c" # public void theS..(..)
TODO (Cucumber::Pending)
f../c..s.feature:7:in `Given the secret code is "r g y c"'
When I guess "r g y c" # public void iGue..(..)
Then the mark should be "bbbb" # public void theM..(..)
1 scenario (1 pending)
3 steps (2 skipped, 1 pending)
0m0.079s
93. Given the secret code is "r g y c"
# public void codebreaker.GameSteps
.theSecretCodeIs(java.lang.String)
95. Given the secret code is "r g y c"
@Given("^the secret code is "([^"]*)"$")
public void theSecretCodeIs(String code) {
}
96. public class GameSteps {
private Game game;
@Given("^the secret code is "([^"]*)"$")
public void theSecretCodeIs(String code) {
game = new Game(code);
}
}
100. $ mvn integration-test
Feature: code-breaker submits guess
In order to make time pass when I'm alone
As a player
I want to play the against a machine
Scenario: all correct # features/c..s.feature:6
Given the secret code is "r g y c" # public void theS..(..)
When I guess "r g y c" # public void iGue..(..)
TODO (Cucumber::Pending)
f../c..s.feature:8:in `When I guess "r g y c"'
Then the mark should be "bbbb" # public void theM..(..)
1 scenario (1 pending)
3 steps (1 skipped, 1 pending, 1 passed)
0m0.112s
101.
102. $ mvn integration-test
Feature: code-breaker submits guess
In order to make time pass when I'm alone
As a player
I want to play the against a machine
Scenario: all correct # features/c..s.feature:6
Given the secret code is "r g y c" # public void theS..(..)
When I guess "r g y c" # public void iGue..(..)
Then the mark should be "bbbb" # public void theM..(..)
1 scenario (1 passed)
3 steps (3 passed)
0m0.121s
103. Scenario: all correct
Given the secret code is "r g y c"
When I guess "r g y c"
Then the mark should be "bbbb"
Scenario: 2 wrong pos, 2 correct
Given the secret code is "r g y c"
When I guess "r g c y"
Then the mark should be "bbww"
104. Scenario: all correct # features/c..s.feature:6
Given the secret code is "r g y c" # public void theS..(..)
When I guess "r g y c" # public void iGue..(..)
Then the mark should be "bbbb" # public void theM..(..)
Scenario: all correct # features/c..s.feature:6
Given the secret code is "r g y c" # public void theS..(..)
When I guess "r g y c" # public void iGue..(..)
Then the mark should be "bbbb" # public void theM..(..)
org.junit.ComparisonFailure: expected:<bb[bb]> but
was:<bb[ww]> (NativeException)
codebreaker/CodeBreakerSteps.java:20:in `theMarkShouldBe'
features/codebreaker_submits_guess.feature:14:in `Then
the mark should be "bbww"'
1 scenario (1 failed, 1 passed)
3 steps (1 failed, 3 passed)
0m0.121s
105.
106. Scenario: all correct
Given the secret code is "r g y c"
When I guess "r g y c"
Then the mark should be "bbbb"
Scenario: 2 wrong pos, 2 correct
Given the secret code is "r g y c"
When I guess "r g c y"
Then the mark should be "bbww"
107. Scenario Outline: submit guess
Given the secret code is "<code>"
When I guess "<guess>"
Then the mark should be "<mark>"
Examples:
| code | guess | mark |
| r g y c | r g y c | bbbb |
| r g y c | r g c y | bbww |
| r g y c | y r g c | bwww |
| r g y c | c r g y | wwww |
127. patient b
uyer
As an im ine my search
Given...
I want to
ref
find wha
t When...
So that I
Iw
can
ant quic
kly Then...
128. patient b
uyer
As an im ine my search
Given...
I want to
ref
find wha
t When...
So that I
Iw
can
ant quic
kly Then...
129. patient b
uyer
As an im ine my search
Given...
I want to
ref
find wha
t When...
So that I
Iw
can
ant quic
kly Then...
130. patient b
uyer
As an im ine my search
Given...
I want to
ref
find wha
t When...
So that I
Iw
can
ant quic
kly Then...
131. patient b
uyer
As an im ine my search
Given...
I want to
ref
find wha
t When...
So that I
Iw
can
ant quic
kly Then...
132. Dead
er
t ient buy
As an impa m y search
I want to refine t
find wha
So that I can
y
I wan t quickl
D
PR
133. Dead Living
Feature: Advanced Search
As an impatient buyer
I want to refine my search
So that I can find what I want quickly
Scenario Outline: search by director
er Given the following movies are in stock:
t ient buy
an impa
| Title | Director | Year |
As m y search | Jaws | Steven Spielberg | 1975 |
I want to refine t
| Star Wars | George Lucas | 1975 |
find wha
| Dawn of the Dead | George Romero | 1978 |
that I can
| E.T. | Steven Spielberg | 1982 |
So y When I search for "<Director Query>" under "Director"
I wan t quickl Then I the search results should be "<Search Results>"
Examples:
| Director Query | Search Results |
| Steve | E.T., Jaws |
| George | Dawn of the Dead, Star Wars |
D | Lucas | Star Wars |
PR
135. Feature: Advanced Search
As an impatient buyer
I want to refine my search
So that I can find what I want quickly
136. Feature: Advanced Search
As an impatient buyer
I want to refine my search
So that I can find what I want quickly
Scenario: search by director
Given movies directed by "Steven Spielberg" are in stock
When I search by director for "Spielberg"
Then I should see all of the movies directed by "Steven Spielberg"
137. Feature: Advanced Search
As an impatient buyer
I want to refine my search
So that I can find what I want quickly
Declarative
Scenario: search by director
Given movies directed by "Steven Spielberg" are in stock
When I search by director for "Spielberg"
Then I should see all of the movies directed by "Steven Spielberg"
138. Feature: Advanced Search
As an impatient buyer
I want to refine my search
So that I can find what I want quickly
Imperative
Scenario: search by director
Given movies directed by "Steven Spielberg" are in stock
And I am on the "Advanced Search" page
When I fill in "Spielberg" for "Director"
And press "Submit"
Then I should see all of the movies directed by "Steven Spielberg"
139. Feature: Advanced Search
As an impatient buyer
I want to refine my search
So that I can find what I want quickly
Imperative
Scenario: search by director
Given movies directed by "Steven Spielberg" are in stock
And I am on the "Advanced Search" page
When I fill in "Spielberg" for "Director"
And press "Submit"
Then I should see all of the movies directed by "Steven Spielberg"
I like it! I actually know
how a user can use it!
141. Scenario: successful login
Given I'm on the login page
When I fill in "jimmy" for "Login"
And fill in "password" for "Password"
And click "Login"
Then I should see "Welcome back jimmy!"
143. Scenario: change password success
Given I'm on the login page
When I fill in "jimmy" for "Login"
And fill in "password" for "Password"
And click "Login"
Then I should see "Welcome back jimmy!"
144. Scenario: change password success
Given I'm on the login page
When I fill in "jimmy" for "Login"
And fill in "password" for "Password"
And click "Login"
Then I should see "Welcome back jimmy!"
When I click "Change Password"
And fill in the following
| Old Password | password |
| New Password | brand-new |
| Confirmation | brand-new |
And click "Change Password"
Then I should see "Your password has been changed."
145. Scenario: change password success
Given I'm on the login page
When I fill in "jimmy" for "Login"
And fill in "password" for "Password"
And click "Login"
Then I should see "Welcome back jimmy!"
When I click "Change Password"
Incidental Details
And fill in the following
| Old Password | password |
| New Password | brand-new |
| Confirmation | brand-new |
And click "Change Password"
Then I should see "Your password has been changed."
146. Scenario: change password success
Given I'm logged in
When I click "Change Password" Hide the noise!
And fill in the following
| Old Password | password |
| New Password | brand-new |
| Confirmation | brand-new |
And click "Change Password"
Then I should see "Your password has been changed."