Search code examples
bddspecflowgherkin

Splitting examples in Given and Then for SpecFlow Scenario Outline


I am writing a specflow scenario with multiple input and output parameters (about 4-5 each). When using scenario outline, I need to write a wide table giving both input and output columns in the same row. Is there any way where I can specify the examples separately for the step definitions? This is for improved readability.

Current state

Given - State of the data
When I trigger action with parameters <input1> and <input2> and ...
Then my output should contain <output1> and <output2> ...

Examples:
| input1 | input2 |... | output1 | output2 |...

Can I do this?

Given - State of the data
When I trigger action with parameters <input1> and <input2> and ...
       Examples of input
Then my output should contain <output1> and <output2> ...
        Examples of output

Solution

  • No, unfortunately that (or anything similar) is not possible. You could make your inputs and outputs more abstract and possibly merge a few columns. Example: instead of Country | PostalCode | City | Street | House | Firstname | Lastname | etc. you should have | Address | Job title | with values like "EU", "US, missing postal code", "HQ" for the address.