top of page
Search

Stepup with SpecFlow

  • Writer: Kalhan Liyanage
    Kalhan Liyanage
  • Oct 24, 2019
  • 1 min read

Types of tests


  • Unit tests: Verify the behavior of a unit under test in isolation

  • Integration tests: Verify the behavior of either a part of the system or whole system.

  • Acceptance tests: Verify the software from the user’s point of view

  • UI tests are integration tests





Let's start with Specflow


1. Install visual studio latest version (2019)


2. Open visual studio > extensions > manage extensions > search for Specflow > install it (to install restart VS2019



3 . Create a new project

File > add > new project > Unit Test Project (.NET Framework)




4. Create project called i.e. AcceptanceTests

5. Right click on the solution > Manage nugget packages > go to Browse tab > search for specflow



6. After installing them Right click on the class file > New item > Specflow > Specflow feature File


7. After writing the feature file, you can generate the Step definition stubs by Right click on the file > Generate step definitions

8. Implement the step definitions according to the requirements.

Note: Referencing another project which contains methods


· Add the particular project to the solution by File> Add > Existing project

· Then right click on your test project > Add > References > Projects > Select the reference project


9. To run the tests




Note

How to resolve version conflict error


If you come up with a version conflict, remove the spec flow single file generator from custom tools (RC on feature> Properties)

1. Add the NuGet package SpecFlow.Tools.MsBuild.Generation with the same version as SpecFlow to your project.

2. Remove all SpecFlowSingleFileGenerator custom tool entries from your feature files.

 
 
 

Comments


©2019 by instakaley. Proudly created with Wix.com

bottom of page