.NET Core 2.0 NUnit testing - TeamCity

746 Views Asked by At

I have an application developed in ASP.NET Core 2.0. And I have got NUnit testing working in Visual Studio 2017 following this tutorial.

On my Linux server with Docker, I installed TeamCity from their official Docker image and installed this TeamCity agent to build the application.

Now, I want to add a build step to run NUnit tests. So TeamCity has the option to choose NUnit for the Runner type in the build step, but it requires to add the "Path to NUnit console tool" and I don't understand how to get this working. I cannot find the path.

Enter image description here.

1

There are 1 best solutions below

0
On

The NUnit console runner executable ships with the NunitConsoleRunner package and lives in the "tools" folder of said package as an EXE file.

For your TeamCity build agent purposes if you have the NunitConsoleRunner package referenced in your project, so long as you have a NuGet Restore Packages step before this then the path you've referenced above should work, as you'll have installed it during the restore step. (Providing that's the right version/path of the CLI that you're hard coding in the build step there.)

If it's not working, we would need some details about error/stack trace to figure out the problem.

Another way you could go about this is to install the NUnit CLI as an environmental prerequisite on your build agent and reference it there via an environment variable. In your case you'd probably need to mount the binary into your agent when you start up the container.