diff --git a/__tests__/__outputs__/dotnet-nunit-legacy.md b/__tests__/__outputs__/dotnet-nunit-legacy.md
index d14a103..5fcfddc 100644
--- a/__tests__/__outputs__/dotnet-nunit-legacy.md
+++ b/__tests__/__outputs__/dotnet-nunit-legacy.md
@@ -1,12 +1,12 @@

|Report|Passed|Failed|Skipped|Time|
|:---|---:|---:|---:|---:|
-|fixtures/dotnet-nunit-legacy.xml|3 ✅|5 ❌|2 ⚪|9ms|
+|fixtures/dotnet-nunit-legacy.xml|3 ✅|5 ❌|2 ⚪|73ms|
## ❌ fixtures/dotnet-nunit-legacy.xml
-**10** tests were completed in **9ms** with **3** passed, **5** failed and **2** skipped.
+**10** tests were completed in **73ms** with **3** passed, **5** failed and **2** skipped.
|Test suite|Passed|Failed|Skipped|Time|
|:---|---:|---:|---:|---:|
-|[NUnitLegacyTests.CalculatorTests](#r0s0)|3 ✅|5 ❌|2 ⚪|NaNms|
+|[NUnitLegacyTests.CalculatorTests](#r0s0)|3 ✅|5 ❌|2 ⚪|73ms|
### ❌ NUnitLegacyTests.CalculatorTests
```
CalculatorTests
diff --git a/__tests__/__snapshots__/dotnet-nunit-legacy.test.ts.snap b/__tests__/__snapshots__/dotnet-nunit-legacy.test.ts.snap
index e66521d..b7c1d64 100644
--- a/__tests__/__snapshots__/dotnet-nunit-legacy.test.ts.snap
+++ b/__tests__/__snapshots__/dotnet-nunit-legacy.test.ts.snap
@@ -13,7 +13,7 @@ TestRunResult {
"error": undefined,
"name": "Is_Even_Number(2)",
"result": "success",
- "time": 0.001,
+ "time": 1,
},
TestCaseResult {
"error": {
@@ -27,7 +27,7 @@ TestRunResult {
},
"name": "Is_Even_Number(3)",
"result": "failed",
- "time": 0.001,
+ "time": 1,
},
TestCaseResult {
"error": {
@@ -40,7 +40,7 @@ at NUnitLegacyTests.CalculatorTests.Exception_In_TargetTest() in C:\\Users\\jame
},
"name": "Exception_In_TargetTest",
"result": "failed",
- "time": 0.026,
+ "time": 26,
},
TestCaseResult {
"error": {
@@ -52,7 +52,7 @@ at NUnitLegacyTests.CalculatorTests.Exception_In_TargetTest() in C:\\Users\\jame
},
"name": "Exception_In_Test",
"result": "failed",
- "time": 0.002,
+ "time": 2,
},
TestCaseResult {
"error": {
@@ -66,7 +66,7 @@ at NUnitLegacyTests.CalculatorTests.Exception_In_TargetTest() in C:\\Users\\jame
},
"name": "Failing_Test",
"result": "failed",
- "time": 0.014,
+ "time": 14,
},
TestCaseResult {
"error": {
@@ -77,7 +77,7 @@ at NUnitLegacyTests.CalculatorTests.Exception_In_TargetTest() in C:\\Users\\jame
},
"name": "Inconclusive_Test",
"result": "skipped",
- "time": 0.001,
+ "time": 1,
},
TestCaseResult {
"error": undefined,
@@ -100,7 +100,7 @@ at NUnitLegacyTests.CalculatorTests.Exception_In_TargetTest() in C:\\Users\\jame
},
"name": "Skipped_Test",
"result": "skipped",
- "time": NaN,
+ "time": 0,
},
TestCaseResult {
"error": {
@@ -111,7 +111,7 @@ at NUnitLegacyTests.CalculatorTests.Exception_In_TargetTest() in C:\\Users\\jame
},
"name": "Timeout_Test",
"result": "failed",
- "time": 0.028,
+ "time": 28,
},
],
},
@@ -120,6 +120,6 @@ at NUnitLegacyTests.CalculatorTests.Exception_In_TargetTest() in C:\\Users\\jame
"totalTime": undefined,
},
],
- "totalTime": 9,
+ "totalTime": undefined,
}
`;
diff --git a/dist/index.js b/dist/index.js
index c3e9e8b..3808900 100644
--- a/dist/index.js
+++ b/dist/index.js
@@ -759,9 +759,8 @@ class DotnetNunitLegacyParser {
}
getTestRunResult(path, nunit) {
const suites = [];
- const time = parseFloat(nunit['test-results'].$.time);
this.populateTestCasesRecursive(suites, [], nunit['test-results']['test-suite']);
- return new test_results_1.TestRunResult(path, suites, time);
+ return new test_results_1.TestRunResult(path, suites);
}
populateTestCasesRecursive(result, suitePath, testSuites) {
if (testSuites === undefined) {
@@ -803,7 +802,7 @@ class DotnetNunitLegacyParser {
existingGroup = new test_results_1.TestGroupResult(groupName, []);
existingSuite.groups.push(existingGroup);
}
- existingGroup.tests.push(new test_results_1.TestCaseResult(testCase.$.name.startsWith(suiteName + '.') ? testCase.$.name.substring(suiteName.length + 1) : testCase.$.name, this.getTestExecutionResult(testCase), parseFloat(testCase.$.time), this.getTestCaseError(testCase)));
+ existingGroup.tests.push(new test_results_1.TestCaseResult(testCase.$.name.startsWith(suiteName + '.') ? testCase.$.name.substring(suiteName.length + 1) : testCase.$.name, this.getTestExecutionResult(testCase), testCase.$.time ? parseFloat(testCase.$.time) * 1000 : 0, this.getTestCaseError(testCase)));
}
getTestExecutionResult(test) {
if (test.$.result === 'Failed' || test.failure)
diff --git a/src/parsers/dotnet-nunit-legacy/dotnet-nunit-legacy-parser.ts b/src/parsers/dotnet-nunit-legacy/dotnet-nunit-legacy-parser.ts
index c62ee1a..147f4d2 100644
--- a/src/parsers/dotnet-nunit-legacy/dotnet-nunit-legacy-parser.ts
+++ b/src/parsers/dotnet-nunit-legacy/dotnet-nunit-legacy-parser.ts
@@ -34,11 +34,10 @@ export class DotnetNunitLegacyParser implements TestParser {
private getTestRunResult(path: string, nunit: NunitReport): TestRunResult {
const suites: TestSuiteResult[] = []
- const time = parseFloat(nunit['test-results'].$.time)
this.populateTestCasesRecursive(suites, [], nunit['test-results']['test-suite'])
- return new TestRunResult(path, suites, time)
+ return new TestRunResult(path, suites)
}
private populateTestCasesRecursive(
@@ -99,7 +98,7 @@ export class DotnetNunitLegacyParser implements TestParser {
new TestCaseResult(
testCase.$.name.startsWith(suiteName + '.') ? testCase.$.name.substring(suiteName.length + 1) : testCase.$.name,
this.getTestExecutionResult(testCase),
- parseFloat(testCase.$.time),
+ testCase.$.time ? parseFloat(testCase.$.time) * 1000 : 0,
this.getTestCaseError(testCase)
)
)
diff --git a/src/parsers/dotnet-nunit-legacy/dotnet-nunit-legacy-types.ts b/src/parsers/dotnet-nunit-legacy/dotnet-nunit-legacy-types.ts
index 254c8b9..2ae10d3 100644
--- a/src/parsers/dotnet-nunit-legacy/dotnet-nunit-legacy-types.ts
+++ b/src/parsers/dotnet-nunit-legacy/dotnet-nunit-legacy-types.ts
@@ -4,7 +4,8 @@ export interface NunitReport {
export interface TestResults {
$: {
- time: string
+ // there is a time attribute here, but it is the time of day the test ran, not the duration
+ // time: string
}
'test-suite'?: TestSuite[]
}
@@ -26,7 +27,7 @@ export interface TestCase {
$: {
name: string
result: string
- time: string
+ time?: string
}
failure?: TestFailure[]
reason?: TestFailure[]