Back in my posts long ago, I had mentioned something about GEB tests using the Where clause. The where clause added a table of data in the test, that the test would iterate through.
Similarly in Cucumber, it's called Examples, and it's invoked using a Scenario Outline. A basic Cucumber test has a Feature, which has a Scenario, which has steps.
In a case where you want to run different values, you would use a Scenario Outline. This works like this:
Feature: Cross Browser use
Scenario Outline: Users hit the same site in multiple browsers
Given a user goes to www.whatsmybrowser.com in "<browser>"
When they click the check my browser button
Then the output on the screen should be "<output>"
Examples:
| browser | output |
| ff | firefox |
| ie | IE |
|chrome | Chrome|
By doing this, we allow the BDD test itself to select the variables for browser and output. This way several iterations of the test could be run against one test.
Similarly in Cucumber, it's called Examples, and it's invoked using a Scenario Outline. A basic Cucumber test has a Feature, which has a Scenario, which has steps.
In a case where you want to run different values, you would use a Scenario Outline. This works like this:
Feature: Cross Browser use
Scenario Outline: Users hit the same site in multiple browsers
Given a user goes to www.whatsmybrowser.com in "<browser>"
When they click the check my browser button
Then the output on the screen should be "<output>"
Examples:
| browser | output |
| ff | firefox |
| ie | IE |
|chrome | Chrome|
By doing this, we allow the BDD test itself to select the variables for browser and output. This way several iterations of the test could be run against one test.
No comments:
Post a Comment