You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
MSTest TRX Format (this is default dotnet test report output)
Conversion process
All test reports are first converted to JUnit format using XSLT.
Any nested test suites are flattened.
TRX files undergo additional processing to enhance JUnit output.
JUnit
Flattens any nested test suites.
NUnit
NUnit v3+ XML is supported.
Converts <properties> elements to JUnit <properties>.
Converts <output> elements to JUnit <system-out>.
Converts skipped test-case<reason> elements to JUnit <skipped> with message.
Converts test-case<failure> elements to JUnit <failure> with message and stack trace.
xUnit.net
xUnit.net v2+ XML is supported.
Converts <traits> elements to to JUnit <properties>.
Converts skipped test<reason> elements to JUnit <skipped> with message.
Converts test<failure> elements to JUnit <failure> with message and stack trace.
Supports single <assembly> per file, if multiple assemblies are present, only the first will be converted.
MSTest TRX
dotnet test generates TRX style files unless different logger is used.
Converts Output/ErrorInfo/ErrorInfo to JUnit <failure> with message.
Converts Output/ErrorInfo/Message to JUnit <failure> message.
Converts Output/ErrorInfo/StackTrace to JUnit <failure> stack trace.
Converts Output/StdErr to JUnit <system-err>.
Converts Output/StdOut to JUnit <system-out>.
Converts Inconclusive and NotExecuted tests to <skipped> with message.
Tests are split into multiple <testsuite> elements by test classname.
Tests are ordered by name.
Test suit times are not 100% accurate - displayed as a sum() of all test times.
Usage
npm i --save-dev junit-converter
constconverter=require('junit-converter');letoptions={testFile: 'mytesfiles/nunit.xml',testType: 'nunit'}// Convert test report to JUnit format and save to file// Set minify:true to save minified XMLconverter.toFile(options).then(()=>console.log(`JUnit report created`));// Convert test report to JUnit format and return as 'pretty' XML string// Set minify:true to returm minified XML stringconverter.toString(options).then((result)=>{/*do something with result*/});// Convert test report to JUnit format and return as JSON object for processingconverter.toJson(options).then((result)=>{/*do something with result*/});
CLI usage
npm i -g junit-converter
Convert test report to JUnit format and save to file
testFile - relative or absolute path to input test file.
testType - type of test report, not case-sensitive.
reportDir - will be created if path does not exist. Only used when saving to file.
reportFile - JUnit file name. Only used when saving to file.
splitByClassname - If true, splits test cases into multiple test suites by classname.
This is useful for test runners that generate tests under a single test suite such as dotnet test when using JUnit loggers.
Should only be set to true if test report file contains single test suite.
TRX report files are always split by classname, so this option is ignored for TRX files.