TUnit icon indicating copy to clipboard operation
TUnit copied to clipboard

Filtering out an integration test project leads to failed tests

Open ChristianSauer opened this issue 8 months ago • 0 comments

I have a solution with ~5 Unit Test projects and an Integration test Project. I cannot run both at the same time. Therefore I try to filter out the Integration Tests like this:

dotnet test --configuration Release --nologo -- --disable-logo --report-trx --treenode-filter /*/*/*/*[Category!=ApiTests] --results-directory ./trx --hide-test-output --coverage --coverage-output-format cobertura

TUnit builds and executes the integration test project, but then it discovers 0 tests and fails:

TUnit v0.18.33.0 | 64-bit | Microsoft Windows 10.0.26100 | win-x64 | .NET 8.0.15 | Microsoft Testing Platform v1.6.3


  In process file artifacts produced:
    - G:\dev\ApiTests\trx\15d8eaee-ce16-433b-a2ef-c7a01b6865c7.cobertura.xml
    - G:\dev\ApiTests\trx\***_2025-05-02_08_24_56.342.trx
Test run summary: Zero tests ran - G:\dev\ApiTests.dll (net8.0|x64)
  total: 0
  failed: 0
  succeeded: 0
  skipped: 0
  duration: 465ms

=== COMMAND LINE ===
C:\Program Files\dotnet\dotnet.exe exec G:\devApiTests.dll --internal-msbuild-node testingplatform.pipe.3915f076b0774b3297f73182eab57335 --disable-logo --report-trx --treenode-filter /*/*/*/*[Category!=ApiTests] --results-directory ./trx --hide-test-output --coverage --coverage-output-format cobertura 

All test projects have these package references:

    <PackageReference Include="Microsoft.Testing.Extensions.CodeCoverage" Version="17.14.2" />
    <PackageReference Include="Microsoft.Testing.Extensions.TrxReport" Version="1.6.3" />

ONLY the Apitest project has this Category:

[assembly: Category("ApiTests")]

I can drop the filter in favor of running all tests explicitily, but that's error prone

ChristianSauer avatar May 02 '25 08:05 ChristianSauer