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?
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.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
https://marketplace.atlassian.com/plugins/com.wwwlicious.xunit.xunit/server/overview
hope this helps.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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:
// We use FAKE (F# Make) to run our xUnit.net tests within Bamboo
// See http://fsharp.github.io/FAKE/gettingstarted.html and http://fsharp.github.io/FAKE/index.html for more info.
// Include Fake library
#r @"packages/FAKE.3.5.4/tools/FakeLib.dll"
open Fake
// Properties
let testDir = "./test/"
let testOutputDir = "./testresults/"
// Clean up
Target "Clean" (fun _ ->
CleanDirs [testDir; testOutputDir]
)
// Build unit tests
Target "BuildUnitTests" (fun _ ->
!! "./*.UnitTests/*.UnitTests.csproj"
|> MSBuildDebug testDir "Build"
|> Log "TestBuild-Output: "
)
// Run unit tests
Target "RunUnitTests" (fun _ ->
!! (testDir + "*.UnitTests.dll")
|> xUnit (fun p ->
{p with
ShadowCopy = false;
HtmlOutput = true;
NUnitXmlOutput = true;
OutputDir = testOutputDir })
)
// Zip unit test results
Target "ZipUnitTestResults" (fun _ ->
!! (testOutputDir + "*.html")
|> Zip testOutputDir (testOutputDir + "testresults.zip")
)
// Dependencies
"Clean"
==> "BuildUnitTests"
==> "RunUnitTests"
==> "ZipUnitTestResults"
// Start Tests
RunTargetOrDefault "ZipUnitTestResults"
Note that the ZipUnitTestResults task is not needed for test integration with Bamboo, but is useful if you wish to add an artifact.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Paul,
If this framework supports command line you can create a script task in Bamboo to deploy it.
You just need to make sure that the computer that is making the build has all the framework requirements installed.
Regards,
Celso Yoshioka
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Celso,
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.