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.
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:
<Import Project="lib\MSBuild.Community.Tasks.Targets" />
<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.
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: http://screencast.com/t/vT9MIUXI7tAL
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! :-)
It's officially Tuesday, which means it's officially time for another tip to help you better navigate this space we call the Atlassian Community. 😄 I got a great question from community member, Sa...
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG
You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs