All Projects → gabrielweyer → xunit-to-junit

gabrielweyer / xunit-to-junit

Licence: MIT license
This Extensible Stylesheet Language Transformations can transform a xUnit.net v2 XML test results file into a JUnit test results file.

Programming Languages

C#
18002 projects
XSLT
1337 projects

Projects that are alternatives of or similar to xunit-to-junit

bUnit
bUnit is a testing library for Blazor components that make tests look, feel, and runs like regular unit tests. bUnit makes it easy to render and control a component under test’s life-cycle, pass parameter and inject services into it, trigger event handlers, and verify the rendered markup from the component using a built-in semantic HTML comparer.
Stars: ✭ 857 (+3980.95%)
Mutual labels:  nuget, xunit
metadatamanagement
Metadatamanagement (MDM) - Data Search for Higher Education Research and Science Studies
Stars: ✭ 21 (+0%)
Mutual labels:  junit, github-actions
action-junit-report
Reports junit test results as GitHub Pull Request Check
Stars: ✭ 103 (+390.48%)
Mutual labels:  junit, github-actions
tap-xunit
TAP to xUnit XML converter
Stars: ✭ 40 (+90.48%)
Mutual labels:  xunit, junit
Setup-Nuget
Set up your GitHub Actions workflow with the latest version of Nuget.exe CLI tool
Stars: ✭ 27 (+28.57%)
Mutual labels:  nuget, github-actions
Bats Core
Bash Automated Testing System
Stars: ✭ 2,820 (+13328.57%)
Mutual labels:  xunit, junit
test-class
Test::Class - an xUnit testing framework for Perl 5.x
Stars: ✭ 18 (-14.29%)
Mutual labels:  xunit, junit
Cake
🍰 Cake (C# Make) is a cross platform build automation system.
Stars: ✭ 3,154 (+14919.05%)
Mutual labels:  nuget, xunit
junit.testlogger
JUnit test logger for vstest platform
Stars: ✭ 61 (+190.48%)
Mutual labels:  nuget, junit
github-wiki-publish-action
GitHub Action that publishes the contents of a directory to your project's wiki
Stars: ✭ 75 (+257.14%)
Mutual labels:  github-actions
py-dependency-install
A GitHub Action that installs Python package dependencies from a user-defined requirements.txt file path with optional pip, setuptools, and wheel installs/updates
Stars: ✭ 23 (+9.52%)
Mutual labels:  github-actions
zerocode-hello-world
Zerocode YAML and JSON based declarative steps hello world rest api testing example - soap, database
Stars: ✭ 18 (-14.29%)
Mutual labels:  junit
18-comic-finder
禁漫天堂Github Actions下载器🧘
Stars: ✭ 264 (+1157.14%)
Mutual labels:  github-actions
post-medium-action
This action is for posting markdown based posts to medium
Stars: ✭ 45 (+114.29%)
Mutual labels:  github-actions
juejin-actions
掘金每天自动签到 github actions 。组织了每周一起学习200行左右的【源码共读】活动,感兴趣可以加我微信 ruochuan12 参与。
Stars: ✭ 47 (+123.81%)
Mutual labels:  github-actions
SilkierQuartz
SilkierQuartz can host jobs using HostService and Provide a web management tools for Quartz !
Stars: ✭ 263 (+1152.38%)
Mutual labels:  nuget
WatsonCluster
A simple C# class using Watson TCP to enable a one-to-one high availability cluster.
Stars: ✭ 18 (-14.29%)
Mutual labels:  nuget
Learn-to-Code
Learn to Code - for Free
Stars: ✭ 15 (-28.57%)
Mutual labels:  junit
springboot-rest-api-angularjs-https
REST API https with Spring Boot and Angular JS. Use MySQL, Hibernate and Spring Security.
Stars: ✭ 38 (+80.95%)
Mutual labels:  junit
action-setup-kube-tools
Github Action that setup Kubernetes tools (kubectl, kustomize, helm, kubeconform, conftest, yq, rancher, tilt, skaffold) very fast and cache them on the runner. Please [✩Star] if you're using it!
Stars: ✭ 45 (+114.29%)
Mutual labels:  github-actions

xUnit.net v2 XML Format to JUnit Format

🚨 If you're using this tool to process test results file(s) after having run dotnet test, I recommend using the JUnit Test Logger instead. The output is better (at least in CircleCI). If you can't install an additional NuGet package in your test project(s), can't modify your build or are processing test results file(s) that have previously been generated, please read on.

Package Release
dotnet-xunit-to-junit NuGet
CI Status Platform(s) Framework(s) Test Framework(s)
GitHub Build Status Ubuntu netcoreapp3.1, net5.0, net6.0 netcoreapp3.1, net5.0, net6.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 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);
}

Building locally

Run this command to build on Windows:

.\build.ps1

Run this command to build on Linux / macOS:

./build.sh

If you want to pack the .NET Global Tool, you can run .\build.ps1 --package.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].