diff --git a/README.md b/README.md index 10a1aae..b11c872 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,6 @@ Mochawesome is a custom test reporter originally designed for Mocha Javascript t It features a clean modern interface allowing users to easily view and navigate test runs. https://github.com/adamgruber/mochawesome - Mochawesome Report ### List of supported features @@ -75,6 +74,7 @@ https://github.com/adamgruber/mochawesome - Converts **<Output><ErrorInfo><StackTrace>** to JUnit **<failure>** stack trace. - Converts **<Output><StdErr>** to JUnit **<system-err>**. - Converts **<Output><StdOut>** to JUnit **<system-out>**. +- Tests are ordered by name in Mochawesome. - Does not resolve test suite times in JUnit output. ### Usage @@ -124,8 +124,6 @@ convert(options).then(() => console.log(`Report created: ${options.reportDir}/${ | TRX | Visual Studio TRX | - - ## Implementation and documentation in progress... diff --git a/src/junit.js b/src/junit.js index 73d46f1..dacea4e 100644 --- a/src/junit.js +++ b/src/junit.js @@ -7,9 +7,69 @@ const _ = require('lodash'); let skippedTests = 0; let failedTests = 0; - let suites = []; +/** + * @param {ConverterOptions} options + * @param {string|Buffer} xml + * @returns {TestSuites} + */ +function parseXml(options, xml){ + + let xmlParserOptions = { + object: true, + arrayNotation: true, + sanitize: false, + } + + let json; + + try{ + json = parser.toJson(xml, xmlParserOptions); + } + catch (e){ + throw `\nCould not read JSON from converted input ${options.testFile}.\n ${e.message}`; + } + + + if(!json || !json.testsuites || !json.testsuites.length){ + if(json && json.testsuite){ + json.testsuites = [{testsuite: json.testsuite}]; + delete json['testsuite']; + } + else{ + throw `\nCould not find valid or element in converted ${options.testFile}`; + } + } + + if(options.saveIntermediateFiles){ + let fileName = `${path.parse(options.testFile).name}-converted.json`; + fs.writeFileSync(path.join(options.reportDir, fileName), JSON.stringify(json, null, 2), 'utf8') + } + + if(!json.testsuites[0].testsuite){ + throw `\nNo elements in element in converted ${options.testFile}`; + } + + // sort test suites + if(json.testsuites[0].testsuite[0].file && json.testsuites[0].testsuite[0].classname){ + json.testsuites[0].testsuite = _.sortBy(json.testsuites[0].testsuite, ['file', 'classname']) + } + else if(json.testsuites[0].testsuite[0].classname){ + json.testsuites[0].testsuite = _.sortBy(json.testsuites[0].testsuite, ['classname']) + } + else{ + json.testsuites[0].testsuite.sort((a,b) => a.name - b.name); + //json.testsuites[0].testsuite = _.sortBy(json.testsuites[0].testsuite, ['name']) + } + + if(options.testType === 'trx' && json.testsuites[0].testsuite[0].testcase.length !== 0){ + json.testsuites[0].testsuite[0].testcase = _.sortBy(json.testsuites[0].testsuite[0].testcase, ['name']); + } + + return json.testsuites[0]; +} + /** * @param {TestCase} testcase * @returns {ErrorMessage|{}} @@ -26,8 +86,8 @@ function getError(testcase){ let prefix = fail.type ? `${fail.type}: ` : '' let diff = !fail.type || fail.type === 'Error' ? null : `${fail.message}`; if(fail.message || fail.$t){ - message = `${prefix}${fail.message}`; - estack = fail.$t; + message = `${prefix}${fail.message.replaceAll(' ', '').replaceAll(' ', '')}`; + estack = fail.$t.replaceAll(' ', '\n'); } else if(typeof fail === 'string'){ estack = fail; @@ -96,61 +156,6 @@ function getContext(testcase){ return context; } -/** - * @param {ConverterOptions} options - * @param {string|Buffer} xml - * @returns {TestSuites} - */ -function parseXml(options, xml){ - - let xmlParserOptions = { - object: true, - arrayNotation: true, - sanitize: false, - } - - let json; - - try{ - json = parser.toJson(xml, xmlParserOptions); - } - catch (e){ - throw `\nCould not read JSON from converted input ${options.testFile}.\n ${e.message}`; - } - - - if(!json || !json.testsuites || !json.testsuites.length){ - if(json && json.testsuite){ - json.testsuites = [{testsuite: json.testsuite}]; - delete json['testsuite']; - } - else{ - throw `\nCould not find valid or element in converted ${options.testFile}`; - } - } - - if(options.saveIntermediateFiles){ - let fileName = `${path.parse(options.testFile).name}-converted.json`; - fs.writeFileSync(path.join(options.reportDir, fileName), JSON.stringify(json, null, 2), 'utf8') - } - - if(!json.testsuites[0].testsuite){ - throw `\nNo elements in element in converted ${options.testFile}`; - } - - // sort test suites - if(json.testsuites[0].testsuite[0].file && json.testsuites[0].testsuite[0].classname){ - json.testsuites[0].testsuite = _.sortBy(json.testsuites[0].testsuite, ['file', 'classname']) - } - else if(json.testsuites[0].testsuite[0].classname){ - json.testsuites[0].testsuite = _.sortBy(json.testsuites[0].testsuite, ['classname']) - } - else{ - json.testsuites[0].testsuite = _.sortBy(json.testsuites[0].testsuite, ['name']) - } - - return json.testsuites[0]; -} /** * @param {ConverterOptions} options @@ -293,10 +298,16 @@ async function convert(options, suitesRoot){ parseTestSuites(options, testSuites, duration, avg); + let name = suitesRoot.name; + + // if(!name && suitesRoot.testsuite.length === 1){ + // name = suitesRoot.testsuite[0].name; + // } + results.push( { "uuid": crypto.randomUUID(), - "title": suitesRoot.name ?? '' , + "title": name ?? '' , "fullFile": "", "file": "", "beforeHooks": [], diff --git a/src/trx-junit.xslt b/src/trx-junit.xslt index 84b78a2..fd631f6 100644 --- a/src/trx-junit.xslt +++ b/src/trx-junit.xslt @@ -16,7 +16,6 @@ @@ -27,78 +26,90 @@ errors="{$numberOfErrors}" skipped="{$numberSkipped}"> - - - - - - - - - - - - - - . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + . + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - + + diff --git a/tests/converter.junit.test.js b/tests/converter.junit.test.js index d28c7ce..ecc2d11 100644 --- a/tests/converter.junit.test.js +++ b/tests/converter.junit.test.js @@ -7,8 +7,7 @@ const beforeAll = require('@jest/globals').beforeAll; const afterAll = require('@jest/globals').afterAll; const describe = require('@jest/globals').describe; -const margeConvert = require('../src/converter'); -const config = require('../src/config'); +const converter = require('../src/converter'); describe("JUnit converter tests", () => { @@ -57,28 +56,28 @@ describe("JUnit converter tests", () => { test('convert junit-jenkins.xml', async() => { let options = createOptions('junit-jenkins.xml', 'junit'); - await margeConvert(options); + await converter(options); compare(options); }); test('convert junit-notestsuites.xml', async() => { let options = createOptions('junit-notestsuites.xml', 'junit'); - await margeConvert(options); + await converter(options); compare(options, 'junit-jenkins-mochawesome.json'); }); test('convert junit-testsuites-noattributes.xml', async() => { let options = createOptions('junit-testsuites-noattributes.xml', 'junit'); - await margeConvert(options); + await converter(options); compare(options, 'junit-jenkins-mochawesome.json'); }); test('convert junit-mocha-xunit.xml', async() => { let options = createOptions('junit-mocha-xunit.xml', 'junit') - await margeConvert(options); + await converter(options); compare(options); }); diff --git a/tests/converter.trx.test.js b/tests/converter.trx.test.js new file mode 100644 index 0000000..b98ed8e --- /dev/null +++ b/tests/converter.trx.test.js @@ -0,0 +1,75 @@ +const path = require('path'); +const fs = require("fs"); + +const expect = require('@jest/globals').expect; +const test = require('@jest/globals').test; +const beforeAll = require('@jest/globals').beforeAll; +const afterAll = require('@jest/globals').afterAll; +const describe = require('@jest/globals').describe; + +const converter = require('../src/converter'); +const config = require('../src/config'); + +describe("TRX converter tests", () => { + + const outDir= './tests/data/tmp'; + const reportDir= './tests/data/result'; + + beforeAll(() => { + if(fs.existsSync(outDir)){ + fs.rmSync(outDir, { recursive: true, force: true }); + } + }); + + // afterAll(() => { + // if(fs.existsSync(outDir)){ + // fs.rmSync(outDir, { recursive: true, force: true }); + // } + // }); + + function getFilename(file){ + return `${path.parse(file).name}-mochawesome.json` + } + + /** + * @returns {TestReportConverterOptions} options + */ + function createOptions(file, type){ + return { + testFile: path.join(__dirname, `data/source/${file}`), + testType: type, + reportDir: outDir, + reportFilename: getFilename(file), + junit: true + } + } + + /** + * @param {TestReportConverterOptions} options + */ + async function compare(options){ + let createdReport = fs.readFileSync(path.join(outDir, options.reportFilename), 'utf8'); + let report = fs.readFileSync(path.join(reportDir, options.reportFilename), 'utf8'); + + await expect(createdReport.replaceAll(/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/g,'')).toBe(report.replaceAll(/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/g,'')); + } + + test('convert trx-mstest-datadriven.trx', async() => { + let options = createOptions('trx-mstest-datadriven.trx', 'trx') + await converter(options); + await compare(options); + }); + + test('convert trx-nunit-datadriven.trx', async() => { + let options = createOptions('trx-nunit-datadriven.trx', 'trx') + await converter(options); + await compare(options); + }); + + test('convert trx-xunit-datadriven.trx', async() => { + let options = createOptions('trx-xunit-datadriven.trx', 'trx') + await converter(options); + await compare(options); + }); + +}); \ No newline at end of file diff --git a/tests/converter.xunit.test.js b/tests/converter.xunit.test.js index 58b0aa4..78baaf7 100644 --- a/tests/converter.xunit.test.js +++ b/tests/converter.xunit.test.js @@ -6,12 +6,11 @@ const test = require('@jest/globals').test; const beforeAll = require('@jest/globals').beforeAll; const afterAll = require('@jest/globals').afterAll; const describe = require('@jest/globals').describe; -const Options = require('../'); -const margeConvert = require('../src/converter'); +const converter = require('../src/converter'); const config = require('../src/config'); -describe.skip("xUnit.net converter tests", () => { +describe("xUnit.net converter tests", () => { const outDir= './tests/data/tmp'; const reportDir= './tests/data/result'; @@ -57,13 +56,13 @@ describe.skip("xUnit.net converter tests", () => { test('convert xunit-sample.xml', async() => { let options = createOptions('xunit-sample.xml', 'xunit') - await margeConvert(options); + await converter(options); await compare(options); }); test('convert xunit-qlnet.xml', async() => { let options = createOptions('xunit-qlnet.xml', 'xunit') - await margeConvert(options); + await converter(options); await compare(options); }); diff --git a/tests/data/result/trx-mstest-datadriven-mochawesome.json b/tests/data/result/trx-mstest-datadriven-mochawesome.json new file mode 100644 index 0000000..13aaec0 --- /dev/null +++ b/tests/data/result/trx-mstest-datadriven-mochawesome.json @@ -0,0 +1,156 @@ +{ + "stats": { + "suites": 1, + "tests": 6, + "passes": 3, + "pending": 0, + "failures": 3, + "testsRegistered": 6, + "passPercent": 50, + "pendingPercent": 0, + "other": 0, + "hasOther": false, + "skipped": 0, + "hasSkipped": false, + "duration": 1035 + }, + "results": [ + { + "uuid": "8df1ebfb-24f1-40d4-b07f-b093244dbf8d", + "title": "", + "fullFile": "", + "file": "", + "beforeHooks": [], + "afterHooks": [], + "tests": [], + "suites": [ + { + "uuid": "78f30052-7c14-459d-8bb2-279fba17290b", + "title": "MSTestSuite", + "file": "", + "beforeHooks": [], + "afterHooks": [], + "tests": [ + { + "title": "Failing_test", + "fullTitle": "MsTestSample.DataDriven", + "duration": 1, + "state": "failed", + "speed": "fast", + "pass": false, + "fail": true, + "pending": false, + "context": null, + "code": null, + "err": { + "message": "Assert.Fail failed. Failing for demo purposes", + "estack": "at MsTestSample.DataDriven.Failing_test() in D:\\Work-Git\\github\\Mini\\trx2junit\\samples\\MsTestSample\\DataDriven.cs:line 25\n", + "diff": null + }, + "uuid": "ae79fd6a-4a64-4540-9266-071d0287eda3", + "parentUUID": "78f30052-7c14-459d-8bb2-279fba17290b", + "isHook": false, + "skipped": false + }, + { + "title": "Slow_test", + "fullTitle": "MsTestSample.DataDriven", + "duration": 1001, + "state": "passed", + "speed": "slow", + "pass": true, + "fail": false, + "pending": false, + "context": null, + "code": null, + "err": {}, + "uuid": "ed0b688b-a43a-4b4b-9b9e-efe7fb394b26", + "parentUUID": "78f30052-7c14-459d-8bb2-279fba17290b", + "isHook": false, + "skipped": false + }, + { + "title": "Two_pass_one_fails (0)", + "fullTitle": "MsTestSample.DataDriven", + "duration": 6, + "state": "passed", + "speed": "fast", + "pass": true, + "fail": false, + "pending": false, + "context": null, + "code": null, + "err": {}, + "uuid": "504e0602-0a51-4707-a331-a5e989bb26f7", + "parentUUID": "78f30052-7c14-459d-8bb2-279fba17290b", + "isHook": false, + "skipped": false + }, + { + "title": "Two_pass_one_fails (1)", + "fullTitle": "MsTestSample.DataDriven", + "duration": 28, + "state": "failed", + "speed": "fast", + "pass": false, + "fail": true, + "pending": false, + "context": null, + "code": null, + "err": { + "message": "Assert.Fail failed. Failing for demo purposes", + "estack": "at MsTestSample.DataDriven.Two_pass_one_fails(Int32 arg) in D:\\Work-Git\\github\\Mini\\trx2junit\\samples\\MsTestSample\\DataDriven.cs:line 16\n", + "diff": null + }, + "uuid": "12b53913-bf42-4108-b8dc-9bb7969ac7f4", + "parentUUID": "78f30052-7c14-459d-8bb2-279fba17290b", + "isHook": false, + "skipped": false + }, + { + "title": "Two_pass_one_fails (2)", + "fullTitle": "MsTestSample.DataDriven", + "duration": 1, + "state": "passed", + "speed": "fast", + "pass": true, + "fail": false, + "pending": false, + "context": null, + "code": null, + "err": {}, + "uuid": "15330716-d804-47d5-bd1f-7db8a3f55f9e", + "parentUUID": "78f30052-7c14-459d-8bb2-279fba17290b", + "isHook": false, + "skipped": false + } + ], + "suites": [], + "passes": [ + "ed0b688b-a43a-4b4b-9b9e-efe7fb394b26", + "504e0602-0a51-4707-a331-a5e989bb26f7", + "15330716-d804-47d5-bd1f-7db8a3f55f9e" + ], + "failures": [ + "ae79fd6a-4a64-4540-9266-071d0287eda3", + "12b53913-bf42-4108-b8dc-9bb7969ac7f4" + ], + "pending": [], + "skipped": [], + "duration": 0, + "root": false, + "rootEmpty": false, + "_timeout": 10000 + } + ], + "passes": [], + "failures": [], + "pending": [], + "skipped": [], + "duration": 0, + "root": true, + "rootEmpty": true, + "_timeout": 10000 + } + ] +} \ No newline at end of file diff --git a/tests/data/result/trx-nunit-datadriven-mochawesome.json b/tests/data/result/trx-nunit-datadriven-mochawesome.json new file mode 100644 index 0000000..a4603e8 --- /dev/null +++ b/tests/data/result/trx-nunit-datadriven-mochawesome.json @@ -0,0 +1,156 @@ +{ + "stats": { + "suites": 1, + "tests": 5, + "passes": 3, + "pending": 0, + "failures": 2, + "testsRegistered": 5, + "passPercent": 60, + "pendingPercent": 0, + "other": 0, + "hasOther": false, + "skipped": 0, + "hasSkipped": false, + "duration": 1062 + }, + "results": [ + { + "uuid": "91fa7be0-4873-4d99-b577-76d397a0d420", + "title": "", + "fullFile": "", + "file": "", + "beforeHooks": [], + "afterHooks": [], + "tests": [], + "suites": [ + { + "uuid": "bdd2dbaa-ce8b-4a01-b22f-32f7b6ae90f3", + "title": "MSTestSuite", + "file": "", + "beforeHooks": [], + "afterHooks": [], + "tests": [ + { + "title": "Failing_test", + "fullTitle": "NUnitSample.DataDriven", + "duration": 55, + "state": "failed", + "speed": "fast", + "pass": false, + "fail": true, + "pending": false, + "context": null, + "code": null, + "err": { + "message": "Failing for demo purposes", + "estack": "at NUnitSample.DataDriven.Failing_test() in D:\\Work-Git\\github\\Mini\\trx2junit\\samples\\NUnitSample\\DataDriven.cs:line 27\n", + "diff": null + }, + "uuid": "88afb63e-2581-4a3e-adf9-4fcdd612a147", + "parentUUID": "bdd2dbaa-ce8b-4a01-b22f-32f7b6ae90f3", + "isHook": false, + "skipped": false + }, + { + "title": "Slow_test", + "fullTitle": "NUnitSample.DataDriven", + "duration": 1002, + "state": "passed", + "speed": "slow", + "pass": true, + "fail": false, + "pending": false, + "context": null, + "code": null, + "err": {}, + "uuid": "8240857f-c233-49a8-a8c7-ace0326d31df", + "parentUUID": "bdd2dbaa-ce8b-4a01-b22f-32f7b6ae90f3", + "isHook": false, + "skipped": false + }, + { + "title": "Two_pass_one_fails(0)", + "fullTitle": "NUnitSample.DataDriven", + "duration": 1, + "state": "passed", + "speed": "fast", + "pass": true, + "fail": false, + "pending": false, + "context": null, + "code": null, + "err": {}, + "uuid": "0eebdcc0-23c8-43bb-aa34-017d688b3d6f", + "parentUUID": "bdd2dbaa-ce8b-4a01-b22f-32f7b6ae90f3", + "isHook": false, + "skipped": false + }, + { + "title": "Two_pass_one_fails(1)", + "fullTitle": "NUnitSample.DataDriven", + "duration": 3, + "state": "failed", + "speed": "fast", + "pass": false, + "fail": true, + "pending": false, + "context": null, + "code": null, + "err": { + "message": "Failing for demo purposes", + "estack": "at NUnitSample.DataDriven.Two_pass_one_fails(Int32 arg) in D:\\Work-Git\\github\\Mini\\trx2junit\\samples\\NUnitSample\\DataDriven.cs:line 18\n", + "diff": null + }, + "uuid": "7183526a-6714-4b9a-aa96-5e15dee45f59", + "parentUUID": "bdd2dbaa-ce8b-4a01-b22f-32f7b6ae90f3", + "isHook": false, + "skipped": false + }, + { + "title": "Two_pass_one_fails(2)", + "fullTitle": "NUnitSample.DataDriven", + "duration": 1, + "state": "passed", + "speed": "fast", + "pass": true, + "fail": false, + "pending": false, + "context": null, + "code": null, + "err": {}, + "uuid": "dceab918-5dbc-4d70-b4b7-145fe459bebe", + "parentUUID": "bdd2dbaa-ce8b-4a01-b22f-32f7b6ae90f3", + "isHook": false, + "skipped": false + } + ], + "suites": [], + "passes": [ + "8240857f-c233-49a8-a8c7-ace0326d31df", + "0eebdcc0-23c8-43bb-aa34-017d688b3d6f", + "dceab918-5dbc-4d70-b4b7-145fe459bebe" + ], + "failures": [ + "88afb63e-2581-4a3e-adf9-4fcdd612a147", + "7183526a-6714-4b9a-aa96-5e15dee45f59" + ], + "pending": [], + "skipped": [], + "duration": 0, + "root": false, + "rootEmpty": false, + "_timeout": 10000 + } + ], + "passes": [], + "failures": [], + "pending": [], + "skipped": [], + "duration": 0, + "root": true, + "rootEmpty": true, + "_timeout": 10000 + } + ] +} \ No newline at end of file diff --git a/tests/data/result/trx-xunit-datadriven-mochawesome.json b/tests/data/result/trx-xunit-datadriven-mochawesome.json new file mode 100644 index 0000000..be3a235 --- /dev/null +++ b/tests/data/result/trx-xunit-datadriven-mochawesome.json @@ -0,0 +1,156 @@ +{ + "stats": { + "suites": 1, + "tests": 5, + "passes": 3, + "pending": 0, + "failures": 2, + "testsRegistered": 5, + "passPercent": 60, + "pendingPercent": 0, + "other": 0, + "hasOther": false, + "skipped": 0, + "hasSkipped": false, + "duration": 1014 + }, + "results": [ + { + "uuid": "6b75b277-d367-4bbe-98dd-e92a04cc037b", + "title": "", + "fullFile": "", + "file": "", + "beforeHooks": [], + "afterHooks": [], + "tests": [], + "suites": [ + { + "uuid": "b9d62e49-d11f-4d28-908a-939a5e3b01d9", + "title": "MSTestSuite", + "file": "", + "beforeHooks": [], + "afterHooks": [], + "tests": [ + { + "title": "Failing_test", + "fullTitle": "XUnitSample.DataDriven", + "duration": 3, + "state": "failed", + "speed": "fast", + "pass": false, + "fail": true, + "pending": false, + "context": null, + "code": null, + "err": { + "message": "Failing for demo purposes Expected: True Actual: False", + "estack": "at XUnitSample.DataDriven.Failing_test() in D:\\Work-Git\\github\\Mini\\trx2junit\\samples\\XUnitSample\\DataDriven.cs:line 26", + "diff": null + }, + "uuid": "aebb04c3-be08-4004-9e54-40510cb3f156", + "parentUUID": "b9d62e49-d11f-4d28-908a-939a5e3b01d9", + "isHook": false, + "skipped": false + }, + { + "title": "Slow_test", + "fullTitle": "XUnitSample.DataDriven", + "duration": 1007, + "state": "passed", + "speed": "slow", + "pass": true, + "fail": false, + "pending": false, + "context": null, + "code": null, + "err": {}, + "uuid": "dd7c0604-57b9-426e-8c2d-49e35f9ef660", + "parentUUID": "b9d62e49-d11f-4d28-908a-939a5e3b01d9", + "isHook": false, + "skipped": false + }, + { + "title": "Two_pass_one_fails(arg: 0)", + "fullTitle": "XUnitSample.DataDriven", + "duration": 1, + "state": "passed", + "speed": "fast", + "pass": true, + "fail": false, + "pending": false, + "context": null, + "code": null, + "err": {}, + "uuid": "965bec21-b98d-4f3e-8510-ead408292800", + "parentUUID": "b9d62e49-d11f-4d28-908a-939a5e3b01d9", + "isHook": false, + "skipped": false + }, + { + "title": "Two_pass_one_fails(arg: 1)", + "fullTitle": "XUnitSample.DataDriven", + "duration": 1, + "state": "failed", + "speed": "fast", + "pass": false, + "fail": true, + "pending": false, + "context": null, + "code": null, + "err": { + "message": "Failing for demo purposes Expected: True Actual: False", + "estack": "at XUnitSample.DataDriven.Two_pass_one_fails(Int32 arg) in D:\\Work-Git\\github\\Mini\\trx2junit\\samples\\XUnitSample\\DataDriven.cs:line 17", + "diff": null + }, + "uuid": "e004d0c6-a02e-4040-a78d-01eab09246af", + "parentUUID": "b9d62e49-d11f-4d28-908a-939a5e3b01d9", + "isHook": false, + "skipped": false + }, + { + "title": "Two_pass_one_fails(arg: 2)", + "fullTitle": "XUnitSample.DataDriven", + "duration": 2, + "state": "passed", + "speed": "fast", + "pass": true, + "fail": false, + "pending": false, + "context": null, + "code": null, + "err": {}, + "uuid": "9a44c2f4-0176-4d36-918f-1b174df9e6e2", + "parentUUID": "b9d62e49-d11f-4d28-908a-939a5e3b01d9", + "isHook": false, + "skipped": false + } + ], + "suites": [], + "passes": [ + "dd7c0604-57b9-426e-8c2d-49e35f9ef660", + "965bec21-b98d-4f3e-8510-ead408292800", + "9a44c2f4-0176-4d36-918f-1b174df9e6e2" + ], + "failures": [ + "aebb04c3-be08-4004-9e54-40510cb3f156", + "e004d0c6-a02e-4040-a78d-01eab09246af" + ], + "pending": [], + "skipped": [], + "duration": 0, + "root": false, + "rootEmpty": false, + "_timeout": 10000 + } + ], + "passes": [], + "failures": [], + "pending": [], + "skipped": [], + "duration": 0, + "root": true, + "rootEmpty": true, + "_timeout": 10000 + } + ] +} \ No newline at end of file diff --git a/tests/data/result/xunit-qlnet-mochawesome.json b/tests/data/result/xunit-qlnet-mochawesome.json index 03e1edd..04eb3e4 100644 --- a/tests/data/result/xunit-qlnet-mochawesome.json +++ b/tests/data/result/xunit-qlnet-mochawesome.json @@ -2,11 +2,11 @@ "stats": { "suites": 8, "tests": 476, - "passes": 35, + "passes": 462, "pending": 13, "failures": 1, "testsRegistered": 476, - "passPercent": 95.22809123649459, + "passPercent": 97.05882352941177, "pendingPercent": 2.73109243697479, "other": 0, "hasOther": false, diff --git a/tests/data/result/xunit-sample-mochawesome.json b/tests/data/result/xunit-sample-mochawesome.json index 98b8421..aa8d926 100644 --- a/tests/data/result/xunit-sample-mochawesome.json +++ b/tests/data/result/xunit-sample-mochawesome.json @@ -2,11 +2,11 @@ "stats": { "suites": 4, "tests": 329, - "passes": 8, + "passes": 316, "pending": 0, "failures": 13, "testsRegistered": 329, - "passPercent": 38.095238095238095, + "passPercent": 96.04863221884499, "pendingPercent": 0, "other": 0, "hasOther": false, diff --git a/tests/data/source/trx-mstest-datadriven.trx b/tests/data/source/trx-mstest-datadriven.trx new file mode 100644 index 0000000..dbe7aea --- /dev/null +++ b/tests/data/source/trx-mstest-datadriven.trx @@ -0,0 +1,60 @@ + + + + + + + + + + + Assert.Fail failed. Failing for demo purposes + at MsTestSample.DataDriven.Failing_test() in D:\Work-Git\github\Mini\trx2junit\samples\MsTestSample\DataDriven.cs:line 25 + + + + + + + + + + + Assert.Fail failed. Failing for demo purposes + at MsTestSample.DataDriven.Two_pass_one_fails(Int32 arg) in D:\Work-Git\github\Mini\trx2junit\samples\MsTestSample\DataDriven.cs:line 16 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tests/data/source/trx-nunit-datadriven.trx b/tests/data/source/trx-nunit-datadriven.trx new file mode 100644 index 0000000..5ee8501 --- /dev/null +++ b/tests/data/source/trx-nunit-datadriven.trx @@ -0,0 +1,69 @@ + + + + + + + + + + + Failing for demo purposes + at NUnitSample.DataDriven.Failing_test() in D:\Work-Git\github\Mini\trx2junit\samples\NUnitSample\DataDriven.cs:line 27 + + + + + + + + + + + Failing for demo purposes + at NUnitSample.DataDriven.Two_pass_one_fails(Int32 arg) in D:\Work-Git\github\Mini\trx2junit\samples\NUnitSample\DataDriven.cs:line 18 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + NUnit Adapter 3.10.0.21: Test execution startedRunning all tests in D:\Work-Git\github\Mini\trx2junit\samples\NUnitSample\bin\Debug\netcoreapp2.1\NUnitSample.dllNUnit3TestExecutor converted 5 of 5 NUnit test casesNUnit Adapter 3.10.0.21: Test execution complete + + + \ No newline at end of file diff --git a/tests/data/source/trx-xunit-datadriven.trx b/tests/data/source/trx-xunit-datadriven.trx new file mode 100644 index 0000000..7b4f305 --- /dev/null +++ b/tests/data/source/trx-xunit-datadriven.trx @@ -0,0 +1,79 @@ + + + + + + + + + + + + + Failing for demo purposes +Expected: True +Actual: False + at XUnitSample.DataDriven.Two_pass_one_fails(Int32 arg) in D:\Work-Git\github\Mini\trx2junit\samples\XUnitSample\DataDriven.cs:line 17 + + + + + + + Failing for demo purposes +Expected: True +Actual: False + at XUnitSample.DataDriven.Failing_test() in D:\Work-Git\github\Mini\trx2junit\samples\XUnitSample\DataDriven.cs:line 26 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [xUnit.net 00:00:00.00] xUnit.net VSTest Adapter v2.4.0 (64-bit .NET Core 4.6.27317.03)[xUnit.net 00:00:00.42] Discovering: XUnitSample[xUnit.net 00:00:00.50] Discovered: XUnitSample[xUnit.net 00:00:00.51] Starting: XUnitSample[xUnit.net 00:00:01.67] Failing for demo purposes[xUnit.net 00:00:01.67] Expected: True[xUnit.net 00:00:01.67] Actual: False[xUnit.net 00:00:01.67] Stack Trace:[xUnit.net 00:00:01.67] D:\Work-Git\github\Mini\trx2junit\samples\XUnitSample\DataDriven.cs(26,0): at XUnitSample.DataDriven.Failing_test()[xUnit.net 00:00:01.67] Failing for demo purposes[xUnit.net 00:00:01.67] Expected: True[xUnit.net 00:00:01.67] Actual: False[xUnit.net 00:00:01.67] Stack Trace:[xUnit.net 00:00:01.67] D:\Work-Git\github\Mini\trx2junit\samples\XUnitSample\DataDriven.cs(17,0): at XUnitSample.DataDriven.Two_pass_one_fails(Int32 arg)[xUnit.net 00:00:01.68] Finished: XUnitSample + + + + [xUnit.net 00:00:01.67] XUnitSample.DataDriven.Failing_test [FAIL] + + + [xUnit.net 00:00:01.67] XUnitSample.DataDriven.Two_pass_one_fails(arg: 1) [FAIL] + + + +