scenario outline in cucumber code example

Example 1: scenario vs scenario outline

SCENARIO OUTLINE : 
basically replaces keywords with 
the value from the table. Each row
in the table is a scenario.
| username | password  | 
| user1    | password1 | 
| user2    | password2 |

SCENARIO : 
Scenario is executed only once.

Example 2: scenario outline

Scenario Outline: Search functionality header verification
    When User searches "" in the wiki search page
    Then User should see "" in the wiki title
    Then User should see "" in the main header
    Then User should see "" 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         |

Example 3: scenario outline in cucumber

Scenario outlines allows us to run different test data against same scenarios
1- Use “Scenario Outline” keyword instead of “Scenario” keyword..
2- Use diamond brackets in parameter outlines ""
3- Create examples and pass the outlines --> Examples or Scenarios

Example:
Scenario Outline: Search functionality header verification
    When User searches "" in the wiki search page
    Then User should see "" in the wiki title
    Then User should see "" in the main header
    Then User should see "" 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

Example 4: what is scenario outline in cucumber

Scenario outlines allows us to run different test data against same scenarios

Example:
Scenario Outline: Search functionality header verification
    When User searches "" in the wiki search page
    Then User should see "" in the wiki title
    Then User should see "" in the main header
    Then User should see "" 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         |

Tags:

Misc Example