-
Notifications
You must be signed in to change notification settings - Fork 288
Closed
Description
Describe the bug
When running tests with the --filter option to exclude some categories (e.g., TestCategory!=Integration), the filtered-out tests are not shown in the resulting .trx report as skipped or not executed.
Steps To Reproduce
-
Create a test project with two NUnit tests, one marked with
[Category("Integration")]and the other not:[Test] public void Test1() { /* basic test */ } [Test, Category("Integration")] public void Test2() { /* integration test */ }
-
Run the tests using a category filter:
dotnet test -- --filter "TestCategory!=Integration" --results-directory ./TestResults --report-trx --report-trx-filename test-result.trx
-
Open the generated
.trxreport and examine the<Results>and<ResultSummary>sections.
Expected behavior
Both tests (Test1 and Test2) should be mentioned in the .trx report.
Test1should appear as executed and passed.Test2should appear as skipped or not executed.
Actual behavior
Only Test1 appears in the .trx report under <Results>, <ResultSummary >. Test2 is missing entirely and is not mentioned in any part of the report.
<Results>
<UnitTestResult executionId="f76a1c95-3a55-49b9-86fa-59dd03168db3" testId="4893b961-402c-b725-b58c-bbc9524c4af4" testName="Test1" computerName="MyPC" duration="00:00:01.0152400" startTime="2025-04-16T09:32:52.0791590+00:00" endTime="2025-04-16T09:32:53.0943576+00:00" testType="13CDC9D9-DDB5-4fa4-A97D-D965CCFC6D4B" outcome="Passed" testListId="8C84FA94-04C1-424b-9868-57A2D4851A1D" relativeResultsDirectory="f76a1c95-3a55-49b9-86fa-59dd03168db3" />
</Results>
<ResultSummary outcome="Completed">
<Counters total="1" executed="1" passed="1" failed="0" error="0" timeout="0" aborted="0" inconclusive="0" passedButRunAborted="0" notRunnable="0" notExecuted="0" disconnected="0" warning="0" completed="0" inProgress="0" pending="0" />
</ResultSummary>Additional context
Packages:
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.13.0"/>
<PackageReference Include="Microsoft.Testing.Platform" Version="[1.6.3]"/>
<PackageReference Include="Microsoft.Testing.Extensions.TrxReport" Version="[1.6.3]"/>
<PackageReference Include="Microsoft.Testing.Extensions.CodeCoverage" Version="[17.13.1]"/>
<PackageReference Include="NUnit" Version="[3.14.0]"/>
<PackageReference Include="NUnit3TestAdapter" Version="[5.0.0]"/>