Test report files to Mochawesome and JUnit converter
npm install mochawesome-converterdotnet test report output)
junit option to true to get JUnit conversion results.
bash
npm i --save-dev mochawesome-converter
`
`js
const convert = require('mochawesome-converter');
let options = {
testFile: 'mytesfiles/nunit.xml',
testType: 'nunit',
junit: true
}
convert(options).then(() => console.log(Mochawesome report created));
`
$3
`bash
npm i -g mochawesome-converter
`
`bash
mochawesome-converter --testFile mytests/nunit.xml --testType nunit --junit true --html true
`
$3
| Option | Type | Default | Description |
|:--------------------------|:--------|:---------------------------------|:--------------------------------------------------|
| testFile (required) | string | | Path to test file for conversion |
| testType (required) | string | | Test report type |
| reportDir | string | ./report | Converted report output path |
| reportFile | string | testFile.name-mochawesome.json | Mochawesome JSON report name |
| junit | boolean | false | Create JUnit report? |
| junitReportFile | string | testFile.name-junit.xml | JUnit report file name |
| html | boolean | false | Create Mochawesome HTML? |
| htmlReportFile | string | testFile.name-mochawesome.html | Mochawesome HTML file name |
| splitByClassname | boolean | false | Split into multiple test suites by test classname |
| skippedAsPending | boolean | true | Show skipped tests as pending in Mochawesome |
| switchClassnameAndName | boolean | false | Switch test case classname and name |
- 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.
- 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.
TRX report files are always split by classname, so this option is ignored for TRX files.
- skippedAsPending - Mocha always reports skipped tests as pending and this is default behaviour of converter.
Set to false to display tests as skipped.
- switchClassnameAndName - Switches classname and name attributes of testcase if your test naming data is generated in reverse order.
#### Supported testType options.
| testType | File Type |
|:-----------|:---------------------------|
| JUnit | JUnit/xUnit XML |
| NUnit | NUnit v3+ XML |
| xUnit | xUnit.net v2+ XML |
| TRX | MSTest TRX (dotnet test`) |