Wednesday, 28 December 2016

C# Visual Studio - SpecFlow Feature file

Configure SpecFlow in Visual Studio

Create new project, ex: Console Application.
Select 'Solution Explorer -> <<Project>> -> Add -> New Item'

Select 'SpecFlow Feature File', give some name Ex: 'SampleFirstFeature' and click 'Add' button.

Perform 'Build'.

Build failed, since 2 references are missing.

'Add References' for missing references.
'References' > 'Manage NuGet Packages' > Search for SpecFlow.

Install 'SpecFlow'.

Simillarly install 'SpecFlow.NUnit'.

SpecFlow references are installed and added to the 'References'.

Now perform the 'Build' again.

Open 'Test Explorer'.
 Test Explorer is unable to show the tests in Test Explorer.

To view the tests in 'Test Explorer' install 'NUnit3 Test Adapter'.

Go to "Tools -> Extensions and Updates -> Online" and search for "NUnit3 Test Adapter" and then install.


Restart Visual Studio.

Close Test Explorer, perform Build and open the Test Explorer.

Run Selected Tests.
Displays structure of step definition methods. 

No comments:

Post a Comment