Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dotnet test --filter not working? #1537

Open
chrispellett opened this issue Jan 10, 2025 · 2 comments
Open

Dotnet test --filter not working? #1537

chrispellett opened this issue Jan 10, 2025 · 2 comments

Comments

@chrispellett
Copy link

Apologies if this is not a tunit issue (perhaps it is a testing platform item?).

I am trying to leverage the dotnet test --filter functionality to limit what tests are run.

My basic setup:

  • Company.Tests: tunit project with just unit tests
  • Company.IntegrationTests: tunit project with integration tests. Also has [assembly: Category("Integration")]

I have tried numerous combinations of filters, none of which seem to work. A few examples I tried:
dotnet test --filter "FullyQualifiedName~IntegrationTests"
dotnet test --filter "Category=Integration"

The only thing I could get to work was the example from [Explicit]: dotnet run --treenode-filter ////

I just wanted to check if the dotnet filter part is meant to work from a tunit perspective?

Many thanks

@thomhurst
Copy link
Owner

thomhurst commented Jan 10, 2025

Heya - Nope, the --filter flag is a VSTest relic, and because TUnit isn't built on top of VSTest, it won't work.

You'll need to use the treenode filter.

dotnet test --filter "FullyQualifiedName~IntegrationTests"
turns into
dotnet test -- --treenode-filter /*/*/*IntegrationTests/*

and

dotnet test --filter "Category=Integration"
turns into
dotnet test -- --treenode-filter /*/*/*/*[Category=Integration]

@thomhurst
Copy link
Owner

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants