Skip to content

Commit ec9d9d2

Browse files
authored
Merge pull request #623 from 0xced/xunitv3-trx
2 parents 8dd7047 + be36461 commit ec9d9d2

File tree

14 files changed

+230
-22
lines changed

14 files changed

+230
-22
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
![Tests failed](https://img.shields.io/badge/tests-1%20passed%2C%203%20failed-critical)
2+
|Report|Passed|Failed|Skipped|Time|
3+
|:---|---:|---:|---:|---:|
4+
|[fixtures/dotnet-xunitv3.trx](#user-content-r0)|1 ✅|3 ❌||267ms|
5+
## ❌ <a id="user-content-r0" href="#user-content-r0">fixtures/dotnet-xunitv3.trx</a>
6+
**4** tests were completed in **267ms** with **1** passed, **3** failed and **0** skipped.
7+
|Test suite|Passed|Failed|Skipped|Time|
8+
|:---|---:|---:|---:|---:|
9+
|[DotnetTests.XUnitV3Tests.FixtureTests](#user-content-r0s0)|1 ✅|1 ❌||18ms|
10+
|[Unclassified](#user-content-r0s1)||2 ❌||0ms|
11+
### ❌ <a id="user-content-r0s0" href="#user-content-r0s0">DotnetTests.XUnitV3Tests.FixtureTests</a>
12+
```
13+
❌ Failing_Test
14+
Assert.Null() Failure: Value is not null
15+
Expected: null
16+
Actual: Fixture { }
17+
at DotnetTests.XUnitV3Tests.FixtureTests.Failing_Test() in /_/reports/dotnet/DotnetTests.XUnitV3Tests/FixtureTests.cs:line 25
18+
at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
19+
at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
20+
✅ Passing_Test
21+
```
22+
### ❌ <a id="user-content-r0s1" href="#user-content-r0s1">Unclassified</a>
23+
```
24+
❌ [Test Class Cleanup Failure (DotnetTests.XUnitV3Tests.FixtureTests.Failing_Test)]
25+
❌ [Test Class Cleanup Failure (DotnetTests.XUnitV3Tests.FixtureTests.Passing_Test)]
26+
```

__tests__/__snapshots__/dotnet-trx.test.ts.snap

Lines changed: 72 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3-
exports[`dotnet-trx tests matches report snapshot (only failed tests) 1`] = `
3+
exports[`dotnet-trx tests matches dotnet-trx report snapshot 1`] = `
44
TestRunResult {
55
"path": "fixtures/dotnet-trx.trx",
66
"suites": [
@@ -135,7 +135,77 @@ Actual: False
135135
}
136136
`;
137137

138-
exports[`dotnet-trx tests matches report snapshot 1`] = `
138+
exports[`dotnet-trx tests matches dotnet-xunitv3 report snapshot 1`] = `
139+
TestRunResult {
140+
"path": "fixtures/dotnet-xunitv3.trx",
141+
"suites": [
142+
TestSuiteResult {
143+
"groups": [
144+
TestGroupResult {
145+
"name": null,
146+
"tests": [
147+
TestCaseResult {
148+
"error": {
149+
"details": "Assert.Null() Failure: Value is not null
150+
Expected: null
151+
Actual: Fixture { }
152+
at DotnetTests.XUnitV3Tests.FixtureTests.Failing_Test() in /_/reports/dotnet/DotnetTests.XUnitV3Tests/FixtureTests.cs:line 25
153+
at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
154+
at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)",
155+
"line": 25,
156+
"message": "Assert.Null() Failure: Value is not null
157+
Expected: null
158+
Actual: Fixture { }
159+
at DotnetTests.XUnitV3Tests.FixtureTests.Failing_Test() in /_/reports/dotnet/DotnetTests.XUnitV3Tests/FixtureTests.cs:line 25
160+
at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
161+
at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)",
162+
"path": "DotnetTests.XUnitV3Tests/FixtureTests.cs",
163+
},
164+
"name": "Failing_Test",
165+
"result": "failed",
166+
"time": 17.0545,
167+
},
168+
TestCaseResult {
169+
"error": undefined,
170+
"name": "Passing_Test",
171+
"result": "success",
172+
"time": 0.8786,
173+
},
174+
],
175+
},
176+
],
177+
"name": "DotnetTests.XUnitV3Tests.FixtureTests",
178+
"totalTime": undefined,
179+
},
180+
TestSuiteResult {
181+
"groups": [
182+
TestGroupResult {
183+
"name": null,
184+
"tests": [
185+
TestCaseResult {
186+
"error": undefined,
187+
"name": "[Test Class Cleanup Failure (DotnetTests.XUnitV3Tests.FixtureTests.Failing_Test)]",
188+
"result": "failed",
189+
"time": 0,
190+
},
191+
TestCaseResult {
192+
"error": undefined,
193+
"name": "[Test Class Cleanup Failure (DotnetTests.XUnitV3Tests.FixtureTests.Passing_Test)]",
194+
"result": "failed",
195+
"time": 0,
196+
},
197+
],
198+
},
199+
],
200+
"name": "Unclassified",
201+
"totalTime": undefined,
202+
},
203+
],
204+
"totalTime": 267,
205+
}
206+
`;
207+
208+
exports[`dotnet-trx tests matches report snapshot (only failed tests) 1`] = `
139209
TestRunResult {
140210
"path": "fixtures/dotnet-trx.trx",
141211
"suites": [

__tests__/dotnet-trx.test.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,19 @@ describe('dotnet-trx tests', () => {
3939
expect(result.result).toBe('success')
4040
})
4141

42-
it('matches report snapshot', async () => {
43-
const fixturePath = path.join(__dirname, 'fixtures', 'dotnet-trx.trx')
44-
const outputPath = path.join(__dirname, '__outputs__', 'dotnet-trx.md')
42+
it.each([['dotnet-trx'], ['dotnet-xunitv3']])('matches %s report snapshot', async reportName => {
43+
const fixturePath = path.join(__dirname, 'fixtures', `${reportName}.trx`)
44+
const outputPath = path.join(__dirname, '__outputs__', `${reportName}.md`)
4545
const filePath = normalizeFilePath(path.relative(__dirname, fixturePath))
4646
const fileContent = fs.readFileSync(fixturePath, {encoding: 'utf8'})
4747

4848
const opts: ParseOptions = {
4949
parseErrors: true,
50-
trackedFiles: ['DotnetTests.Unit/Calculator.cs', 'DotnetTests.XUnitTests/CalculatorTests.cs']
50+
trackedFiles: [
51+
'DotnetTests.Unit/Calculator.cs',
52+
'DotnetTests.XUnitTests/CalculatorTests.cs',
53+
'DotnetTests.XUnitV3Tests/FixtureTests.cs'
54+
]
5155
//workDir: 'C:/Users/Michal/Workspace/dorny/test-check/reports/dotnet/'
5256
}
5357

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<TestRun id="54e29175-539e-48a3-a634-3a1855a0ed38" name="@Asterix 2025-06-22 14:17:12.022" xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010">
3+
<Times creation="2025-06-22T14:17:11.756535Z" queuing="2025-06-22T14:17:11.756535Z" start="2025-06-22T14:17:11.756535Z" finish="2025-06-22T14:17:12.023063Z" />
4+
<TestSettings name="default" id="932e6c6f-3e5b-4392-ad65-e04c1ef476b5">
5+
<Deployment runDeploymentRoot="_Asterix_2025-06-22_14_17_12.022" />
6+
</TestSettings>
7+
<Results>
8+
<UnitTestResult executionId="37242a1f-ca3e-44b3-8142-71e510480975" testId="f846a1e6-0b68-2ac6-9a66-f417926e3238" testName="DotnetTests.XUnitV3Tests.FixtureTests.Failing_Test" computerName="Asterix" duration="00:00:00.0170545" startTime="2025-06-22T14:17:11.9339840+00:00" endTime="2025-06-22T14:17:11.9750850+00:00" testType="13CDC9D9-DDB5-4fa4-A97D-D965CCFC6D4B" outcome="Failed" testListId="8C84FA94-04C1-424b-9868-57A2D4851A1D" relativeResultsDirectory="37242a1f-ca3e-44b3-8142-71e510480975">
9+
<Output>
10+
<ErrorInfo>
11+
<Message>Assert.Null() Failure: Value is not null
12+
Expected: null
13+
Actual: Fixture { }</Message>
14+
<StackTrace> at DotnetTests.XUnitV3Tests.FixtureTests.Failing_Test() in /_/reports/dotnet/DotnetTests.XUnitV3Tests/FixtureTests.cs:line 25
15+
at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
16+
at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)</StackTrace>
17+
</ErrorInfo>
18+
</Output>
19+
</UnitTestResult>
20+
<UnitTestResult executionId="592aaafb-4dc0-49dc-b3c7-bcd81218d58a" testId="3ee930dd-8a75-92a0-0d90-373833166db1" testName="DotnetTests.XUnitV3Tests.FixtureTests.Passing_Test" computerName="Asterix" duration="00:00:00.0008786" startTime="2025-06-22T14:17:11.9819890+00:00" endTime="2025-06-22T14:17:11.9833560+00:00" testType="13CDC9D9-DDB5-4fa4-A97D-D965CCFC6D4B" outcome="Passed" testListId="8C84FA94-04C1-424b-9868-57A2D4851A1D" relativeResultsDirectory="592aaafb-4dc0-49dc-b3c7-bcd81218d58a" />
21+
<UnitTestResult executionId="19c42d36-f4d7-4046-bcc6-dd9b85c9ca2b" testId="372fb60f-1f5b-a52e-032e-41a7556021e8" testName="[Test Class Cleanup Failure (DotnetTests.XUnitV3Tests.FixtureTests.Passing_Test)]" computerName="Asterix" duration="00:00:00" startTime="2025-06-22T14:17:12.0320280+00:00" endTime="2025-06-22T14:17:12.0320290+00:00" testType="13CDC9D9-DDB5-4fa4-A97D-D965CCFC6D4B" outcome="Failed" testListId="8C84FA94-04C1-424b-9868-57A2D4851A1D" relativeResultsDirectory="19c42d36-f4d7-4046-bcc6-dd9b85c9ca2b" />
22+
<UnitTestResult executionId="b7f40170-1e2c-45ce-b5e4-5bf49fd4c360" testId="a69083a1-56b4-3da3-2d7c-66fda374fd8e" testName="[Test Class Cleanup Failure (DotnetTests.XUnitV3Tests.FixtureTests.Failing_Test)]" computerName="Asterix" duration="00:00:00" startTime="2025-06-22T14:17:12.0320420+00:00" endTime="2025-06-22T14:17:12.0320430+00:00" testType="13CDC9D9-DDB5-4fa4-A97D-D965CCFC6D4B" outcome="Failed" testListId="8C84FA94-04C1-424b-9868-57A2D4851A1D" relativeResultsDirectory="b7f40170-1e2c-45ce-b5e4-5bf49fd4c360" />
23+
</Results>
24+
<TestDefinitions>
25+
<UnitTest name="DotnetTests.XUnitV3Tests.FixtureTests.Failing_Test" storage="~/test-reporter/reports/dotnet/dotnettests.xunitv3tests/bin/debug/net8.0/dotnettests.xunitv3tests.dll" id="f846a1e6-0b68-2ac6-9a66-f417926e3238">
26+
<Execution id="37242a1f-ca3e-44b3-8142-71e510480975" />
27+
<TestMethod codeBase="~/test-reporter/reports/dotnet/DotnetTests.XUnitV3Tests/bin/Debug/net8.0/DotnetTests.XUnitV3Tests.dll" adapterTypeName="executor://30ea7c6e-dd24-4152-a360-1387158cd41d/2.0.3" className="DotnetTests.XUnitV3Tests.FixtureTests" name="DotnetTests.XUnitV3Tests.FixtureTests.Failing_Test" />
28+
</UnitTest>
29+
<UnitTest name="DotnetTests.XUnitV3Tests.FixtureTests.Passing_Test" storage="~/test-reporter/reports/dotnet/dotnettests.xunitv3tests/bin/debug/net8.0/dotnettests.xunitv3tests.dll" id="3ee930dd-8a75-92a0-0d90-373833166db1">
30+
<Execution id="592aaafb-4dc0-49dc-b3c7-bcd81218d58a" />
31+
<TestMethod codeBase="~/test-reporter/reports/dotnet/DotnetTests.XUnitV3Tests/bin/Debug/net8.0/DotnetTests.XUnitV3Tests.dll" adapterTypeName="executor://30ea7c6e-dd24-4152-a360-1387158cd41d/2.0.3" className="DotnetTests.XUnitV3Tests.FixtureTests" name="DotnetTests.XUnitV3Tests.FixtureTests.Passing_Test" />
32+
</UnitTest>
33+
<UnitTest name="[Test Class Cleanup Failure (DotnetTests.XUnitV3Tests.FixtureTests.Passing_Test)]" storage="~/test-reporter/reports/dotnet/dotnettests.xunitv3tests/bin/debug/net8.0/dotnettests.xunitv3tests.dll" id="372fb60f-1f5b-a52e-032e-41a7556021e8">
34+
<Execution id="19c42d36-f4d7-4046-bcc6-dd9b85c9ca2b" />
35+
<TestMethod codeBase="~/test-reporter/reports/dotnet/DotnetTests.XUnitV3Tests/bin/Debug/net8.0/DotnetTests.XUnitV3Tests.dll" adapterTypeName="executor://30ea7c6e-dd24-4152-a360-1387158cd41d/2.0.3" name="[Test Class Cleanup Failure (DotnetTests.XUnitV3Tests.FixtureTests.Passing_Test)]" />
36+
</UnitTest>
37+
<UnitTest name="[Test Class Cleanup Failure (DotnetTests.XUnitV3Tests.FixtureTests.Failing_Test)]" storage="~/test-reporter/reports/dotnet/dotnettests.xunitv3tests/bin/debug/net8.0/dotnettests.xunitv3tests.dll" id="a69083a1-56b4-3da3-2d7c-66fda374fd8e">
38+
<Execution id="b7f40170-1e2c-45ce-b5e4-5bf49fd4c360" />
39+
<TestMethod codeBase="~/test-reporter/reports/dotnet/DotnetTests.XUnitV3Tests/bin/Debug/net8.0/DotnetTests.XUnitV3Tests.dll" adapterTypeName="executor://30ea7c6e-dd24-4152-a360-1387158cd41d/2.0.3" name="[Test Class Cleanup Failure (DotnetTests.XUnitV3Tests.FixtureTests.Failing_Test)]" />
40+
</UnitTest>
41+
</TestDefinitions>
42+
<TestEntries>
43+
<TestEntry testId="f846a1e6-0b68-2ac6-9a66-f417926e3238" executionId="37242a1f-ca3e-44b3-8142-71e510480975" testListId="8C84FA94-04C1-424b-9868-57A2D4851A1D" />
44+
<TestEntry testId="3ee930dd-8a75-92a0-0d90-373833166db1" executionId="592aaafb-4dc0-49dc-b3c7-bcd81218d58a" testListId="8C84FA94-04C1-424b-9868-57A2D4851A1D" />
45+
<TestEntry testId="372fb60f-1f5b-a52e-032e-41a7556021e8" executionId="19c42d36-f4d7-4046-bcc6-dd9b85c9ca2b" testListId="8C84FA94-04C1-424b-9868-57A2D4851A1D" />
46+
<TestEntry testId="a69083a1-56b4-3da3-2d7c-66fda374fd8e" executionId="b7f40170-1e2c-45ce-b5e4-5bf49fd4c360" testListId="8C84FA94-04C1-424b-9868-57A2D4851A1D" />
47+
</TestEntries>
48+
<TestLists>
49+
<TestList name="Results Not in a List" id="8C84FA94-04C1-424b-9868-57A2D4851A1D" />
50+
<TestList name="All Loaded Results" id="19431567-8539-422a-85d7-44ee4e166bda" />
51+
</TestLists>
52+
<ResultSummary outcome="Failed">
53+
<Counters total="4" executed="4" passed="1" failed="3" error="0" timeout="0" aborted="0" inconclusive="0" passedButRunAborted="0" notRunnable="0" notExecuted="0" disconnected="0" warning="0" completed="0" inProgress="0" pending="0" />
54+
<RunInfos>
55+
<RunInfo computerName="Asterix" outcome="Error" timestamp="2025-06-22T14:17:12.033401">
56+
<Text>Exit code indicates failure: '2'. Please refer to https://aka.ms/testingplatform/exitcodes for more information.</Text>
57+
</RunInfo>
58+
</RunInfos>
59+
</ResultSummary>
60+
</TestRun>

dist/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"all": "npm run build && npm run format && npm run lint && npm run package && npm test",
1717
"dart-fixture": "cd \"reports/dart\" && dart test --file-reporter=\"json:../../__tests__/fixtures/dart-json.json\"",
1818
"dotnet-fixture": "dotnet test reports/dotnet/DotnetTests.XUnitTests --logger \"trx;LogFileName=../../../../__tests__/fixtures/dotnet-trx.trx\"",
19+
"dotnet-xunitv3-fixture": "dotnet run --project reports/dotnet/DotnetTests.XUnitV3Tests/DotnetTests.XUnitV3Tests.csproj --report-trx --report-trx-filename dotnet-xunitv3.trx --results-directory __tests__/fixtures/",
1920
"dotnet-nunit-fixture": "nunit.exe reports/dotnet/DotnetTests.NUnitV3Tests/bin/Debug/netcoreapp3.1/DotnetTests.NUnitV3Tests.dll --result=__tests__/fixtures/dotnet-nunit.xml",
2021
"dotnet-nunit-legacy-fixture": "nunit-console.exe reports/dotnet-nunit-legacy/NUnitLegacy.sln --result=__tests__/fixtures/dotnet-nunit-legacy.xml",
2122
"golang-json-fixture": "go test -v -json -timeout 5s ./reports/go | tee __tests__/fixtures/golang-json.json",

reports/dotnet/DotnetTests.NUnitV3Tests/CalculatorTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public void Exception_In_Test()
4040
}
4141

4242
[Test]
43-
[Timeout(1)]
43+
[CancelAfter(1)]
4444
public void Timeout_Test()
4545
{
4646
Thread.Sleep(100);
@@ -58,7 +58,7 @@ public void Skipped_Test()
5858
[TestCase(3)]
5959
public void Is_Even_Number(int i)
6060
{
61-
Assert.True(i % 2 == 0);
61+
Assert.That(i % 2 == 0);
6262
}
6363
}
6464
}

reports/dotnet/DotnetTests.NUnitV3Tests/DotnetTests.NUnitV3Tests.csproj

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp3.1</TargetFramework>
5-
6-
<IsPackable>false</IsPackable>
4+
<TargetFramework>net8.0</TargetFramework>
5+
<DeterministicSourcePaths>true</DeterministicSourcePaths>
76
</PropertyGroup>
87

98
<ItemGroup>
10-
<PackageReference Include="NUnit" Version="3.13.2" />
11-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
9+
<PackageReference Include="NUnit" Version="4.3.2" />
10+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
1211
</ItemGroup>
1312

1413
<ItemGroup>

reports/dotnet/DotnetTests.Unit/DotnetTests.Unit.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
<PropertyGroup>
44
<TargetFramework>netstandard2.0</TargetFramework>
5+
<DeterministicSourcePaths>true</DeterministicSourcePaths>
56
</PropertyGroup>
67

78
</Project>

reports/dotnet/DotnetTests.XUnitTests/DotnetTests.XUnitTests.csproj

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp3.1</TargetFramework>
5-
6-
<IsPackable>false</IsPackable>
4+
<TargetFramework>net8.0</TargetFramework>
5+
<DeterministicSourcePaths>true</DeterministicSourcePaths>
76
</PropertyGroup>
87

98
<ItemGroup>
10-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
11-
<PackageReference Include="xunit" Version="2.4.0" />
12-
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
13-
<PackageReference Include="coverlet.collector" Version="1.2.0" />
9+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
10+
<PackageReference Include="xunit" Version="2.9.3" />
11+
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.1" />
1412
</ItemGroup>
1513

1614
<ItemGroup>

0 commit comments

Comments
 (0)