Reputation: 1
Is it possible to write a scenario outline in gherkin which has an assertion step which won't be needed in all the examples?
The scenario will have two assertion steps to test a table which can be toggled.
For #2 when the table is toggled off, then the second step won't need to run so I am wondering if I can use a data table and leave the value empty
Example below:
Scenario Outline: Toggle graph and test data
Given I have "<Data>" data set
When I toggle the grid "<toggle>"
Then the grid is "<display>"
And all grid cells contain "<gridValues>"
Examples:
| Data | toggle | display | gridValues |
| 240 | On | displayed | 240 |
| 240 | Off | hidden | |
| null data | On | displayed | - |
| null data | Off | hidden | |
The "gridValues" will only be used in two of the scenarios.
Is there a better way of writing this?
Upvotes: 0
Views: 690
Reputation: 4109
Yes there is a better way of writing this. Try and write a scenario that explains WHAT you are doing and WHY its important, rather than one that is full of details that explain how you do something but actually reveals nothing at all about what you are doing.
Some questions to help you do this
etc. etc.
Try popping the Why stack with yourself and see if you can uncover the WHAT and WHY.
Upvotes: 1