@tooniez

Published

- 1 min read

Setting up .NET SpecFlow with NUnit

img of Setting up .NET SpecFlow with NUnit

Check out the source code - https://github.com/tooniez/specflow-nunit-template.

SpecFlow NUnit Boilerplate 🚀🔬

From zero to running SpecFlow NUnit tests in 5 mins

If this is useful to you, please :star: the repo and help show your support!

Scope

This guide will walk you through the process of setting up a .NET project with SpecFlow and NUnit. We’ll start by installing the necessary packages, then we’ll create a simple feature file and write some step definitions. Finally, we’ll run our tests and see the results.

Stay tuned for more updates!

A ready-to-use boilerplate for SpecFlow applications with NUnit for testing.

Project setup

🔧 Run the following command to install all the project dependencies:

     dotnet restore

Compiles and runs the application

🚀 Run the following command to compile and run the application:

   dotnet run

Compiles for production

👉 Run the following command to compile the application for production:

   dotnet build --configuration Release

This command generates an optimized production-ready build.

Run your unit tests

🔬 Run the following command to execute the unit tests for the applicaon using NUnit:

   dotnet test

Unit tests are used to test individual components and functions in isotion.

Customize configuration

For more information on customizing the configuration of your SpecFlowroject, refer to the SpecFlow Documentation.