SpecFlow - Binding Test Steps



Test Steps in Feature File

To access the steps in the Feature File, go to the SpecFlow project within the Solution Explorer. Then click on the Features folder. The Feature File shall be displayed.

Solution Explorer

A Feature File is useful for documenting the expected characteristics of an application in a format which is in plain text and can also be used for automation. The keywords Given, Then, When, and so on are used in SpecFlow to describe scenarios in Gherkin language.

Test Step Binding

The above Feature file has been added by default by the SpecFlow project. It also produces test methods that shall run scenarios defined within the feature file. Right-click on any line on the after the Scenario keyword. Then click on the Go To Definition option.

Run Scenarios

Visual Studio identifies the corresponding step definition to this step. In this example, it opens the class CalculatorStepDefinitions and moves to the GivenTheFirstNumberIs method.

Studio Identifies
Advertisements