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.
- Check that a data table is displayed.
- If it is then check the values are correct.
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?
Scenario. A common phrase used in such case isdon't code your feature file. (in an ideal world) The sentences are written before any code design decision has been chosen. At this stage it might not even be decided that there will be a toggle. (this heavily depends on what should be achieved) - SubOptimal