J OpenDock
J OpenDock

Reputation: 59

Data Driven Tests- Examples Table with Nunit

I have a task of creating a test using c#. I have my specflow with Given, When, Then. Within my test i have an example table. When i generate the step definitions where would i pass the parameters for this

| Lifecyclestatus |
| Prenew          |
| New             |
| Current         |
| Clearance       |
| Old             |

Upvotes: 1

Views: 477

Answers (1)

Subburaj
Subburaj

Reputation: 2334

Data Driven Testing can be achieved using the Scenario outline. All the parameters needs to be mentioned in the Examples Section. Please see the below sample feature

Scenario Outline: Addition Check with multiple set of data
    Given I have entered <Number 1> into the calculator
    And I have entered <Number 2> into the calculator
    When I press add
    Then the result should be <Result> on the screen

Examples: 
| Number 1 | Number 2 | Result |
| 10       | 20       | 30     |
| 15       | 25       | 40     |
| 50       | 90       | 140    |
| 2        | 2        | 4      |    

The above Scenario will be executed for all the data which is mentioned in the Examples Section.

Upvotes: 3

Related Questions