Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions docs/docs/advanced/performance-best-practices.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 8 additions & 3 deletions docs/docs/examples/tunit-ci-pipeline.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
Loading