Specflow scenario outline with then table



  • I have a scenario outline with an example table with multiple rows having unique test parameters that are being used for given statement and then statement table for verification. Basically when the scenario gets run with the first row of examples table, I want to use the first row of then table to verify the result and so on.

    Is it possible to do this? If not should I go with another scenario design?

    Feature: MyFuture  
    
    @Do something  
    Scenario Outline: Verify bla bla    
        Given run I ... with <jj>,<kk>,<ll>  
        Then verify the following  
        | aa  |  bb | cc |  
        | d   |  e  | f  |  
        | g   |  h  | i  | 
    
    Examples:  
        | jj | kk | ll |  
        | m  | n  | o  |  
        | p  | q  | r  |     
    


  • Add your assertions to the examples table, and reference them in the Then step:

    Feature: MyFuture  
    
    @Do something  
    Scenario Outline: Verify bla bla    
        Given run I ... with <jj>,<kk>,<ll>  
        Then verify the following: <aa>, <bb>, <cc>
    
    Examples:
        | jj | kk | ll | aa | bb | cc |
        | m  | n  | o  | d  | e  | f  |
        | p  | q  | r  | g  | h  | i  |
    

Log in to reply
 

Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2