Skip to main content

testing

Provides guidance and instructions for writing, running and filtering tests.

소스 정보

저장소
dotnet/Nerdbank.GitVersioning
최근 소스 활동
2026년 10월 14일 16:33
감지된 SKILL.md 언어
영어
스타
1,597
포크
184

설치 방법

기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.

소스 파일 검토

설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.

SKILL.md 표시 중

SKILL.md
소스 지침 · 읽기 전용 미리보기
name
testing
description
Provides guidance and instructions for writing, running and filtering tests.
user-invocable
false
**IMPORTANT**: This repository uses TUnit with Microsoft.Testing.Platform (MTP v2). Traditional `--filter` syntax does NOT work. Use the options below instead. `test/Nerdbank.GitVersioning.Combinatorial.Tests` uses xunit v3 + MTP v2 for pairwise tests. Use `--filter-method`, `--filter-class`, and `--filter-not-trait` for that project, not `--treenode-filter`. Do not pass TUnit-only options to a solution-wide test run. * There should generally be one test project (under the `test` directory) per shipping project (under the `src` directory). Test projects are named after the project being tested with a `.Tests` suffix. * Tests use TUnit with Microsoft.Testing.Platform (MTP v2), while retaining xUnit assertions. Traditional VSTest `--filter` syntax does NOT work. ## Running Tests There *may* be unstable tests that are attributed as such. Running the [dotnet-test-cloud.ps1](../../../tools/dotnet-test-cloud.ps1) script will execute all previously built tests except the unstable ones. The commands below will *not* automatically exclude unstable tests. For TUnit projects, add `-- --treenode-filter "/**[Category!=FailsInCloudTest]"`; for the xunit project, add `-- --filter-not-trait "Category=FailsInCloudTest"`. **Run all tests** (from the root of the repository): ```bash dotnet test --no-build -c Release ``` To run a specific test project, change to that project's directory first; the commands below then target it without hard-coding its path. The framework examples below target `Nerdbank.GitVersioning.Tests`; use `net8.0` instead for `Cake.GitVersioning.Tests`. **Run tests for a specific test project** (within that test project's directory): ```bash dotnet test --no-build -c Release ``` **Run a single test method**: ```bash dotnet test --no-build -c Release -- --treenode-filter "/*/*/ClassName/MethodName" ``` **Run all tests in a test class**: ```bash dotnet test --no-build -c Release -- --treenode-filter "/*/*/ClassName/*" ``` **Run tests with wildcard matching** (supports wildcards at beginning and/or end): ```bash dotnet test --no-build -c Release -- --treenode-filter "/*/*/*/*Pattern*" ``` **Run tests with a specific property**: ```bash dotnet test --no-build -c Release -- --treenode-filter "/*/*/*/*[PropertyName=value]" ``` **Run tests for a specific framework only**: ```bash dotnet test --no-build -c Release --framework net10.0 ``` **List all available tests without running them**: ```bash dotnet run --no-build -c Release --framework net10.0 -- --list-tests ``` **Key points about test filtering with TUnit / MTP v2**: - Options after `--` are passed to the test runner, not to `dotnet test` - Use `--treenode-filter` to select tests by assembly, namespace, class, method, or property - Traditional VSTest `--filter` expressions do NOT work - Wildcards `*` are supported in tree node segments - See `--help` for query filter language for advanced scenarios
GitHub에서 보기