-
-
Save thecatwasnot/1268965 to your computer and use it in GitHub Desktop.
cucumber examples
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Feature: Cucumber Question | |
Scenario Outline: Google Search for <search term> | |
Given I am on Google Search Home Page | |
When I search for "<Search Term>" | |
Then I should find "<Search Term>" | |
Examples: | |
| Search Term | | |
| Facebook | | |
| Delicious | | |
step definitions: | |
Given /^I am on Google Search Home Page$/ do | |
@site.browser.title == "Google" | |
end | |
When /^I search for "([^"]*)"$/ do |arg1| | |
@site.google_search.search_field.set arg1 | |
end | |
Then /^I should find "([^"]*)"$/ do |arg1| | |
@site.google_search_page.text.include? arg1 | |
@site.browser.close | |
end | |
errors | |
wrong number of arguments (0 for 1) (ArgumentError) | |
./features/step_definitions/google_steps.rb:10:in `google_search' | |
./features/step_definitions/google_steps.rb:10:in `/^I search for "([^"]*)"$/' | |
features/google.feature:4:in `When I search for "<Search Term>"' | |
wrong number of arguments (0 for 1) (ArgumentError) | |
./features/step_definitions/google_steps.rb:10:in `google_search' | |
./features/step_definitions/google_steps.rb:10:in `/^I search for "([^"]*)"$/' | |
features/google.feature:4:in `When I search for "<Search Term>"' | |
Failing Scenarios: | |
cucumber features/google.feature:2 # Scenario: Google Search for <search term> | |
cucumber features/google.feature:2 # Scenario: Google Search for <search term> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
the part after the do is kind of like an argument list, so if you want to try to use arg1, it should match on both lines