Search code examples
c#.nettestingbddspecflow

BDD SpecFlow Scenarios


Today I started studying BDD using SpecFlow + Selenium and I found several examples that only showing 1 return.

How do I write a scenario that returns more than one item. For example:

Given a name "test"
I click on the SEARCH button

Then the result will be equal to the table below:

name | last name
test | fulano
test | siclano

In this case, How do I write the THEN?, accepting return the 2 rows of the table showed?


Solution

  • Scenario:

    Given a name "test"
    When I click on the SEARCH button
    Then the result will be 
    | name | last name
    | test | fulano
    | test | siclano
    

    code:

    [Then("The result will be")]
    public void ThenTheResultWillBe(Table table)
    {
        //check that the result contains all the values in the table
    }