Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting NUnit tests to run on Visual Studio Team Services (Mac Build agent)

I can't seem to get NUnit tests to run on our Mac build agent using VSTS

Here are the build steps I am using in VSTS:

enter image description here

Note, Test assemblies is disabled because the Mac build agent does not have VSTest.exe. In the options menu, there is no way to completely remove the need for VSTest so I cannot use that step on the mac build agent.

Is there a way to run NUnit tests in the MSBuild step?

Things I have tried:

  • Install NUnit test adapter in Visual Studio
  • Install MSBuildTasks + Nunit MSBuild task (Not sure how to use it)

As a last resort, I can add a shell script to run nunit-console on the mac build agent, but I would prefer to avoid that. The reason the build agent needs mac os x is because we're building an iOS and Android app with Xamarin.

Screenshot of the references and NuGet packages in VS:

2

Build output:

enter image description here

Test assemblies are created, but I can't get them to run

like image 941
RN_ Avatar asked Jun 04 '16 16:06

RN_


1 Answers

The instruction for how to use MSBuild tasks for NUnit can be found here: NUnit3 or NUnit. You need to update your project file to import the tasks according to this: Get Started and then add the NUnit MSBuild tasks into your project file. And you can also add an Exec Task in your project file to call NUnit console to run the NUnit test.

like image 141
Eddie Chen - MSFT Avatar answered Oct 18 '22 02:10

Eddie Chen - MSFT