Our organization uses Xunit.net for our .net unit test framework. Migrating off is not an option. At the same time, we're pretty invested in the Atlassian ecosystem, and we're evaluating Bamboo as a possible build system. In order for us to make the move we need to figure out how to support xunit.net. Is this supported, and if so, can someone point me towards some documentation?
I found using FAKE instead of MSBuild made using xUnit quite easy (among other things. Never going back to MSBuild again). Just create your FAKE script by following their calculator example (http://fsharp.github.io/FAKE/gettingstarted.html), add an XUnit task like on their homepage (https://github.com/fsharp/FAKE) and create a bamboo task that calls "build.bat". Then on your FAKE xUnit task, just add a NUnitXmlOutput=true property to have it publish NUnit-style XML test results. (http://fsharp.github.io/FAKE/apidocs/fake-xunithelper-xunitparams.html). Finally add the NUnit parser task to your bamboo build, and it'll publish your results. It's pretty easy and ends up being quite flexible.
Evaluating Bamboo here, and this is how I solve it.
XUnit already includes a XSL Transformation file to convert Xunit.net to NUnit format: NUnitXml.xslt.
Thus, you can add a XslTransformation task in the msbuild project after the xunit task:
<xunit Assembly="%(TestAssemblies2.Identity)" Xml="%(TestAssemblies2.Filename).xml"/>
<XslTransformation XmlInputPaths="%(TestAssemblies2.Filename).xml" XslInputPath="$(PlatformDir)\Tools\xUnit\NUnitXml.xslt" OutputPaths="NUnit.%(TestAssemblies2.Filename).xml" />
Finally, set the proper file pattern (like NUnit.*.xml) in the NUnit parser.
Thanks. I hadn't considered that. It does have a command line runner. That should work. Next up will be trying to figure out how to import reports into Jira. I was a little disappointed to find that Bamboo doesn't seem to have much better report format support than Jenkins for .net solutions.
Thanks Dax, that works very well!
We're using the following tasks:
Script - a File script called Product.UnitTests.cmd (this builds the unit test projects and runs the tests using xUnit.net with the XML output set to NUnit format)
NUnit Parser - with the 'NUnit Test Results File/Directory' set to **/testresults/*.xml (this integrates the results into the Bamboo Tests tab)
The Product.UnitTests.cmd looks like:
packages\FAKE.3.5.4\tools\Fake.exe Product.UnitTests.fsx (where FAKE was installed via NuGet)
The Product.UnitTests.fsx FAKE file looks like:
// Include Fake library
let testDir = "./test/"
let testOutputDir = "./testresults/"
// Clean up
Target "Clean" (fun _ ->
CleanDirs [testDir; testOutputDir]
// Build unit tests
Target "BuildUnitTests" (fun _ ->
|> MSBuildDebug testDir "Build"
|> Log "TestBuild-Output: "
// Run unit tests
Target "RunUnitTests" (fun _ ->
!! (testDir + "*.UnitTests.dll")
|> xUnit (fun p ->
ShadowCopy = false;
HtmlOutput = true;
NUnitXmlOutput = true;
OutputDir = testOutputDir })
// Zip unit test results
Target "ZipUnitTestResults" (fun _ ->
!! (testOutputDir + "*.html")
|> Zip testOutputDir (testOutputDir + "testresults.zip")
// Start Tests
Note that the ZipUnitTestResults task is not needed for test integration with Bamboo, but is useful if you wish to add an artifact.
I have created a plugin for parsing xunit results in bamboo and published on the atlassian marketplace.
It should support v1, v2 and dotnet test outputs for xunit.
hope this helps.
Atlassian released a security advisory on 3/20/2019. The full advisory is here: https://confluence.atlassian.com/doc/confluence-security-advisory-2019-03-20-966660264.html In a nutshe...
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