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

NUnit 3 Support in Cake Build

cakeI’ve been using Cake Build in a lot of projects lately. Cake is a cross platform build automation system with a C# DSL to do things like compiling code, copy files/folders, running unit tests, compress files and build NuGet packages.

Cake supported running NUnit 2.x, but as NUnit 3 was a complete rewrite with a new console runner and new command line options, it needed to be updated, so I added the new NUnit3 build alias to Cake. It is available in Cake v0.6.1 on. It also supports running NUnit 2 tests, so you should consider upgrading all your scripts to use the new alias.

After I created my Son of Obsidian theme extension for Visual Studio Code, I documented how to create an extension for the Cake team and they managed to add Cake support to Visual Studio Code the same day.

If you aren’t already using Cake, give it a try.

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

NUnit 3.0 Test Runner for Android and iOS

We are busy preparing the long awaited beta release of NUnit 3.0 that should ship this week, but I’ve also been working on NUnit 3 runners for Android and iOS using Xamarin. It is still early days, but it is working fairly well, so I wanted to show it off and hopefully get some feedback on it. Windows phone will follow shortly and I will update it to support other platforms like Windows Store when Xamarin’s support moves from early preview to beta. (more…)

Read more