Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run NUnit Runner in Atlassian Bamboo with NUnit 3?

I used NUnit Runner in Atlassian Bamboo (latest version) with NUnit 2 but after upgrading to NUnit 3 it is no longer working. It appears something changed with the command line in NUnit 3. Anyone know how to make NUnit 3 work in Atlassian Bamboo? Or could the NUnit devs consider backward compatibility for this breaking change?

I get the following error:

Invalid argument: -xml=TestResults-Rev_02f5436a0a70cd539bd3b77218fb48cbe3262954-Build_12.xml

like image 212
Neal Avatar asked Dec 02 '15 21:12

Neal


People also ask

What is NUnit Consolerunner?

The nunit3-console.exe program is a text-based runner for listing and running our tests from the command-line. It is able to run all NUnit 3.0 or higher tests natively and can run NUnit 2. x tests if the v2 driver is installed.


2 Answers

The simplest solution is to create a bat file that replaces -xml argument to --result.

Create a bat file in Nunit runner directory (by default C:\Program Files (x86)\NUnit.org\nunit-console) and copy the fallowing lines into it.

@echo off 
SET "var=%*"
CALL SET var=%%var:-xml=--result%%
nunit3-console.exe %var%;format=nunit2

Then use the bat file address as Nunit runner executable path.

like image 91
Bashir Avatar answered Sep 20 '22 22:09

Bashir


Hopefully the Atlassian team will update Bamboo to support NUnit 3 soon. I would suggest submitting a request with them. The NUnit team will be happy to help them if they have any questions.

NUnit will not support a backward's compatible command line, but you can likely get Bamboo working now by modifying the test execution task.

I haven't used Bamboo, but on AppVeyor, we had to disable automatic test detection and running, then instead of using the built in NUnit task, we execute the new nunit3-console directly, passing in the test assemblies.

If Bamboo parses and displays the test results, you can instruct NUnit 3 to produce XML in the version 2 format with the command --result=TestResults.xml;format=nunit2

like image 39
Rob Prouse Avatar answered Sep 19 '22 22:09

Rob Prouse