Testing .NET Core with NUnit in Visual Studio 2017

The switch from the project.json format to the new csproj based format for .NET Core and .NET Standard projects also changed the API for test adapters. Because of this, NUnit’s dotnet-test-nunit adapter stopped working and we had to update our existing Visual Studio test adapter to support .NET Core. Last night I released the first alpha release of the test adapter to NuGet enabling testing of .NET Core and .NET Standard projects using Visual Studio 2017, Visual Studio Code, TFS Build, and, the dotnet test CLI command.

(more…)

Read more

NUnit 3 Tests for .NET Core RC2 and ASP.NET Core RC2

Update 2: The switch from the project.json format to the new csproj format and the associated tooling changes made the dotnet-test-nunit adapter obsolete by switching the test adapter API. I have released an update to the NUnit Visual Studio Adapter that implements the new test API and supports .NET Core. If you are using Visual Studio 2017 and/or the new .NET Core tooling, see Testing .NET Core with NUnit in Visual Studio 2017.

Update: I have released beta 1 of dotnet-test-nunit which has been updated to the RTM of .NET Core 1.0. I have updated this post and the code on GitHub to reflect the changes.

The NUnit team has been working hard since .NET Core RC2 and ASP.NET Core RC2 was released last month to add full NUnit testing for .NET Core, and we are happy to announce the second alpha release of dotnet-test-nunit.

In my previous blog posts, I explained how to use NUnit to test .NET Core using NUnitLite which worked, but was not the ideal solution. The new dotnet-test-nunit allows you to test from the command line using the dotnet test command and allows you to run your tests within Visual Studio. (more…)

Read more

Testing .NET Core RC2 Using NUnit 3

Update: full NUnit 3 support for .NET Core and ASP.NET Core has been released.

Things have changed since I wrote Testing .NET Core Using NUnit 3, so it is time to update the steps for .NET Core RC2.

The code from this post is on GitHub in the nunitlite and test_assembly branches. For those interested in an early peek at the new dotnet-test-nunit runner, there is an example on the master branch. (more…)

Read more

Testing .NET Core using NUnit 3

Update 3 – full NUnit 3 support for .NET Core and ASP.NET Core has been released.

Update 2 – I have rewritten this post for .NET Core RC2 with new code on GitHub. I would suggest reading it and only come back to this post for details that I might have glossed over.

Update – This post was originally written against a pre-release version of NUnit 3. I have updated the code to reflect the changes in NUnit 3.2. Further updates will come once the RC2 of .NET Core is released.

We added .NET Core (DNX) support to the RC release of NUnit 3.0, but it probably isn’t obvious on how to test your .NET Core applications. The test runner that ships with NUnit 3, nunit3-console.exe is a .NET 2.0 application that cannot run NUnit tests that reference the portable version of the framework. After the final 3.0 release, we plan on writing a DNX based runner, but until then, you can test your applications using the NUnitLite NuGet package to create self-executing tests. I will walk through doing this in Visual Studio. (more…)

Read more