From 953e623fd82f07b92539887b1966588ce3a90134 Mon Sep 17 00:00:00 2001 From: Kevin Ring Date: Thu, 19 Jan 2023 12:37:16 +1100 Subject: [PATCH] Report times in milliseconds. --- __tests__/__outputs__/dotnet-nunit.md | 4 ++-- .../__snapshots__/dotnet-nunit.test.ts.snap | 20 +++++++++---------- .../dotnet-nunit/dotnet-nunit-parser.ts | 4 ++-- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/__tests__/__outputs__/dotnet-nunit.md b/__tests__/__outputs__/dotnet-nunit.md index 5b1d9c7..904e7d2 100644 --- a/__tests__/__outputs__/dotnet-nunit.md +++ b/__tests__/__outputs__/dotnet-nunit.md @@ -1,9 +1,9 @@ ![Tests failed](https://img.shields.io/badge/tests-3%20passed%2C%205%20failed%2C%201%20skipped-critical) ## ❌ fixtures/dotnet-nunit.xml -**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| |:---|---:|---:|---:|---:| -|[DotnetTests.NUnitV3Tests.dll.DotnetTests.XUnitTests](#r0s0)|3✅|5❌|1⚪|0ms| +|[DotnetTests.NUnitV3Tests.dll.DotnetTests.XUnitTests](#r0s0)|3✅|5❌|1⚪|69ms| ### ❌ DotnetTests.NUnitV3Tests.dll.DotnetTests.XUnitTests ``` CalculatorTests diff --git a/__tests__/__snapshots__/dotnet-nunit.test.ts.snap b/__tests__/__snapshots__/dotnet-nunit.test.ts.snap index 203fcc4..3e2bb41 100644 --- a/__tests__/__snapshots__/dotnet-nunit.test.ts.snap +++ b/__tests__/__snapshots__/dotnet-nunit.test.ts.snap @@ -13,7 +13,7 @@ TestRunResult { "error": undefined, "name": "Is_Even_Number(2)", "result": "success", - "time": 0.000622, + "time": 0.622, }, TestCaseResult { "error": Object { @@ -27,7 +27,7 @@ TestRunResult { }, "name": "Is_Even_Number(3)", "result": "failed", - "time": 0.001098, + "time": 1.098, }, TestCaseResult { "error": Object { @@ -39,7 +39,7 @@ TestRunResult { }, "name": "Exception_In_TargetTest", "result": "failed", - "time": 0.022805, + "time": 22.805, }, TestCaseResult { "error": Object { @@ -50,7 +50,7 @@ TestRunResult { }, "name": "Exception_In_Test", "result": "failed", - "time": 0.000528, + "time": 0.528, }, TestCaseResult { "error": Object { @@ -64,25 +64,25 @@ TestRunResult { }, "name": "Failing_Test", "result": "failed", - "time": 0.028162, + "time": 28.162, }, TestCaseResult { "error": undefined, "name": "Passing_Test", "result": "success", - "time": 0.000238, + "time": 0.23800000000000002, }, TestCaseResult { "error": undefined, "name": "Passing_Test_With_Description", "result": "success", - "time": 0.000135, + "time": 0.135, }, TestCaseResult { "error": undefined, "name": "Skipped_Test", "result": "skipped", - "time": 0.000398, + "time": 0.398, }, TestCaseResult { "error": Object { @@ -93,7 +93,7 @@ TestRunResult { }, "name": "Timeout_Test", "result": "failed", - "time": 0.014949, + "time": 14.949, }, ], }, @@ -102,6 +102,6 @@ TestRunResult { "totalTime": undefined, }, ], - "totalTime": 0.230308, + "totalTime": 230.30800000000002, } `; diff --git a/src/parsers/dotnet-nunit/dotnet-nunit-parser.ts b/src/parsers/dotnet-nunit/dotnet-nunit-parser.ts index d4a5791..73a0438 100644 --- a/src/parsers/dotnet-nunit/dotnet-nunit-parser.ts +++ b/src/parsers/dotnet-nunit/dotnet-nunit-parser.ts @@ -34,7 +34,7 @@ export class DotNetNunitParser implements TestParser { private getTestRunResult(path: string, nunit: NunitReport): TestRunResult { 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']) @@ -93,7 +93,7 @@ export class DotNetNunitParser implements TestParser { new TestCaseResult( testCase.$.name, this.getTestExecutionResult(testCase), - parseFloat(testCase.$.duration), + parseFloat(testCase.$.duration) * 1000, this.getTestCaseError(testCase) ) )