cucumber background outline example
Example 1: background in cucumber
Background in Cucumber is used to define
a step or series of steps which are common
to all the tests in the feature file.
It allows you to add some context to the
scenarios for a feature where it is defined.
A Background is much like a scenario containing
a number of steps. But it runs before
each and every scenario where for a feature in which it is defined.
Example 2: scenario outline
Scenario Outline: Search functionality header verification
When User searches "<searchValue>" in the wiki search page
Then User should see "<expectedTitle>" in the wiki title
Then User should see "<expectedMainHeader>" in the main header
Then User should see "<expectedImageHeader>" in the image header
Examples: example test data for wikipedia search
| searchValue | expectedTitle | expectedMainHeader | expectedImageHeader |
| Steve Jobs | Steve Jobs | Steve Jobs | Steve Jobs |
| John Travolta | John Travolta | John Travolta | John Travolta |
| Albert Einstein | Albert Einstein | Albert Einstein | Albert Einstein |
| Keanu Reeves | Keanu Reeves | Keanu Reeves | Keanu Reeves |
| Bruce Lee | Bruce Lee | Bruce Lee | Bruce Lee |
| Dua Lipa | Dua Lipa | Dua Lipa | Dua Lipa |
| Thomas Edison | Thomas Edison | Thomas Edison | Thomas Edison |
| Sam Heughan | Sam Heughan | Sam Heughan | Sam Heughan |