dotnet-xunit-to-junit-preview
1.0.2
dotnet tool install --global dotnet-xunit-to-junit-preview --version 1.0.2
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest # if you are setting up this repo dotnet tool install --local dotnet-xunit-to-junit-preview --version 1.0.2
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=dotnet-xunit-to-junit-preview&version=1.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
nuke :add-package dotnet-xunit-to-junit-preview --version 1.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
xUnit.net v2 XML Format to JUnit Format
Package | Release | Pre-release |
---|---|---|
dotnet-xunit-to-junit |
CI | Status | Platform(s) | Framework(s) | Test Framework(s) |
---|---|---|---|---|
AppVeyor | Windows |
netcoreapp2.1 |
netcoreapp2.2.0 |
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);
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 2.2.102.
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
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.1 is compatible. netcoreapp2.2 is compatible. netcoreapp3.0 is compatible. netcoreapp3.1 was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
This package has no dependencies.
Version | Downloads | Last updated |
---|---|---|
1.0.2 | 914 | 4/26/2019 |