2

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

Sumit Jain
  • 77
  • 1
  • 4

3 Answers3

1

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
Piotr M.
  • 385
  • 2
  • 8
  • Hi @Piotr, Thanks for the explanation. But, what I was saying is that I am able to use Scenario and Scenario Outline interchangeably. For example- I am able to use Scenario instead of scenario outline in your first example without any issue. There is no issue in running these tests in parallel as well. Scenario: Given the system is up and running When the user provides value Then the system should display Examples: |TestData| ExpectedResult | |True | Operation failed | |False | Operation succeeded| – Sumit Jain Aug 15 '21 at 17:19
  • If so, SpwcFlow implementation is smarter than I thought. So, what is the problem? 'Scenario Outline' is a part of Gherkin specification and using it makes your tests more readable - your intentions are clearer. – Piotr M. Aug 15 '21 at 21:54
  • I just wanted to understand, if there are actually any difference between scenario and scenario outline. And that is why the question. :) – Sumit Jain Aug 16 '21 at 04:35
  • The semantic difference. As I said - SpecFlow implementation is smarter than it should be and can handle 'Scenario' with examples as 'Scenario Outline'. – Piotr M. Aug 16 '21 at 06:59
0

Scenario outline and scenario not that much of difference, in outline covered multiple examples no need to repetitive all the statements and n scenarios need to mention in different steps all the examples.

Yogita
  • 1
0

I did a bit of digging in the release notes and found that this is something SpecFlow started supporting in v3.1.61-beta. There is a PR that says that Scenario with Examples should be treated as a Scenario Outline. So, looks like we don't need to use Scenario Outline.

Martin
  • 644
  • 5
  • 11