This Specflow tutorial contains steps to install Sepcflow in Visual Studio and create your first testcase in Specflow.
Install Visual studio
Download and install a stable version of Visual studio from the Official website of Microsoft. https://visualstudio.microsoft.com/
Install Specflow Extension
- Open Visual Studio and navigate to below path Tool ==> Extensions and Updates ==> online ==>
- Search for spec flow and hit the download button.
- Restart your visual studio.
Create a desktop project in visual studio.
File ==> New ==> Project ==> Windows Desktop ==>
Plug-in Installation (Nuget)
Step 1) Navigate to the Nuget Package manager
Tool ==> Nuget Package Manager ==> Nuget Package Manager solution==>
Step 2) Search for the Specflow and install a stable version of Specflow.
Create a feature file
Create a new feature file and start writing your first test scenario with Specflow.
- Right Click on the project ==>Add ==> New Item ==>
- Select Specflow from the left side and create a feature file.
Create a Step Definition for the feature file
Step Definition: A file that will be bind with the feature file. In this file, we will write our source code in C# language which will be linked with all the test steps which we have written in the feature file.
Follow the same steps to create a step definition file.
Right-click on the project ==> Add ==> New Item ==>select Specflow from the left side and select a step definition file.
Package Installation to setup Sepcflow With Versions:
Specflow:
Specflow by TechTalk v2.3.2
Specflow.Nunit by TechTalk v2.3.2
SpecFlow.Tools.MsBuild.Generation by techTalk v2.3.2
NUnit:
NUnit by Charlie Poole v3.6.0
Selenium:
Selenium.Support by Selenium Committers v3.141.0
Selenium.WebDriver by Selenium Committers v3.141.0
Selenium.WebDriver.ChromeDriver by jsakamoto v72.0.3626.69
Error:
No test matches the given test case filter `FullyQualifiedName=SpecflowTutorial. LoginFeature.AddTwoNumbers`
Follow the below steps to solve this error.
Step 1) Switch to Visual studio
Step 2) Tools ==> Extensions and Updates
Step 3) Online ==> Search for “NUnit 3 Test Adapter”