Brendan
Brendan

Reputation: 163

xUnit dotnet test CLi to output to NUnit xml so that Bamboo can read the results

We are starting a new .net core project and we are just setting up Bamboo to build our project and run the tests and so my question is:

Is there a way that we can use the xunit dotnet test CLi test runner to output in NUnit format?

Currently we have: "dotnet test -xml TestResults.xml" to run our tests which works great except we can't get the results in Bamboo.

Or does anyone have an alternative that would work for us?

Upvotes: 10

Views: 6886

Answers (4)

Jack Ukleja
Jack Ukleja

Reputation: 13501

For those interested, .NET Core SDK 2.0 not longer supports the -xml option, but it does support --logger which can be used to select specific output formats including MSTest (.trx), which is supported by Bamboo.

Example invocation:

dotnet test --logger "trx;LogFileName=abc.trx"

Note: abc.trx can be a relative or absolute path, including ellipsis.

Upvotes: 7

Scott Mackay
Scott Mackay

Reputation: 1214

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.

Upvotes: 2

Richard Szalay
Richard Szalay

Reputation: 84724

Edit

Apologies, I missed your mention of .net core.

Although it's not documented, apparently you can pass -xml filename.xml to dotnet test, which will output xUnit v1 XML. Unfortunately dotnet-test-xunit doesn't suppport converting that output into NUnit-format, but xunit proper does maintain an XSL transform to do it.

Original Answer

Assuming you're using xunit.runner.console, you can simply run:

xunit.console.exe Assembly.dll  -nunit test-results.xml

And then use Bamboo's NUnit parser to process the results.

Upvotes: 0

Brendan
Brendan

Reputation: 163

For anyone who comes along this and is interested. I posted the issue on xUnit's github here: https://github.com/xunit/xunit/issues/977 and was refered to another issue that is to be release here: https://github.com/dotnet/corefx/issues/5593

I haven't as yet confirmed that the NUint output format is indeed going to be released as yet but thought i would post it anyway.

Upvotes: 1

Related Questions