Visual Studio For Mac Nunit

Vs4mac, nunit, visual studio, unit testing, tdd, code kata, learning, programming July 06, 2017 — 3 min read — 0 Comments Last month at the AkronCodeClub they selected the magic square kata, which was a new one for me. March 2014 in Visual Studio for Mac Tools for Xamarin I could be missing something really straightforward here but I cannot for the life of me get an nUnit project to build in XS on Mac. Creating the same project on XS in Windows is not a problem - only on the Mac (which is running Alpha updates for the University courses). Extension for Visual Studio - NUnit 3 adapter for running tests in Visual Studio. Works with NUnit 3.x. For running NUnit 2 tests, use the NUnit 2 adapter.

Please complete the security check to access this website.

Nunit

Why do I have to complete a CAPTCHA?

Completing the CAPTCHA proves you are a human and gives you temporary access to the web property.

What can I do to prevent this?

If you are on a personal connection, like at home, you can run an anti-virus scan on your device to make sure it is not infected with malware.

Visual Studio For Mac Nunit

If you are at an office or shared network, you can ask the network administrator to run a scan across the network looking for misconfigured or infected devices.

Active3 years, 2 months ago

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

Visual Studio For Mac Nunit

Here are the build steps I am using in VSTS:

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:

Build output:

Nunit Visual Studio 2017

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

Rishub Nagpal

Visual Studio For Mac Os

Rishub Nagpal
4881 gold badge9 silver badges27 bronze badges

1 Answer

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.

Eddie Chen - MSFTEddie Chen - MSFT
25.7k2 gold badges25 silver badges48 bronze badges
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.

Not the answer you're looking for? Browse other questions tagged macosvisual-studiomsbuildnunitazure-devops or ask your own question.