mirror of
https://github.com/dorny/test-reporter.git
synced 2025-12-17 06:47:09 +01:00
Fixed so every test isnt in a seperate group, but its per suite.
This commit is contained in:
parent
a97564ca53
commit
b44d5ae60b
5 changed files with 36 additions and 129 deletions
|
|
@ -16,57 +16,45 @@
|
|||
|[ MockTestFixture](#r0s10)|1✔️|||NaNms|
|
||||
### ❌ <a id="user-content-r0s1" href="#r0s1">MockTestFixture</a>
|
||||
```
|
||||
FailingTest
|
||||
MockTestFixture
|
||||
❌ FailingTest
|
||||
Intentional failure
|
||||
InconclusiveTest
|
||||
✔️ InconclusiveTest
|
||||
MockTest1
|
||||
✔️ MockTest1
|
||||
MockTest2
|
||||
✔️ MockTest2
|
||||
MockTest3
|
||||
✔️ MockTest3
|
||||
MockTest4
|
||||
✖️ MockTest4
|
||||
MockTest5
|
||||
✖️ MockTest5
|
||||
NotRunnableTest
|
||||
✖️ NotRunnableTest
|
||||
TestWithException
|
||||
❌ TestWithException
|
||||
System.ApplicationException : Intentional Exception
|
||||
TestWithManyProperties
|
||||
✔️ TestWithManyProperties
|
||||
```
|
||||
### ✔️ <a id="user-content-r0s4" href="#r0s4">MethodWithParameters</a>
|
||||
```
|
||||
MethodWithParameters(2,2)
|
||||
MethodWithParameters
|
||||
✔️ MethodWithParameters(2,2)
|
||||
MethodWithParameters(9,11)
|
||||
✔️ MethodWithParameters(9,11)
|
||||
```
|
||||
### ✔️ <a id="user-content-r0s7" href="#r0s7">ParameterizedFixture(42)</a>
|
||||
```
|
||||
Test1
|
||||
ParameterizedFixture(42)
|
||||
✔️ Test1
|
||||
Test2
|
||||
✔️ Test2
|
||||
```
|
||||
### ✔️ <a id="user-content-r0s8" href="#r0s8">ParameterizedFixture(5)</a>
|
||||
```
|
||||
Test1
|
||||
ParameterizedFixture(5)
|
||||
✔️ Test1
|
||||
Test2
|
||||
✔️ Test2
|
||||
```
|
||||
### ✔️ <a id="user-content-r0s9" href="#r0s9">OneTestCase</a>
|
||||
```
|
||||
TestCase
|
||||
OneTestCase
|
||||
✔️ TestCase
|
||||
```
|
||||
### ✔️ <a id="user-content-r0s10" href="#r0s10">MockTestFixture</a>
|
||||
```
|
||||
MyTest
|
||||
MockTestFixture
|
||||
✔️ MyTest
|
||||
```
|
||||
|
|
@ -13,7 +13,7 @@ TestRunResult {
|
|||
TestSuiteResult {
|
||||
"groups": Array [
|
||||
TestGroupResult {
|
||||
"name": "FailingTest",
|
||||
"name": "MockTestFixture",
|
||||
"tests": Array [
|
||||
TestCaseResult {
|
||||
"error": Object {
|
||||
|
|
@ -28,88 +28,48 @@ TestRunResult {
|
|||
"result": "failed",
|
||||
"time": 23,
|
||||
},
|
||||
],
|
||||
},
|
||||
TestGroupResult {
|
||||
"name": "InconclusiveTest",
|
||||
"tests": Array [
|
||||
TestCaseResult {
|
||||
"error": undefined,
|
||||
"name": "InconclusiveTest",
|
||||
"result": "success",
|
||||
"time": 1,
|
||||
},
|
||||
],
|
||||
},
|
||||
TestGroupResult {
|
||||
"name": "MockTest1",
|
||||
"tests": Array [
|
||||
TestCaseResult {
|
||||
"error": undefined,
|
||||
"name": "MockTest1",
|
||||
"result": "success",
|
||||
"time": 0,
|
||||
},
|
||||
],
|
||||
},
|
||||
TestGroupResult {
|
||||
"name": "MockTest2",
|
||||
"tests": Array [
|
||||
TestCaseResult {
|
||||
"error": undefined,
|
||||
"name": "MockTest2",
|
||||
"result": "success",
|
||||
"time": 0,
|
||||
},
|
||||
],
|
||||
},
|
||||
TestGroupResult {
|
||||
"name": "MockTest3",
|
||||
"tests": Array [
|
||||
TestCaseResult {
|
||||
"error": undefined,
|
||||
"name": "MockTest3",
|
||||
"result": "success",
|
||||
"time": 0,
|
||||
},
|
||||
],
|
||||
},
|
||||
TestGroupResult {
|
||||
"name": "MockTest4",
|
||||
"tests": Array [
|
||||
TestCaseResult {
|
||||
"error": undefined,
|
||||
"name": "MockTest4",
|
||||
"result": "skipped",
|
||||
"time": 0,
|
||||
},
|
||||
],
|
||||
},
|
||||
TestGroupResult {
|
||||
"name": "MockTest5",
|
||||
"tests": Array [
|
||||
TestCaseResult {
|
||||
"error": undefined,
|
||||
"name": "MockTest5",
|
||||
"result": "skipped",
|
||||
"time": 0,
|
||||
},
|
||||
],
|
||||
},
|
||||
TestGroupResult {
|
||||
"name": "NotRunnableTest",
|
||||
"tests": Array [
|
||||
TestCaseResult {
|
||||
"error": undefined,
|
||||
"name": "NotRunnableTest",
|
||||
"result": "skipped",
|
||||
"time": 0,
|
||||
},
|
||||
],
|
||||
},
|
||||
TestGroupResult {
|
||||
"name": "TestWithException",
|
||||
"tests": Array [
|
||||
TestCaseResult {
|
||||
"error": Object {
|
||||
"details": " at NUnit.Tests.Assemblies.MockTestFixture.MethodThrowsException() in D:\\\\Dev\\\\NUnit\\\\nunit-3.0\\\\work\\\\NUnitFramework\\\\src\\\\mock-assembly\\\\MockAssembly.cs:line 158
|
||||
|
|
@ -122,11 +82,6 @@ TestRunResult {
|
|||
"result": "failed",
|
||||
"time": 2,
|
||||
},
|
||||
],
|
||||
},
|
||||
TestGroupResult {
|
||||
"name": "TestWithManyProperties",
|
||||
"tests": Array [
|
||||
TestCaseResult {
|
||||
"error": undefined,
|
||||
"name": "TestWithManyProperties",
|
||||
|
|
@ -155,7 +110,7 @@ TestRunResult {
|
|||
TestSuiteResult {
|
||||
"groups": Array [
|
||||
TestGroupResult {
|
||||
"name": "MethodWithParameters(2,2)",
|
||||
"name": "MethodWithParameters",
|
||||
"tests": Array [
|
||||
TestCaseResult {
|
||||
"error": undefined,
|
||||
|
|
@ -163,11 +118,6 @@ TestRunResult {
|
|||
"result": "success",
|
||||
"time": 6,
|
||||
},
|
||||
],
|
||||
},
|
||||
TestGroupResult {
|
||||
"name": "MethodWithParameters(9,11)",
|
||||
"tests": Array [
|
||||
TestCaseResult {
|
||||
"error": undefined,
|
||||
"name": "MethodWithParameters(9,11)",
|
||||
|
|
@ -196,7 +146,7 @@ TestRunResult {
|
|||
TestSuiteResult {
|
||||
"groups": Array [
|
||||
TestGroupResult {
|
||||
"name": "Test1",
|
||||
"name": "ParameterizedFixture(42)",
|
||||
"tests": Array [
|
||||
TestCaseResult {
|
||||
"error": undefined,
|
||||
|
|
@ -204,11 +154,6 @@ TestRunResult {
|
|||
"result": "success",
|
||||
"time": 0,
|
||||
},
|
||||
],
|
||||
},
|
||||
TestGroupResult {
|
||||
"name": "Test2",
|
||||
"tests": Array [
|
||||
TestCaseResult {
|
||||
"error": undefined,
|
||||
"name": "Test2",
|
||||
|
|
@ -225,7 +170,7 @@ TestRunResult {
|
|||
TestSuiteResult {
|
||||
"groups": Array [
|
||||
TestGroupResult {
|
||||
"name": "Test1",
|
||||
"name": "ParameterizedFixture(5)",
|
||||
"tests": Array [
|
||||
TestCaseResult {
|
||||
"error": undefined,
|
||||
|
|
@ -233,11 +178,6 @@ TestRunResult {
|
|||
"result": "success",
|
||||
"time": 0,
|
||||
},
|
||||
],
|
||||
},
|
||||
TestGroupResult {
|
||||
"name": "Test2",
|
||||
"tests": Array [
|
||||
TestCaseResult {
|
||||
"error": undefined,
|
||||
"name": "Test2",
|
||||
|
|
@ -254,7 +194,7 @@ TestRunResult {
|
|||
TestSuiteResult {
|
||||
"groups": Array [
|
||||
TestGroupResult {
|
||||
"name": "TestCase",
|
||||
"name": "OneTestCase",
|
||||
"tests": Array [
|
||||
TestCaseResult {
|
||||
"error": undefined,
|
||||
|
|
@ -272,7 +212,7 @@ TestRunResult {
|
|||
TestSuiteResult {
|
||||
"groups": Array [
|
||||
TestGroupResult {
|
||||
"name": "MyTest",
|
||||
"name": "MockTestFixture",
|
||||
"tests": Array [
|
||||
TestCaseResult {
|
||||
"error": undefined,
|
||||
|
|
|
|||
23
dist/index.js
generated
vendored
23
dist/index.js
generated
vendored
|
|
@ -784,10 +784,10 @@ class DotnetNunitParser {
|
|||
testSuites.map(ts => {
|
||||
const name = ts.$.name.trim();
|
||||
const time = parseFloat(ts.$.duration) * 1000;
|
||||
const groups = this.getGroups(ts);
|
||||
const sr = new test_results_1.TestSuiteResult(name, groups, time, depth);
|
||||
const group = this.getGroup(ts);
|
||||
const sr = new test_results_1.TestSuiteResult(name, group, time, depth);
|
||||
suiteResults.push(sr);
|
||||
if (groups.length === 0) {
|
||||
if (group.length === 0) {
|
||||
const nestedTestSuites = ts['test-suite'];
|
||||
if (nestedTestSuites !== undefined) {
|
||||
this.getTestSuiteResultRecursive(nestedTestSuites, suiteResults, depth + 1);
|
||||
|
|
@ -805,29 +805,18 @@ class DotnetNunitParser {
|
|||
const time = isNaN(seconds) ? undefined : seconds * 1000;
|
||||
return new test_results_1.TestRunResult(filePath, suites, time);
|
||||
}
|
||||
getGroups(suite) {
|
||||
const groups = [];
|
||||
getGroup(suite) {
|
||||
if (suite['test-case'] === undefined) {
|
||||
return [];
|
||||
}
|
||||
for (const tc of suite['test-case']) {
|
||||
let grp = groups.find(g => g.describe === tc.$.name);
|
||||
if (grp === undefined) {
|
||||
grp = { describe: tc.$.name, tests: [] };
|
||||
groups.push(grp);
|
||||
}
|
||||
grp.tests.push(tc);
|
||||
}
|
||||
return groups.map(grp => {
|
||||
const tests = grp.tests.map(tc => {
|
||||
const tests = suite['test-case'].map(tc => {
|
||||
const name = tc.$.name.trim();
|
||||
const result = this.getTestCaseResult(tc);
|
||||
const time = parseFloat(tc.$.time) * 1000;
|
||||
const error = this.getTestCaseError(tc);
|
||||
return new test_results_1.TestCaseResult(name, result, time, error);
|
||||
});
|
||||
return new test_results_1.TestGroupResult(grp.describe, tests);
|
||||
});
|
||||
return [new test_results_1.TestGroupResult(suite.$.name, tests)];
|
||||
}
|
||||
getTestCaseResult(test) {
|
||||
if (test.failure)
|
||||
|
|
|
|||
2
dist/index.js.map
generated
vendored
2
dist/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
|
|
@ -48,11 +48,11 @@ export class DotnetNunitParser implements TestParser {
|
|||
testSuites.map(ts => {
|
||||
const name = ts.$.name.trim()
|
||||
const time = parseFloat(ts.$.duration) * 1000
|
||||
const groups = this.getGroups(ts)
|
||||
const sr = new TestSuiteResult(name, groups, time, depth)
|
||||
const group = this.getGroup(ts)
|
||||
const sr = new TestSuiteResult(name, group, time, depth)
|
||||
suiteResults.push(sr)
|
||||
|
||||
if (groups.length === 0) {
|
||||
if (group.length === 0) {
|
||||
const nestedTestSuites = ts['test-suite']
|
||||
if (nestedTestSuites !== undefined) {
|
||||
this.getTestSuiteResultRecursive(nestedTestSuites, suiteResults, depth + 1)
|
||||
|
|
@ -73,30 +73,20 @@ export class DotnetNunitParser implements TestParser {
|
|||
return new TestRunResult(filePath, suites, time)
|
||||
}
|
||||
|
||||
private getGroups(suite: TestSuite): TestGroupResult[] {
|
||||
const groups: {describe: string; tests: TestCase[]}[] = []
|
||||
private getGroup(suite: TestSuite): TestGroupResult[] {
|
||||
if (suite['test-case'] === undefined) {
|
||||
return []
|
||||
}
|
||||
for (const tc of suite['test-case']) {
|
||||
let grp = groups.find(g => g.describe === tc.$.name)
|
||||
if (grp === undefined) {
|
||||
grp = {describe: tc.$.name, tests: []}
|
||||
groups.push(grp)
|
||||
}
|
||||
grp.tests.push(tc)
|
||||
}
|
||||
|
||||
return groups.map(grp => {
|
||||
const tests = grp.tests.map(tc => {
|
||||
const tests = suite['test-case'].map(tc => {
|
||||
const name = tc.$.name.trim()
|
||||
const result = this.getTestCaseResult(tc)
|
||||
const time = parseFloat(tc.$.time) * 1000
|
||||
const error = this.getTestCaseError(tc)
|
||||
return new TestCaseResult(name, result, time, error)
|
||||
})
|
||||
return new TestGroupResult(grp.describe, tests)
|
||||
})
|
||||
|
||||
return [new TestGroupResult(suite.$.name, tests)]
|
||||
}
|
||||
|
||||
private getTestCaseResult(test: TestCase): TestExecutionResult {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue