Source profileQuality 97/100

dotnet/skills/plugins/dotnet-test/skills/run-tests/SKILL.md

run-tests

Run or recommend the exact .NET test command. ALWAYS USE when asked to run, filter, or troubleshoot .NET tests or provide precise flags/argument order. Supports SDK-style dotnet test and classic non-SDK projects using MSBuild plus vstest.console/MSTest or repository scripts. USE FOR: all tests or subsets by class/category/trait; multi-TFM --framework; TRX reports; crash/hang dumps; VSTest vs Microsoft.Testing.Platform; bridged vs native MTP argument syntax; --filter, --filter-class, --filter-tra

Source repository stars
5,248
Declared platforms
0
Static risk flags
1
Last source update
2026-08-26
Source checked
2026-08-26

Decision brief

What it does: where it fits

Detect the project system, test platform, and framework, then use the repository-compatible build and test runner.

Best for

  • User wants to run tests in a .NET project
  • User needs to run a subset of tests using filters
  • User needs help detecting which test platform (VSTest vs MTP) or framework is in use

Not for

  • User needs to write or generate test code (use code-testing-agent; use
  • User needs to migrate from VSTest to MTP (use migrate-vstest-to-mtp)

Compatibility matrix

Platform support, with evidence labels

PlatformStatusEvidenceWhat to check
CodexNot declaredNo explicit evidencePortability before use
Claude CodeNot declaredNo explicit evidencePortability before use
CursorNot declaredNo explicit evidencePortability before use
Gemini CLINot declaredNo explicit evidencePortability before use
Open the compatibility checker

Installation

Inspect first. Install second.

The source command is displayed only when detected. A safe inspection prompt is always available so your agent can explain every action before execution.

Source-detected install commandSource
npx skills add https://github.com/dotnet/skills --skill "plugins/dotnet-test/skills/run-tests"
Safe inspection promptEditorial

Inspect the Agent Skill "run-tests" from https://github.com/dotnet/skills/blob/1b896e91feb0f613cb54a914f1efd2897810ae02/plugins/dotnet-test/skills/run-tests/SKILL.md at commit 1b896e91feb0f613cb54a914f1efd2897810ae02. List every install step, command, network request, credential, file read/write, external action, and rollback step. Explain whether it fits my task. Do not install or execute anything until I approve.

Workflow

What the source asks the agent to do

  1. 01

    Workflow

    Detection files to always check (in order): global.json - .csproj - packages.config - Directory.Build.props - Directory.Packages.props - repository scripts/CI documentation

    Classify SDK-style vs. classic non-SDK using platform-detection.For classic projects, inspect packages.config, assembly references, scripts,For SDK-style projects, run dotnet --version in the project directory.
  2. 02

    Step 1: Detect the test platform and framework

    1. Classify SDK-style vs. classic non-SDK using platform-detection. 2. For classic projects, inspect packages.config, assembly references, scripts, CI, README, and AGENTS.md; use their MSBuild/test-runner command. Do not migrate or add modern package references. 3. For SDK-style…

    Classify SDK-style vs. classic non-SDK using platform-detection.For classic projects, inspect packages.config, assembly references, scripts,For SDK-style projects, run dotnet --version in the project directory.
  3. 03

    Step 2: Run tests

    With true, dotnet test bridges to MTP but uses VSTest-style argument parsing. This applies to SDK 8/9 and SDK 10+ when global runner is VSTest or unset. MTP-specific arguments must be passed after --:

    With true, dotnet test bridges to MTP but uses VSTest-style argument parsing. This applies to SDK 8/9 and SDK 10+ when global runner is VSTest or unset. MTP-specific arguments must be passed after --:With the global.json runner set to Microsoft.Testing.Platform, dotnet test natively understands MTP arguments without --:
  4. 04

    Step 3: Run filtered tests

    See the filter-syntax skill for the complete filter syntax for each platform and framework combination. Key points:

    VSTest (MSTest, xUnit v2, NUnit): dotnet test --filter with =, !=, , ! operatorsMTP -- MSTest and NUnit: Same --filter syntax as VSTest; pass after -- in VSTest mode and directly in native MTP mode.MTP -- xUnit v3: Uses --filter-class, --filter-method, --filter-trait (not VSTest expression syntax). For a single combined expression (e.g., a class-name pattern AND a trait), use --filter-query with the xUnit v3 query…
  5. 05

    When to Use

    User wants to run tests in a .NET project

    User wants to run tests in a .NET projectUser needs to run a subset of tests using filtersUser needs help detecting which test platform (VSTest vs MTP) or framework is in use

Permission review

Static risk signals and limitations

Reads files

low · line 72

The documentation asks the agent to read local files, directories, or repositories.

Read `.csproj`, `Directory.Build.props`, and `Directory.Packages.props` to

Evidence record

Why each signal appears

EvidenceSourceComputedTestedEditorial
SignalValueEvidence typeMeaning
Quality score97/100ComputedDocumentation, specificity, maintenance, and trust rules
Repository stars5,248SourceRepository attention, not individual Skill quality
Compatibility0 platformsSourceDeclared in the catalog source record
Usage guideautomated source guideEditorialGenerated or reviewed according to the visible evidence level

Pinned source

Provenance and original SKILL.md

Repository
dotnet/skills
Skill path
plugins/dotnet-test/skills/run-tests/SKILL.md
Commit
1b896e91feb0f613cb54a914f1efd2897810ae02
License
MIT
Collected
2026-08-26
Default branch
main
View the original SKILL.md

Run .NET Tests

Detect the project system, test platform, and framework, then use the repository-compatible build and test runner.

When to Use

  • User wants to run tests in a .NET project
  • User needs to run a subset of tests using filters
  • User needs help detecting which test platform (VSTest vs MTP) or framework is in use
  • User wants to understand the correct filter syntax for their setup

When Not to Use

  • User needs to write or generate test code (use code-testing-agent; use writing-mstest-tests for a specifically MSTest API/pattern request)
  • User needs to migrate from VSTest to MTP (use migrate-vstest-to-mtp)
  • User wants to iterate on failing tests without rebuilding (use mtp-hot-reload)
  • User needs CI/CD pipeline configuration (use CI-specific skills)
  • User needs to debug a test (use debugging skills)

Inputs

InputRequiredDescription
Project or solution pathNoPath to the test project (.csproj) or solution (.sln, .slnf, .slnx). Defaults to current directory.
Filter expressionNoFilter expression to select specific tests
Target frameworkNoTarget framework moniker to run against (e.g., net8.0)

Critical Rules — Avoid Cross-Platform Mistakes

These are the most common agent mistakes. Internalize before proceeding:

RuleWhy
Do NOT assume dotnet test for classic non-SDK projectsToolsVersion, explicit compile items, and packages.config often require full MSBuild plus VSTest/MSTest or a repository script
Do NOT use --logger trx for MTP projectsMTP uses --report-trx (requires the TrxReport extension package)
Do NOT use --report-trx for VSTest projectsVSTest uses --logger trx
Do NOT choose argument syntax from SDK version aloneOn SDK 10+, only native MTP mode passes MTP args directly; VSTest mode bridging to MTP still uses --
Do NOT omit -- in VSTest mode with MTPSDK 8/9, and SDK 10 with runner VSTest/unset, require dotnet test -- --report-trx when the bridge is enabled
Do NOT use --filter "ClassName=..." with xUnit v3 on MTPxUnit v3 on MTP uses --filter-class, --filter-method, --filter-trait
Do NOT use bare positional path in native MTP modeUse --project <path> or --solution <path>; VSTest mode retains positional paths
Do NOT use --blame for MTP projectsMTP uses --blame-crash and --blame-hang-timeout separately (each requires its extension package)
Do NOT use --collect "Code Coverage" for MTPMTP uses --coverage (requires the CodeCoverage extension package)

Workflow

Quick Reference

dotnet test mode / platformSDKCommand pattern
Classic non-SDK / VSTest or MSTestn/aRepository script, or MSBuild followed by vstest.console.exe / MSTest.exe
VSTest mode / VSTestAnydotnet test [<path>] [--filter <expr>] [--logger trx]
VSTest mode / MTP bridge8+dotnet test [<path>] -- <MTP_ARGS>
Native MTP mode10+dotnet test --project <path> <MTP_ARGS>

Detection files to always check (in order): global.json -> .csproj -> packages.config -> Directory.Build.props -> Directory.Packages.props -> repository scripts/CI documentation

If the prompt names a subset of tests (e.g., "integration tests", "smoke tests", a specific class, a specific TFM), plan to apply the matching filter / --framework in Step 3 — do not run the whole suite.

Step 1: Detect the test platform and framework

  1. Classify SDK-style vs. classic non-SDK using platform-detection.
  2. For classic projects, inspect packages.config, assembly references, scripts, CI, README*, and AGENTS.md; use their MSBuild/test-runner command. Do not migrate or add modern package references.
  3. For SDK-style projects, run dotnet --version in the project directory.
  4. Read global.json to determine dotnet test mode on SDK 10+.
  5. Read .csproj, Directory.Build.props, and Directory.Packages.props to determine whether VSTest mode executes VSTest or bridges to MTP.

Classic non-SDK projects

The checked-in command is authoritative. A common VSTest sequence is:

MSBuild.exe MySolution.sln /t:Build /p:Configuration=Debug
vstest.console.exe path\to\MyTests.dll /Logger:trx

Filtering uses the runner's syntax, for example /TestCaseFilter:"TestCategory=Integration" with VSTest. Older repositories may use MSTest.exe or a wrapper script instead. If the required Visual Studio toolchain is unavailable, report the exact missing prerequisite and the documented command; do not claim success from dotnet test.

What to look for in each file:

FileLook forIndicates
global.json"test": { "runner": "Microsoft.Testing.Platform" }Native MTP mode on SDK 10+
global.json"sdk": { "version": "..." }SDK version (determines -- separator behavior)
.csprojMTP runner enabled + <TestingPlatformDotnetTestSupport>trueVSTest mode redirects the MTP application to MTP
.csprojMSTest, xunit.v3, NUnit, TUnit packagesFramework identity
.csprojMicrosoft.NET.Test.Sdk + test adapterVSTest (unless overridden by MTP signals above)
.csproj<TargetFrameworks> (plural)Multi-TFM — may need --framework
Directory.Build.propsMTP runner enabled + <TestingPlatformDotnetTestSupport>trueVSTest mode redirects the MTP application to MTP
Directory.Packages.propsCentrally managed test package versionsFramework identity for CPM repos

Quick detection summary:

SignalMeans
SDK 10+ global runner is Microsoft.Testing.PlatformNative MTP mode — pass args directly
MTP-capable project + VSTest mode + TestingPlatformDotnetTestSupport=trueMTP bridge — pass MTP args after --
VSTest mode without the bridgeVSTest

Step 2: Run tests

SDK-style VSTest (any .NET SDK version)

dotnet test [<PROJECT> | <SOLUTION> | <DIRECTORY> | <DLL> | <EXE>]

Common flags:

FlagDescription
--framework <TFM>Target a specific framework in multi-TFM projects (e.g., net8.0)
--no-buildSkip build, use previously built output
--filter <EXPRESSION>Run selected tests (see Step 3)
--logger trxGenerate TRX results file
--collect "Code Coverage"Collect code coverage using Microsoft Code Coverage (built-in, always available)
--blameEnable blame mode to detect tests that crash the host
--blame-crashCollect a crash dump when the test host crashes
--blame-hang-timeout <duration>Abort test if it hangs longer than duration (e.g., 5min)
-v <level>Verbosity: quiet, minimal, normal, detailed, diagnostic

MTP through VSTest mode

With <TestingPlatformDotnetTestSupport>true</TestingPlatformDotnetTestSupport>, dotnet test bridges to MTP but uses VSTest-style argument parsing. This applies to SDK 8/9 and SDK 10+ when global runner is VSTest or unset. MTP-specific arguments must be passed after --:

dotnet test [<PROJECT> | <SOLUTION> | <DIRECTORY> | <DLL> | <EXE>] -- <MTP_ARGUMENTS>

Native MTP mode with .NET SDK 10+

With the global.json runner set to Microsoft.Testing.Platform, dotnet test natively understands MTP arguments without --:

dotnet test
    [--project <PROJECT_OR_DIRECTORY>]
    [--solution <SOLUTION_OR_DIRECTORY>]
    [--test-modules <EXPRESSION>]
    [<MTP_ARGUMENTS>]

Examples:

# Run all tests in a project
dotnet test --project path/to/MyTests.csproj

# Run all tests in a directory containing a project
dotnet test --project path/to/

# Run all tests in a solution (sln, slnf, slnx)
dotnet test --solution path/to/MySolution.sln
dotnet test --solution path/to/MySolution.slnf
dotnet test --solution path/to/MySolution.slnx

# Run all tests in a directory containing a solution
dotnet test --solution path/to/

# Run with MTP flags
dotnet test --project path/to/MyTests.csproj --report-trx --blame-hang-timeout 5min

Note: Native MTP mode does not accept a bare positional argument like VSTest mode. Use --project, --solution, or --test-modules.

Common MTP flags

These flags apply to MTP in both modes. Pass them after -- in VSTest mode and directly in native MTP mode.

Important: dotnet test/MSBuild flags such as --framework, --no-build, --configuration, and --verbosity always go before --. Only MTP application arguments go after -- in VSTest mode. For example: dotnet test --framework net9.0 -- --report-trx.

Built-in flags (always available):

FlagDescription
--results-directory <DIR>Directory for test result output
--diagnosticEnable diagnostic logging for the test platform
--diagnostic-output-directory <DIR>Directory for diagnostic log output

Extension-dependent flags (require the corresponding extension package to be registered):

FlagRequiresDescription
--filter <EXPRESSION>Framework-specific (not all frameworks support this)Run selected tests (see Step 3)
--report-trxMicrosoft.Testing.Extensions.TrxReportGenerate TRX results file
--report-trx-filename <FILE>Microsoft.Testing.Extensions.TrxReportSet TRX output filename
--blame-hang-timeout <duration>Microsoft.Testing.Extensions.HangDumpAbort test if it hangs longer than duration (e.g., 5min)
--blame-crashMicrosoft.Testing.Extensions.CrashDumpCollect a crash dump when the test host crashes
--coverageMicrosoft.Testing.Extensions.CodeCoverageCollect code coverage using Microsoft Code Coverage

Some frameworks (e.g., MSTest) bundle common extensions by default. Others may require explicit package references. If a flag is not recognized, check that the corresponding extension package is referenced in the project.

Alternative MTP invocations

MTP test projects are standalone executables. Beyond dotnet test, they can be run directly:

# Build and run
dotnet run --project <PROJECT_PATH>

# Run a previously built DLL
dotnet exec <PATH_TO_DLL>

# Run the executable directly (Windows)
<PATH_TO_EXE>

These alternative invocations accept MTP command line arguments directly (no -- separator needed).

Step 3: Run filtered tests

See the filter-syntax skill for the complete filter syntax for each platform and framework combination. Key points:

  • VSTest (MSTest, xUnit v2, NUnit): dotnet test --filter <EXPRESSION> with =, !=, ~, !~ operators
  • MTP -- MSTest and NUnit: Same --filter syntax as VSTest; pass after -- in VSTest mode and directly in native MTP mode.
  • MTP -- xUnit v3: Uses --filter-class, --filter-method, --filter-trait (not VSTest expression syntax). For a single combined expression (e.g., a class-name pattern AND a trait), use --filter-query with the xUnit v3 query filter language: path segments /<assembly>/<namespace>/<class>/<method> with * wildcards and a [Trait=Value] qualifier — for example dotnet test -- --filter-query "/*/*/*IntegrationTests*/*[Category=Smoke]". See the filter-syntax skill for the full query language.
  • MTP -- TUnit: Uses --treenode-filter with path-based syntax

When the user names a test category, trait, or group

When the prompt names a subset of tests by category (e.g., "integration tests", "unit tests", "smoke tests", "fast tests"), do not run all tests — translate the user's vocabulary into the platform-appropriate filter:

  1. Inspect the test source files for filter-attribute annotations that match the named group:

    FrameworkAttributeFilter property
    MSTest[TestCategory("Integration")]TestCategory
    NUnit[Category("Integration")]TestCategory (mapped)
    xUnit v2[Trait("Category", "Integration")]Category
    xUnit v3[Trait("Category", "Integration")]Category (use --filter-trait)
    TUnit[Category("Integration")]Category
  2. Build the filter expression and combine it with the platform-correct invocation. For "run the integration tests" against an MSTest project:

    Mode / platformFrameworkCommand
    VSTest mode / VSTestMSTestdotnet test --filter "TestCategory=Integration"
    VSTest mode / MTP bridgeMSTestdotnet test -- --filter "TestCategory=Integration"
    Native MTP modeMSTestdotnet test --filter "TestCategory=Integration"
    VSTest mode / MTP bridgexUnit v3dotnet test -- --filter-trait "Category=Integration"
    Native MTP modexUnit v3dotnet test --filter-trait "Category=Integration"
    VSTest mode / MTP bridgeTUnitdotnet test -- --treenode-filter "/*/*/*/*[Category=Integration]"
    Native MTP modeTUnitdotnet test --treenode-filter "/*/*/*/*[Category=Integration]"
  3. If you cannot find a matching attribute, ask the user to confirm the category name or fall back to a name-pattern filter (e.g., --filter "FullyQualifiedName~Integration").

Validation

  • Test platform (VSTest or MTP) was correctly identified
  • Project system (SDK-style or classic non-SDK) was correctly identified
  • Test framework (MSTest, xUnit, NUnit, TUnit) was correctly identified
  • Correct repository-compatible runner was used; dotnet test syntax was validated only for SDK-style projects
  • When the user named a test category/trait/group, the appropriate filter was applied (not "run all tests")
  • Filter expressions used the syntax appropriate for the platform and framework
  • Test results were clearly reported to the user

Common Pitfalls

PitfallSolution
Running dotnet test on a classic packages.config projectUse its documented MSBuild and VSTest/MSTest command; do not modernize implicitly
Missing Microsoft.NET.Test.Sdk in an SDK-style VSTest projectTests won't be discovered. Add the SDK-style package reference. For classic projects, preserve packages.config and use the installed adapter/test runner instead
Using VSTest --filter syntax with xUnit v3 on MTPxUnit v3 on MTP uses --filter-class, --filter-method, etc. -- not the VSTest expression syntax
Passing MTP args without -- on .NET SDK 8/9Before .NET 10, MTP args must go after --: dotnet test -- --report-trx
Assuming every SDK 10 invocation is native MTP modeRead global.json; SDK 10 VSTest mode still uses the bridge and -- for MTP arguments
Using --logger trx for MTP or --report-trx for VSTestEach platform has its own TRX flag — check the Critical Rules table
Only checking .csproj for MTP signalsAlways check Directory.Build.props and Directory.Packages.props too — MTP properties are frequently set there
Using bare positional path in native MTP modeUse --project <path> or --solution <path>

Troubleshooting

Common error messages and how to resolve them:

ErrorCauseFix
No test is available or No test matches the given testcase filterWrong filter syntax for the platform/framework, or tests not discoveredVerify filter syntax matches the platform (see filter-syntax skill). For discovery issues, check that the test SDK and adapter packages are installed
The --report-trx option is unrecognizedMTP extension package not referenced, or using MTP flag on a VSTest projectAdd <PackageReference Include="Microsoft.Testing.Extensions.TrxReport" /> for MTP, or use --logger trx for VSTest
The --blame-hang-timeout option is unrecognizedMissing HangDump extension on MTPAdd <PackageReference Include="Microsoft.Testing.Extensions.HangDump" />
error NETSDK1045: The current .NET SDK does not support targeting .NET X.0SDK version in global.json doesn't match the project's target frameworkUpdate global.json SDK version or install the required SDK
The test runner process exited with non-zero exit codeMTP test host crashed or test failureRun with --blame-crash (MTP) or --blame (VSTest) to collect a crash dump for diagnosis
No test source files were found / No test project founddotnet test can't find a test project in the given pathSpecify dotnet test <project.csproj> in VSTest mode or dotnet test --project <path> in native MTP mode
Tests discovered but 0 executedFilter expression matches no testsDouble-check filter property names and values. Common typo: TestCategory (MSTest) vs Category (NUnit) vs trait syntax (xUnit)
Using native MTP argument syntax while global.json selects VSTest modeUse the bridge syntax with --; pass arguments directly only in native MTP mode
Multi-TFM project runs tests for all frameworksUse --framework <TFM> to target a specific framework
global.json runner setting ignoredRequires .NET 10+ SDK. On older SDKs, use <TestingPlatformDotnetTestSupport> MSBuild property instead
TUnit --treenode-filter not recognizedTUnit is MTP-only. Use native MTP mode, a configured bridge, or run the test executable directly

Frequently asked questions

What to verify before installation and use

What does the run-tests source document cover?

Detect the project system, test platform, and framework, then use the repository-compatible build and test runner.

How do I install run-tests?

The source record exposes this install command: npx skills add https://github.com/dotnet/skills --skill "plugins/dotnet-test/skills/run-tests". Inspect the command and pinned source before running it.

Which permission-related actions were detected?

Static rules flagged read-files in the source; the page lists the matching lines and excerpts.

Alternatives

Compare before choosing

Computed 10029,095

garrytan/gbrain

bulk-ingestion

End-to-end discipline for turning any large data source (audio libraries, email takeouts, document corpora, chat exports, API dumps) into brain pages at scale. The lifecycle spine: SCHEMA → ACCESS → TRIAL → EVALUATE → IMPROVE → CODIFY → TEST → SKILLIFY → BULK → MONITOR. State is tracked in a durable JSON manifest (see MANIFEST-PATTERN.md) so any crash, session boundary, or subagent fan-out resumes from ground truth instead of memory.

Computed 10024,975

alirezarezvani/claude-skills

app-store-optimization

App Store Optimization (ASO) toolkit for researching keywords, analyzing competitor rankings, generating metadata suggestions, and improving app visibility on Apple App Store and Google Play Store. Use when the user asks about ASO, app store rankings, app metadata, app titles and descriptions, app store listings, app visibility, or mobile app marketing on iOS or Android. Supports keyword research and scoring, competitor keyword analysis, metadata optimization, A/B test planning, launch checklist

Computed 1005,248

dotnet/skills

migrate-vstest-to-mtp

Migrates .NET test projects from VSTest to Microsoft.Testing.Platform (MTP). Use when user asks to "migrate to MTP", "switch from VSTest", "enable Microsoft.Testing.Platform", "use MTP runner", set OutputType=Exe only for test projects in Directory.Build.props, or mentions EnableMSTestRunner, EnableNUnitRunner, or UseMicrosoftTestingPlatformRunner. USE FOR: MTP behavioral differences vs VSTest (exit code 8, zero tests discovered, --ignore-exit-code, TESTINGPLATFORM_EXITCODE_IGNORE); centralizing

Computed 991,259

vipshop/cache-dit

cache-dit-model-integration

High-level guide for integrating a new DiT model into cache-dit: Cache (BlockAdapter/ForwardPattern), Context Parallelism, Tensor Parallelism, Text Encoder Parallelism (TE-P), VAE Parallelism (VAE-P), generate CLI, installation, testing workflow, and detailed references. Use when adding support for a new diffusion transformer model in cache-dit.