Skip to main content

Cucumber Scenario Outline Examples for different Testing Types

Tags should also be utilized for testing types. Scenario Outlines contain data tables to run over, and it’s an effective use of these tables to divide the tests run into Smoke and Regression tests. Create smaller subsets of the data for a Smoke test, and tag the larger tables as Regression. Additional testing types can also be rolling into this structure, with little effect on the tests.

  #Scenario Outline Example
  @SearchTest
  Scenario Outline: Verify Login Functionality
    When I fill in "input[id='email']" with "<email>"
    And I fill in "input[id='passwd']" with "<password>"
    And I click on "button[id='SubmitLogin']"
    Then I should see heading "<heading>"
		
    @RegressionTest
    Examples: 
      | email                       | password | heading        |
      | goswami.tarun77+7@gmail.com | test1234 | My account     |
      | wrongusername@gmail.com     | test     | Authentication |
    @SmokeTest
    Examples: 
      | email                       | password | heading        |  
      | wrongusername@gmail.com     | test     | Authentication |

In above above scenario, I want to execute only one set of data for Smoke Test and 2 rows for Regression Test. Remember Here you need to repeat Examples: Keyword and headers. So, When you will specify RegressionTest, it will execute 2 rows of examples and when you will specify smoke test it will execute one row of examples.

Submitted by tgoswami on August 30, 2020

Tarun has 11+ years of experience in Quality Assurance in different domains like Banking, E-commerce, Health and Education.

About

At ProgramsBuzz, you can learn, share and grow with millions of techie around the world from different domain like Data Science, Software Development, QA and Digital Marketing. You can ask doubt and get the answer for your queries from our experts.