Posted by Anuraj on Monday, January 23, 2017
This post is about running a specific test or specific category with .NET Core and NUnit. dotnet-test-nunit is the unit test runner for .NET Core for running unit tests with NUnit 3.
First you need to enable NUnit in dotnet core.
Here is the tests file.
And you can run
dotnet test, which will run all the tests in the class.
If you have lot of tests, you can seperate the tests with categories, something like this.
I have a set of unit tests and another set of integration tests. And if you want to run unit tests only you can pass the parameter and execute the unit tests only.
Here is the command,
dotnet test --where "cat == Unit", which will execute the tests under Unit category.
If you want to run a specific test, you can do that as well using
dotnet test --test Test2 command. You can find more details and command in the NUnit Console Command Line
Happy Programming :)