About Nunit


NUnit is a (unit) testing framework/platform. We’re using it for give some frames to our tests (like using NUnit attributes in our Hooks to fire up the driver and tear down the environment at the end) and to run our tests. 

Installation and Setup


You don’t need to setup anything if you’d like to use it in Visual Studio, only need to download the related NuGet packages:

  • NUnit (By Charlie Poole)
  • NUnit3TestAdapter (By Charlie Poole)
  • NUnit.Console (By Charlie Poole).

Automatically downloaded packages which are dependent to the Console:

  • ConsoleRunner
  • NUnitProjectLoader
  • NUnitV2Driver
  • NUnitV2ResultWriter
  • TeamCityEventListener
  • VSProjectLoader

Also install the NUnit 3 Test Adapter extension (Tools –> Extensions and Updates).

If you only need it for running the tests from command line, you only need to download and extract a zip file.

You can download it from here: https://www.nunit.org/index.php?p=download 

Click on the NUnit Console 3.x link from the latest releases. It will take you to a github page. From there, download the NUnit.Console-3.x.x.zip file and extract to a folder of your choice. 

Here you can find the official NUnit3 documentations:

We are only using a slice of the framework, but with LightBDD you can use all of the native NUnit functionalities and options. 

We are interested in two attributes regarding parallelization:

  • Parallelizable
  • LevelOfParallelism

We are setting these in the AssemblyInfo.cs file. 

You can read more about these attributes here: 

We are using SetUp and TearDown attributes for setting up and disposing the environment before and after every scenario/test. If we need to manipulate data before or after the whole test set, we can use OneTimeSetUp and OneTimeTearDown attributes. 

You can read more about these attributes here: 

If you’d like to run your automation tests from Visual Studio, you only need to (after grabbed the extension, and downloaded the necessary packages) Click on Run All, or right click on a specific test and click on Run/Debug Selected Test in the Test Explorer window of Visual Studio. If you don’t see this window, you can show it by Clicking on Test menu –> Windows –> Test Explorer. 

If you’d like to run your tests from command prompt you also need to do other things (build, restore nuget packages).