Executing SpecFlow scenarios and feature files

Before you right click and execute your first scenario, you need to ensure that SpecFlow UnitTestProvider is set properly in App.config file as shown below. If you do not specify MsTest as UnitTestProvider, you will see error saying — No tests found to run.

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <section name="specFlow" type="TechTalk.SpecFlow.Configuration.ConfigurationSectionHandler, TechTalk.SpecFlow" />
  </configSections>
  <specFlow>
    <unitTestProvider name="MsTest" />
  </specFlow>
</configuration>

Also ensure that SpecFlow Test Runner tool is selected as shown in below image. You can open below window from Tools -> Options menu in Visual Studio.

SpecFlow Test Runner tool in Visual Studio

SpecFlow Test Runner tool in Visual Studio

Then just right click on the scenario and execute it as shown in below image.

Run SpecFlow Scenario in Visual Studio

Run SpecFlow Scenario in Visual Studio

You can view the output of test execution as shown in below image.

Viewing the Output of SpecFlow scenario execution in Visual Studio

Viewing the Output of SpecFlow scenario execution in Visual Studio

 

You may also like...