Reputation: 383
Visual Studio 2017 C#
I have found that running a scenario outline it will run the test multiple times, so when i build and i can see in the test runner all the tests from the examples lines. When i execute one of these tests, it seems to execute every single example and line when I ran the single test not the parent group.
This is also happening in the Jenkins jobs created for it where it checks out a fresh copy of the code builds and executes. the job took 7 hours because each line is running every test so if I had 10 lines it would 100 times because each line would run 10 times which means each test is executed 10 times.
How is this happening and how do you prevent it.
Upvotes: 2
Views: 1783
Reputation: 5825
Scenario Outlines are Scenarios with parameters. You can specify them in one or more example tables. Each row in the table is one example and so a scenario.
They are like theories in XUnit.
Here is an example from the Gherkin reference documentation (https://cucumber.io/docs/reference#scenario-outline):
Scenario Outline: feeding a suckler cow
Given the cow weighs <weight> kg
When we calculate the feeding requirements
Then the energy should be <energy> MJ
And the protein should be <protein> kg
Examples:
| weight | energy | protein |
| 450 | 26500 | 215 |
| 500 | 29500 | 245 |
| 575 | 31500 | 255 |
| 600 | 37000 | 305 |
Upvotes: 2