Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between Scenario and Scenario outline?

I have been reading the difference between scenario and scenario outline from different resources, but everywhere I could able to find is that ' Scenario works with single values, where you can use Scenario outline to run the same scenario for multiple examples.

But in practical, I am not seeing this difference. I am able to use Scenario and Scenario Outline interchangebaly without any issue even when I have multiple examples.

Can someone please tell me is it something which is being allowed in any recent version of Specflow? And are there any actual differences between Scenario and Scenario Outline?

Specflow version which I am using is: 3.1.89

like image 805
Sumit Jain Avatar asked Sep 07 '25 04:09

Sumit Jain


1 Answers

Scenario outline is a template. The steps for related scenarios are the same, but the system behavior can be different for different data. Consider the following example:

Scenario Outline:
Given the system is up and running
When the user provides value <TestData>
Then the system should display <ExpectedResult>

Examples:
|TestData| ExpectedResult     |
|True    | Operation failed   |
|False   | Operation succeeded|

Without the scenario outline you would have to prepare the following scenarios:

Scenario:
Given the system is up and running
When the user provides value True    
Then the system should display Operation failed

Scenario:
Given the system is up and running
When the user provides value False   
Then the system should display Operation succeeded
like image 56
Piotr M. Avatar answered Sep 09 '25 16:09

Piotr M.