Tutorial 10 Data Driven Testing in Cucumber Scenario Outline
Tutorial 10 Data Driven Testing in Cucumber Scenario Outline
Now, in the above ‘Scenario Outline’, look at line numbers 7 and 8. We have written
“<Username>” and “<Password>”. So these are string values because these are written
within double quotes
Now, the <Username> that you see in the figure above is actually the column name that
we have written in the ‘Examples’ table. Similar is the case with <Password>. These
should be an exact match. You cannot write <Username> in line number 7 and
USERNAME in ‘Examples’ table.
So the entire scenario will be executed 2 times since wehave 2 rows in our ‘Examples’
table
Notice the console output. The scenario got executed twice. The username/password
was picked up from the ‘Examples’ table.
Also, 14 steps got passed since we have 7 steps in a scenario. This would be multiplied
by 2 rows in the table, hence 14 steps
So, invalidusername/98765 was picked up in first scenario execution and
way2automation/invalidpassword was picked up in second scenario execution
Let us now take another example wherein both the rows have only numeric values, see
below
Save the file and run it
So this is how we use the ‘Scenario Outline’ and ‘Examples’ keyword combination to
execute data driven testing in cucumber.
Thank you for reading!