mirror of
https://github.com/dorny/test-reporter.git
synced 2026-03-22 07:52:14 +01:00
Merge branch 'main' into nunit-legacy-fixture
This commit is contained in:
commit
c73d8b1738
8 changed files with 606 additions and 0 deletions
34
__tests__/__outputs__/dotnet-nunit-legacy.md
Normal file
34
__tests__/__outputs__/dotnet-nunit-legacy.md
Normal file
|
|
@ -0,0 +1,34 @@
|
|||

|
||||
|Report|Passed|Failed|Skipped|Time|
|
||||
|:---|---:|---:|---:|---:|
|
||||
|fixtures/dotnet-nunit-legacy.xml|3 ✅|5 ❌|2 ⚪|0ms|
|
||||
## ❌ <a id="user-content-r0" href="#r0">fixtures/dotnet-nunit-legacy.xml</a>
|
||||
**10** tests were completed in **0ms** with **3** passed, **5** failed and **2** skipped.
|
||||
|Test suite|Passed|Failed|Skipped|Time|
|
||||
|:---|---:|---:|---:|---:|
|
||||
|[C:\Users\james_t\source\repos\NUnitLegacy\NUnitLegacy.sln.C:\Users\james_t\source\repos\NUnitLegacy\NUnitLegacyTests\bin\Debug\NUnitLegacyTests.dll.NUnitLegacyTests](#r0s0)|3 ✅|5 ❌|2 ⚪|NaNms|
|
||||
### ❌ <a id="user-content-r0s0" href="#r0s0">C:\Users\james_t\source\repos\NUnitLegacy\NUnitLegacy.sln.C:\Users\james_t\source\repos\NUnitLegacy\NUnitLegacyTests\bin\Debug\NUnitLegacyTests.dll.NUnitLegacyTests</a>
|
||||
```
|
||||
CalculatorTests
|
||||
✅ NUnitLegacyTests.CalculatorTests.Is_Even_Number(2)
|
||||
❌ NUnitLegacyTests.CalculatorTests.Is_Even_Number(3)
|
||||
Expected: True
|
||||
But was: False
|
||||
|
||||
❌ NUnitLegacyTests.CalculatorTests.Exception_In_TargetTest
|
||||
System.DivideByZeroException : Attempted to divide by zero.
|
||||
❌ NUnitLegacyTests.CalculatorTests.Exception_In_Test
|
||||
System.Exception : Test
|
||||
❌ NUnitLegacyTests.CalculatorTests.Failing_Test
|
||||
Expected: 3
|
||||
But was: 2
|
||||
|
||||
⚪ NUnitLegacyTests.CalculatorTests.Inconclusive_Test
|
||||
couldn't run test for some reason
|
||||
✅ NUnitLegacyTests.CalculatorTests.Passing_Test
|
||||
✅ NUnitLegacyTests.CalculatorTests.Passing_Test_With_Description
|
||||
⚪ NUnitLegacyTests.CalculatorTests.Skipped_Test
|
||||
Skipped
|
||||
❌ NUnitLegacyTests.CalculatorTests.Timeout_Test
|
||||
Test exceeded Timeout value of 1ms
|
||||
```
|
||||
125
__tests__/__snapshots__/dotnet-nunit-legacy.test.ts.snap
Normal file
125
__tests__/__snapshots__/dotnet-nunit-legacy.test.ts.snap
Normal file
|
|
@ -0,0 +1,125 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`dotnet-nunit-legacy tests report from ./reports/dotnet test results matches snapshot 1`] = `
|
||||
TestRunResult {
|
||||
"path": "fixtures/dotnet-nunit-legacy.xml",
|
||||
"suites": [
|
||||
TestSuiteResult {
|
||||
"groups": [
|
||||
TestGroupResult {
|
||||
"name": "CalculatorTests",
|
||||
"tests": [
|
||||
TestCaseResult {
|
||||
"error": undefined,
|
||||
"name": "NUnitLegacyTests.CalculatorTests.Is_Even_Number(2)",
|
||||
"result": "success",
|
||||
"time": 0.001,
|
||||
},
|
||||
TestCaseResult {
|
||||
"error": {
|
||||
"details": "at NUnitLegacyTests.CalculatorTests.Is_Even_Number(Int32 i) in C:\\Users\\james_t\\source\\repos\\NUnitLegacy\\NUnitLegacyTests\\CalculatorTests.cs:line 61
|
||||
",
|
||||
"line": undefined,
|
||||
"message": " Expected: True
|
||||
But was: False
|
||||
",
|
||||
"path": undefined,
|
||||
},
|
||||
"name": "NUnitLegacyTests.CalculatorTests.Is_Even_Number(3)",
|
||||
"result": "failed",
|
||||
"time": 0.002,
|
||||
},
|
||||
TestCaseResult {
|
||||
"error": {
|
||||
"details": "at MyLibrary.Calculator.Div(Int32 a, Int32 b) in C:\\Users\\james_t\\source\\repos\\NUnitLegacy\\MyLibrary\\Calculator.cs:line 7
|
||||
at NUnitLegacyTests.CalculatorTests.Exception_In_TargetTest() in C:\\Users\\james_t\\source\\repos\\NUnitLegacy\\NUnitLegacyTests\\CalculatorTests.cs:line 33
|
||||
",
|
||||
"line": undefined,
|
||||
"message": "System.DivideByZeroException : Attempted to divide by zero.",
|
||||
"path": undefined,
|
||||
},
|
||||
"name": "NUnitLegacyTests.CalculatorTests.Exception_In_TargetTest",
|
||||
"result": "failed",
|
||||
"time": 0.028,
|
||||
},
|
||||
TestCaseResult {
|
||||
"error": {
|
||||
"details": "at NUnitLegacyTests.CalculatorTests.Exception_In_Test() in C:\\Users\\james_t\\source\\repos\\NUnitLegacy\\NUnitLegacyTests\\CalculatorTests.cs:line 39
|
||||
",
|
||||
"line": undefined,
|
||||
"message": "System.Exception : Test",
|
||||
"path": undefined,
|
||||
},
|
||||
"name": "NUnitLegacyTests.CalculatorTests.Exception_In_Test",
|
||||
"result": "failed",
|
||||
"time": 0.002,
|
||||
},
|
||||
TestCaseResult {
|
||||
"error": {
|
||||
"details": "at NUnitLegacyTests.CalculatorTests.Failing_Test() in C:\\Users\\james_t\\source\\repos\\NUnitLegacy\\NUnitLegacyTests\\CalculatorTests.cs:line 27
|
||||
",
|
||||
"line": undefined,
|
||||
"message": " Expected: 3
|
||||
But was: 2
|
||||
",
|
||||
"path": undefined,
|
||||
},
|
||||
"name": "NUnitLegacyTests.CalculatorTests.Failing_Test",
|
||||
"result": "failed",
|
||||
"time": 0.016,
|
||||
},
|
||||
TestCaseResult {
|
||||
"error": {
|
||||
"details": "",
|
||||
"line": undefined,
|
||||
"message": "couldn't run test for some reason",
|
||||
"path": undefined,
|
||||
},
|
||||
"name": "NUnitLegacyTests.CalculatorTests.Inconclusive_Test",
|
||||
"result": "skipped",
|
||||
"time": 0.002,
|
||||
},
|
||||
TestCaseResult {
|
||||
"error": undefined,
|
||||
"name": "NUnitLegacyTests.CalculatorTests.Passing_Test",
|
||||
"result": "success",
|
||||
"time": 0,
|
||||
},
|
||||
TestCaseResult {
|
||||
"error": undefined,
|
||||
"name": "NUnitLegacyTests.CalculatorTests.Passing_Test_With_Description",
|
||||
"result": "success",
|
||||
"time": 0,
|
||||
},
|
||||
TestCaseResult {
|
||||
"error": {
|
||||
"details": "",
|
||||
"line": undefined,
|
||||
"message": "Skipped",
|
||||
"path": undefined,
|
||||
},
|
||||
"name": "NUnitLegacyTests.CalculatorTests.Skipped_Test",
|
||||
"result": "skipped",
|
||||
"time": NaN,
|
||||
},
|
||||
TestCaseResult {
|
||||
"error": {
|
||||
"details": "",
|
||||
"line": undefined,
|
||||
"message": "Test exceeded Timeout value of 1ms",
|
||||
"path": undefined,
|
||||
},
|
||||
"name": "NUnitLegacyTests.CalculatorTests.Timeout_Test",
|
||||
"result": "failed",
|
||||
"time": 0.027,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
"name": "C:\\Users\\james_t\\source\\repos\\NUnitLegacy\\NUnitLegacy.sln.C:\\Users\\james_t\\source\\repos\\NUnitLegacy\\NUnitLegacyTests\\bin\\Debug\\NUnitLegacyTests.dll.NUnitLegacyTests",
|
||||
"totalTime": undefined,
|
||||
},
|
||||
],
|
||||
"totalTime": 0,
|
||||
}
|
||||
`;
|
||||
29
__tests__/dotnet-nunit-legacy.test.ts
Normal file
29
__tests__/dotnet-nunit-legacy.test.ts
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
import * as fs from 'fs'
|
||||
import * as path from 'path'
|
||||
|
||||
import {DotnetNunitLegacyParser} from '../src/parsers/dotnet-nunit-legacy/dotnet-nunit-legacy-parser'
|
||||
import {ParseOptions} from '../src/test-parser'
|
||||
import {getReport} from '../src/report/get-report'
|
||||
import {normalizeFilePath} from '../src/utils/path-utils'
|
||||
|
||||
describe('dotnet-nunit-legacy tests', () => {
|
||||
it('report from ./reports/dotnet test results matches snapshot', async () => {
|
||||
const fixturePath = path.join(__dirname, 'fixtures', 'dotnet-nunit-legacy.xml')
|
||||
const outputPath = path.join(__dirname, '__outputs__', 'dotnet-nunit-legacy.md')
|
||||
const filePath = normalizeFilePath(path.relative(__dirname, fixturePath))
|
||||
const fileContent = fs.readFileSync(fixturePath, {encoding: 'utf8'})
|
||||
|
||||
const opts: ParseOptions = {
|
||||
parseErrors: true,
|
||||
trackedFiles: ['DotnetTests.Unit/Calculator.cs', 'DotnetTests.NUnitLegacyTests/CalculatorTests.cs']
|
||||
}
|
||||
|
||||
const parser = new DotnetNunitLegacyParser(opts)
|
||||
const result = await parser.parse(filePath, fileContent)
|
||||
expect(result).toMatchSnapshot()
|
||||
|
||||
const report = getReport([result])
|
||||
fs.mkdirSync(path.dirname(outputPath), {recursive: true})
|
||||
fs.writeFileSync(outputPath, report)
|
||||
})
|
||||
})
|
||||
82
__tests__/fixtures/dotnet-nunit-legacy.xml
Normal file
82
__tests__/fixtures/dotnet-nunit-legacy.xml
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||
<!--This file represents the results of running a test suite-->
|
||||
<test-results name="C:\Users\james_t\source\repos\NUnitLegacy\NUnitLegacy.sln" total="9" errors="2" failures="3" not-run="1" inconclusive="1" ignored="1" skipped="0" invalid="0" date="2025-03-05" time="00:58:36">
|
||||
<environment nunit-version="2.6.1.12217" clr-version="2.0.50727.9179" os-version="Microsoft Windows NT 6.2.9200.0" platform="Win32NT" cwd="C:\Users\james_t\source\repos\NUnitLegacy" machine-name="CTXSHAMUS" user="james_t" user-domain="LABATTSA" />
|
||||
<culture-info current-culture="en-US" current-uiculture="en-US" />
|
||||
<test-suite type="Project" name="C:\Users\james_t\source\repos\NUnitLegacy\NUnitLegacy.sln" executed="True" result="Failure" success="False" time="0.133" asserts="0">
|
||||
<results>
|
||||
<test-suite type="Assembly" name="C:\Users\james_t\source\repos\NUnitLegacy\NUnitLegacyTests\bin\Debug\NUnitLegacyTests.dll" executed="True" result="Failure" success="False" time="0.117" asserts="0">
|
||||
<results>
|
||||
<test-suite type="Namespace" name="NUnitLegacyTests" executed="True" result="Failure" success="False" time="0.117" asserts="0">
|
||||
<results>
|
||||
<test-suite type="TestFixture" name="CalculatorTests" executed="True" result="Failure" success="False" time="0.116" asserts="0">
|
||||
<results>
|
||||
<test-case name="NUnitLegacyTests.CalculatorTests.Exception_In_TargetTest" executed="True" result="Error" success="False" time="0.028" asserts="0">
|
||||
<failure>
|
||||
<message><![CDATA[System.DivideByZeroException : Attempted to divide by zero.]]></message>
|
||||
<stack-trace><![CDATA[at MyLibrary.Calculator.Div(Int32 a, Int32 b) in C:\Users\james_t\source\repos\NUnitLegacy\MyLibrary\Calculator.cs:line 7
|
||||
at NUnitLegacyTests.CalculatorTests.Exception_In_TargetTest() in C:\Users\james_t\source\repos\NUnitLegacy\NUnitLegacyTests\CalculatorTests.cs:line 33
|
||||
]]></stack-trace>
|
||||
</failure>
|
||||
</test-case>
|
||||
<test-case name="NUnitLegacyTests.CalculatorTests.Exception_In_Test" executed="True" result="Error" success="False" time="0.002" asserts="0">
|
||||
<failure>
|
||||
<message><![CDATA[System.Exception : Test]]></message>
|
||||
<stack-trace><![CDATA[at NUnitLegacyTests.CalculatorTests.Exception_In_Test() in C:\Users\james_t\source\repos\NUnitLegacy\NUnitLegacyTests\CalculatorTests.cs:line 39
|
||||
]]></stack-trace>
|
||||
</failure>
|
||||
</test-case>
|
||||
<test-case name="NUnitLegacyTests.CalculatorTests.Failing_Test" executed="True" result="Failure" success="False" time="0.016" asserts="1">
|
||||
<failure>
|
||||
<message><![CDATA[ Expected: 3
|
||||
But was: 2
|
||||
]]></message>
|
||||
<stack-trace><![CDATA[at NUnitLegacyTests.CalculatorTests.Failing_Test() in C:\Users\james_t\source\repos\NUnitLegacy\NUnitLegacyTests\CalculatorTests.cs:line 27
|
||||
]]></stack-trace>
|
||||
</failure>
|
||||
</test-case>
|
||||
<test-case name="NUnitLegacyTests.CalculatorTests.Inconclusive_Test" executed="True" result="Inconclusive" success="False" time="0.002" asserts="0">
|
||||
<reason>
|
||||
<message><![CDATA[couldn't run test for some reason]]></message>
|
||||
</reason>
|
||||
</test-case>
|
||||
<test-suite type="Theory" name="Is_Even_Number" executed="True" result="Failure" success="False" time="0.005" asserts="0">
|
||||
<results>
|
||||
<test-case name="NUnitLegacyTests.CalculatorTests.Is_Even_Number(2)" executed="True" result="Success" success="True" time="0.001" asserts="1" />
|
||||
<test-case name="NUnitLegacyTests.CalculatorTests.Is_Even_Number(3)" executed="True" result="Failure" success="False" time="0.002" asserts="1">
|
||||
<failure>
|
||||
<message><![CDATA[ Expected: True
|
||||
But was: False
|
||||
]]></message>
|
||||
<stack-trace><![CDATA[at NUnitLegacyTests.CalculatorTests.Is_Even_Number(Int32 i) in C:\Users\james_t\source\repos\NUnitLegacy\NUnitLegacyTests\CalculatorTests.cs:line 61
|
||||
]]></stack-trace>
|
||||
</failure>
|
||||
</test-case>
|
||||
</results>
|
||||
</test-suite>
|
||||
<test-case name="NUnitLegacyTests.CalculatorTests.Passing_Test" executed="True" result="Success" success="True" time="0.000" asserts="1" />
|
||||
<test-case name="NUnitLegacyTests.CalculatorTests.Passing_Test_With_Description" description="Some description" executed="True" result="Success" success="True" time="0.000" asserts="1" />
|
||||
<test-case name="NUnitLegacyTests.CalculatorTests.Skipped_Test" executed="False" result="Ignored">
|
||||
<reason>
|
||||
<message><![CDATA[Skipped]]></message>
|
||||
</reason>
|
||||
</test-case>
|
||||
<test-case name="NUnitLegacyTests.CalculatorTests.Timeout_Test" executed="True" result="Failure" success="False" time="0.027" asserts="0">
|
||||
<properties>
|
||||
<property name="Timeout" value="1" />
|
||||
</properties>
|
||||
<failure>
|
||||
<message><![CDATA[Test exceeded Timeout value of 1ms]]></message>
|
||||
<stack-trace />
|
||||
</failure>
|
||||
</test-case>
|
||||
</results>
|
||||
</test-suite>
|
||||
</results>
|
||||
</test-suite>
|
||||
</results>
|
||||
</test-suite>
|
||||
<test-suite type="Assembly" name="C:\Users\james_t\source\repos\NUnitLegacy\MyLibrary\bin\Debug\MyLibrary.dll" executed="True" result="Inconclusive" success="False" time="0.000" asserts="0" />
|
||||
</results>
|
||||
</test-suite>
|
||||
</test-results>
|
||||
Loading…
Add table
Add a link
Reference in a new issue