gabrielweyer-pre-release - dotnet-xunit-to-junit 0.3.2-update-dotnet0003

Transforms a xUnit.net v2 XML test results file into a JUnit test results file.

PM> Install-Package dotnet-xunit-to-junit -Version 0.3.2-update-dotnet0003 -Source https://www.myget.org/F/gabrielweyer-pre-release/api/v3/index.json

Copy to clipboard

> nuget.exe install dotnet-xunit-to-junit -Version 0.3.2-update-dotnet0003 -Source https://www.myget.org/F/gabrielweyer-pre-release/api/v3/index.json

Copy to clipboard

> dotnet tool install -g dotnet-xunit-to-junit --version 0.3.2-update-dotnet0003 --add-source https://www.myget.org/F/gabrielweyer-pre-release/api/v3/index.json

Copy to clipboard
<DotNetCliToolReference Include="dotnet-xunit-to-junit" Version="0.3.2-update-dotnet0003" />
Copy to clipboard
source https://www.myget.org/F/gabrielweyer-pre-release/api/v3/index.json

nuget dotnet-xunit-to-junit  ~> 0.3.2-update-dotnet0003
Copy to clipboard

> choco install dotnet-xunit-to-junit --version 0.3.2-update-dotnet0003 --source https://www.myget.org/F/gabrielweyer-pre-release/api/v2

Copy to clipboard
Import-Module PowerShellGet
Register-PSRepository -Name "gabrielweyer-pre-release" -SourceLocation "https://www.myget.org/F/gabrielweyer-pre-release/api/v2"
Install-Module -Name "dotnet-xunit-to-junit" -RequiredVersion "0.3.2-update-dotnet0003" -Repository "gabrielweyer-pre-release" -AllowPreRelease
Copy to clipboard

Browse the sources in this package using Visual Studio or WinDbg by configuring the following legacy symbol server URL: https://www.myget.org/F/gabrielweyer-pre-release/symbols/


xUnit.net v2 XML Format to JUnit Format

Package Release
dotnet-xunit-to-junit NuGet
CI Status Platform(s) Framework(s) Test Framework(s)
AppVeyor Build Status Windows netcoreapp2.1, netcoreapp3.1 netcoreapp3.1

CircleCI can only parse test results in the JUnit format. This Extensible Stylesheet Language Transformations can transform a xUnit.net v2 XML test results file into a JUnit test results file.

Note: this only handles the easiest use case for the moment, as soon as I encounter issues in real life usage I'll add extra testing scenarios.

Consume the transform

Consume JUnit.xslt through the dotnet-xunit-to-junit NuGet package

dotnet-xunit-to-junit is a .NET Core global tool:

dotnet tool install -g dotnet-xunit-to-junit
dotnet xunit-to-junit "path-to-xunit-test-results.xml" "desired-path-to-junit-test-results.xml"

Consume JUnit.xslt directly from C#

Note: For .NET Core, this requires nestandard2.0 and above.

// Required using statement
using System.Xml.Xsl;

// Change the value of these three variables
const string inputFilePath = "C:/tmp/xunit.xml";
const string outputFilePath = "C:/tmp/junit.xml";
const string xsltFilePath = "C:/tmp/JUnit.xslt";

var xlsTransform = new XslCompiledTransform();
xlsTransform.Load(xsltFilePath);

var writerSettings = xlsTransform.OutputSettings.Clone();
// Save without BOM, CircleCI can't read test results files starting with a BOM
writerSettings.Encoding = new UTF8Encoding(false);

using (var stream = new FileStream(outputFilePath, FileMode.Create, FileAccess.Write))
using (var results = XmlWriter.Create(stream, writerSettings))
{
    xlsTransform.Transform(inputFilePath, results);
}

Running locally

Install the .NET Core SDK 3.1.x.

Once you're done, run this command to initialise Cake:

.\bootstrap.ps1

You can then run the build script:

dotnet cake build.cake

If you want to pack the .NET Core Global Tool you can run: dotnet cake build.cake --pack

  • .NETCoreApp 2.2: 2.2.0.0

                        
Assembly Assembly hash Match
/tools/netcoreapp2.2/any/dotnet-xunit-to-junit.dll 1b10ebdf551e4d5784c2ecfc495d5660FFFFFFFF

Owners

Gabriel Weyer

Authors

Gabriel Weyer

Project URL

https://github.com/gabrielweyer/xunit-to-junit

License

Unknown

Tags

xUnit JUnit CircleCI

Info

1 total downloads
0 downloads for version 0.3.2-update-dotnet0003
Download (8.68 KB)
Download legacy symbols (8.69 KB)
Found on the current feed only

Package history

Version Size Last updated Downloads Mirrored?
0.3.2-update-dotnet0003 8.68 KB Thu, 03 Jan 2019 11:46:32 GMT 0
0.2.3-global-tool0001 8.7 KB Wed, 06 Jun 2018 09:07:21 GMT 1