diff --git a/docs/docs/advanced/performance-best-practices.md b/docs/docs/advanced/performance-best-practices.md index 3e7f0abb2f..15034990fd 100644 --- a/docs/docs/advanced/performance-best-practices.md +++ b/docs/docs/advanced/performance-best-practices.md @@ -482,15 +482,20 @@ public class InMemoryDatabaseTests ```bash # Run fast unit tests first -dotnet test --filter "Category=Unit" --no-build +dotnet test --no-build -- --treenode-filter "/*/*/*/*[Category=Unit]" # Run slower integration tests separately -dotnet test --filter "Category=Integration" --no-build +dotnet test --no-build -- --treenode-filter "/*/*/*/*[Category=Integration]" # Run expensive E2E tests last -dotnet test --filter "Category=E2E" --no-build +dotnet test --no-build -- --treenode-filter "/*/*/*/*[Category=E2E]" ``` +> **Note**: With .NET 10 SDK or newer, you can use the simpler syntax: +> ```bash +> dotnet test --no-build --treenode-filter "/**[Category=Unit]" +> ``` + ### Use Test Result Caching ```xml diff --git a/docs/docs/examples/tunit-ci-pipeline.md b/docs/docs/examples/tunit-ci-pipeline.md index 07ea89d282..3d2bff9aab 100644 --- a/docs/docs/examples/tunit-ci-pipeline.md +++ b/docs/docs/examples/tunit-ci-pipeline.md @@ -331,7 +331,7 @@ test:integration: - build script: - dotnet test --configuration $BUILD_CONFIGURATION --no-build - --filter "Category=Integration" + -- --treenode-filter "/*/*/*/*[Category=Integration]" --report-trx --results-directory ./TestResults artifacts: when: always @@ -590,13 +590,18 @@ Run different test categories in separate jobs: ```yaml # Unit tests (fast) - name: Unit Tests - run: dotnet test --filter "Category=Unit" + run: dotnet test -- --treenode-filter "/*/*/*/*[Category=Unit]" # Integration tests (slower) - name: Integration Tests - run: dotnet test --filter "Category=Integration" + run: dotnet test -- --treenode-filter "/*/*/*/*[Category=Integration]" ``` +> **Note**: With .NET 10 SDK or newer, you can use the simpler syntax without the `--` separator: +> ```yaml +> run: dotnet test --treenode-filter "/**[Category=Unit]" +> ``` + ### Fail Fast in PRs Use fail-fast mode for quick feedback in pull requests: