Report times in milliseconds.

This commit is contained in:
Kevin Ring 2023-01-19 12:37:16 +11:00 committed by Jozef Izso
parent 49c1f3ae6c
commit 953e623fd8
3 changed files with 14 additions and 14 deletions

View file

@ -1,9 +1,9 @@
![Tests failed](https://img.shields.io/badge/tests-3%20passed%2C%205%20failed%2C%201%20skipped-critical) ![Tests failed](https://img.shields.io/badge/tests-3%20passed%2C%205%20failed%2C%201%20skipped-critical)
## ❌ <a id="user-content-r0" href="#r0">fixtures/dotnet-nunit.xml</a> ## ❌ <a id="user-content-r0" href="#r0">fixtures/dotnet-nunit.xml</a>
**9** tests were completed in **0ms** with **3** passed, **5** failed and **1** skipped. **9** tests were completed in **230ms** with **3** passed, **5** failed and **1** skipped.
|Test suite|Passed|Failed|Skipped|Time| |Test suite|Passed|Failed|Skipped|Time|
|:---|---:|---:|---:|---:| |:---|---:|---:|---:|---:|
|[DotnetTests.NUnitV3Tests.dll.DotnetTests.XUnitTests](#r0s0)|3✅|5❌|1⚪|0ms| |[DotnetTests.NUnitV3Tests.dll.DotnetTests.XUnitTests](#r0s0)|3✅|5❌|1⚪|69ms|
### ❌ <a id="user-content-r0s0" href="#r0s0">DotnetTests.NUnitV3Tests.dll.DotnetTests.XUnitTests</a> ### ❌ <a id="user-content-r0s0" href="#r0s0">DotnetTests.NUnitV3Tests.dll.DotnetTests.XUnitTests</a>
``` ```
CalculatorTests CalculatorTests

View file

@ -13,7 +13,7 @@ TestRunResult {
"error": undefined, "error": undefined,
"name": "Is_Even_Number(2)", "name": "Is_Even_Number(2)",
"result": "success", "result": "success",
"time": 0.000622, "time": 0.622,
}, },
TestCaseResult { TestCaseResult {
"error": Object { "error": Object {
@ -27,7 +27,7 @@ TestRunResult {
}, },
"name": "Is_Even_Number(3)", "name": "Is_Even_Number(3)",
"result": "failed", "result": "failed",
"time": 0.001098, "time": 1.098,
}, },
TestCaseResult { TestCaseResult {
"error": Object { "error": Object {
@ -39,7 +39,7 @@ TestRunResult {
}, },
"name": "Exception_In_TargetTest", "name": "Exception_In_TargetTest",
"result": "failed", "result": "failed",
"time": 0.022805, "time": 22.805,
}, },
TestCaseResult { TestCaseResult {
"error": Object { "error": Object {
@ -50,7 +50,7 @@ TestRunResult {
}, },
"name": "Exception_In_Test", "name": "Exception_In_Test",
"result": "failed", "result": "failed",
"time": 0.000528, "time": 0.528,
}, },
TestCaseResult { TestCaseResult {
"error": Object { "error": Object {
@ -64,25 +64,25 @@ TestRunResult {
}, },
"name": "Failing_Test", "name": "Failing_Test",
"result": "failed", "result": "failed",
"time": 0.028162, "time": 28.162,
}, },
TestCaseResult { TestCaseResult {
"error": undefined, "error": undefined,
"name": "Passing_Test", "name": "Passing_Test",
"result": "success", "result": "success",
"time": 0.000238, "time": 0.23800000000000002,
}, },
TestCaseResult { TestCaseResult {
"error": undefined, "error": undefined,
"name": "Passing_Test_With_Description", "name": "Passing_Test_With_Description",
"result": "success", "result": "success",
"time": 0.000135, "time": 0.135,
}, },
TestCaseResult { TestCaseResult {
"error": undefined, "error": undefined,
"name": "Skipped_Test", "name": "Skipped_Test",
"result": "skipped", "result": "skipped",
"time": 0.000398, "time": 0.398,
}, },
TestCaseResult { TestCaseResult {
"error": Object { "error": Object {
@ -93,7 +93,7 @@ TestRunResult {
}, },
"name": "Timeout_Test", "name": "Timeout_Test",
"result": "failed", "result": "failed",
"time": 0.014949, "time": 14.949,
}, },
], ],
}, },
@ -102,6 +102,6 @@ TestRunResult {
"totalTime": undefined, "totalTime": undefined,
}, },
], ],
"totalTime": 0.230308, "totalTime": 230.30800000000002,
} }
`; `;

View file

@ -34,7 +34,7 @@ export class DotNetNunitParser implements TestParser {
private getTestRunResult(path: string, nunit: NunitReport): TestRunResult { private getTestRunResult(path: string, nunit: NunitReport): TestRunResult {
const suites: TestSuiteResult[] = [] const suites: TestSuiteResult[] = []
const time = parseFloat(nunit['test-run'].$.duration) const time = parseFloat(nunit['test-run'].$.duration) * 1000
this.populateTestCasesRecursive(suites, [], nunit['test-run']['test-suite']) this.populateTestCasesRecursive(suites, [], nunit['test-run']['test-suite'])
@ -93,7 +93,7 @@ export class DotNetNunitParser implements TestParser {
new TestCaseResult( new TestCaseResult(
testCase.$.name, testCase.$.name,
this.getTestExecutionResult(testCase), this.getTestExecutionResult(testCase),
parseFloat(testCase.$.duration), parseFloat(testCase.$.duration) * 1000,
this.getTestCaseError(testCase) this.getTestCaseError(testCase)
) )
) )