Cucumber Scenario Outline Examples for different Testing Types

Profile picture for user devraj
Submitted by devraj on

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
  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>"
      | email                       | password | heading        |
      | | test1234 | My account     |
      |     | test     | Authentication |
      | email                       | password | heading        |  
      |     | 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.



Feature: Login Test

Scenario Outline: Test Login
WHEN User entered <uname> and <pwd>


| uname     | pwd    |
| s_uname | s_pwd |


| uname     | pwd    |
| p_uname | p_pwd |

So as can be seen, i have put different tags on top the Examples. Using this i want to run the same step with different test data as per the environment.
This is working fine on local. But when trying from Jenkins, I can only run using the tag of the First Examples. When tried using the 2nd Examples tag, it somehow not recognising any such tag, it seems. Request you to help me, as if this not allowed only in Jenkins or am i missing something here

Jenkins error when tried using the 2nd Tag(@Prod):
Image removed.

Fri, 09/30/2022 - 07:06 Permalink