It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How do you run nunit tests in Bamboo?

I have a .NET Solution that is built in Bamboo (3.03) using the MSBUILD builder. That builds several assemblies including some nunit test assemblies. I want to run nunit and generate test results after the solution file is built successfully.

How do you do this? Ie. What builder should I use? Do I need multiple Jobs for the Plan? And does the procedure change if I upgrade to a newer version of Bamboo?

I've tried creating a second Job which will run nunit-console.exe after the first Default Job has built the assemblies. The problem is that when the second job runs, it is in its own subfolder with a new copy of the repository files, which does not include the freshly compiled dll's from the previous Job.

2 answers

1 accepted

2 votes
Answer accepted
Joe_Clark Atlassian Team Jun 29, 2011

EDIT: I thought there was built-in support for running NUnit tests in Bamboo 3.1, but I was stupidly mistaken. There is a built-in test result parser, but shelling out to a batch script or a custom MSBuild task is still the "best" way to go for now.


If you're able to upgrade to Bamboo 3.1, there is built-in support for running NUnit Tests and parsing NUnit XML Result files as stand-alone tasks in a build. Check out the release notes.

Otherwise, I think the easiest solution is to edit your MSBuild file and use the MSBuild Community Tasks to call NUnit to execute your tests. For example, a skeleton implementation of this in MSBuild would look something like this:

<Project xmlns="">

<Import Project="lib\MSBuild.Community.Tasks.Targets" />

<Target Name="Test">

<NUnit Assemblies="bin\Debug\MyAssemblyToTest.dll" ToolPath="C:\Program Files\NUnit 2.5.10\bin\net-2.0" OutputXmlFile="bin\Debug\TestResults.xml" />



I'll try upgrading to 3.1. From the release notes it looked to me like it was just an NUnit Parser to parse results, not necessarily to run it. I'd be happy to upgrade if it lets me run the tests!

I'm trying to avoid changing the build file so that they don't run on every developer build automatically (I know I can use conditional testing to only run in on Release builds), but I'll do it that way if I have to. Thanks.

Joe_Clark Atlassian Team Jun 30, 2011

Darn, you're right. I thought there was a new task just for running NUnit tests, but I must have imagined it!

You could configure a stand-alone task to run a custom MSBuild file that is not part of the main solution, so it won't run as part of every developer's build. Something like this:

I know I'm probably sounding like a sales pitch, but the tasks configuration in 3.1 is really flexible and I think it's awesome! :-)

There is an issue open to introduce an nunit runner to the Bamboo .NET Plugin. Please vote, comment and harass us about it on the issue!

The .NET plugin is open source too - so if your feeling adventureous you could hack a runner together pretty easily :)

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Bamboo

Using Bamboo with new Bitbucket Cloud authentication

...roperties: There are patches available for Bamboo versions 6.8.3, 6.9.2, and 6.10.5 on the bug report that add support for the System Property. T...

263 views 0 5
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you