run-tests

Detects the .NET test platform and framework, then runs dotnet test with correct flags and filters.

Updated Jul 12, 2026
One-click install
npx skills add https://github.com/Patrick-Rex/DotNetTechSamples --skill run-tests-patrick-rex
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: run-tests
Source: https://github.com/Patrick-Rex/DotNetTechSamples/tree/main/.agents/plugins/dotnet-test/skills/run-tests
Command: npx skills add https://github.com/Patrick-Rex/DotNetTechSamples --skill run-tests-patrick-rex

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? The correct dotnet test syntax depends on the test platform (VSTest vs Microsoft.Testing.Platform), the test framework (MSTest, xUnit, NUnit, TUnit), and the SDK version, and getting it wrong produces unrecognized-flag errors or silently skipped tests. This Skill detects the setup and produces the exact command, including the -- separator rules and platform-specific filter syntax. ## Core Features & Use Cases - Platform and framework detection: Inspects global.json, .csproj, Directory.Build.props, and Directory.Packages.props to determine VSTest vs MTP and MSTest/xUnit/NUnit/TUnit. - Correct command generation: Applies SDK-version rules such as the -- separator on SDK 8/9, direct MTP args on SDK 10+, --logger trx vs --report-trx, and --blame vs --blame-crash/--blame-hang-timeout. - Filtered test runs: Translates requests like "run the integration tests" into the right filter (--filter, --filter-class, --filter-trait, --filter-query, --treenode-filter) for the detected framework. - Use Case: A user asks to run only the smoke tests in a multi-TFM xUnit v3 project on .NET 10; the Skill detects MTP from global.json and produces dotnet test --project <path> --framework net10.0 --filter-trait "Category=Smoke". ## Quick Start Ask the assistant to run the tests in your .NET project, optionally naming a specific class, category, or target framework to filter.

Frequently Asked Questions about run-tests

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I run only specific tests with dotnet test?

Use a filter matched to your platform. VSTest and MTP with MSTest or NUnit use `--filter "TestCategory=Integration"`, xUnit v3 on MTP uses `--filter-class`, `--filter-method`, or `--filter-trait`, and TUnit uses `--treenode-filter` with path-based syntax.

What is the difference between VSTest and Microsoft.Testing.Platform for dotnet test?

VSTest uses flags like `--logger trx` and `--blame`, while MTP uses `--report-trx`, `--blame-crash`, and `--blame-hang-timeout` with extension packages. On SDK 8/9 MTP args go after `--`; on SDK 10+ they pass directly without the separator.

How do I detect whether my project uses VSTest or Microsoft.Testing.Platform?

Check `global.json` for `"test": { "runner": "Microsoft.Testing.Platform" }` on SDK 10+, or `<TestingPlatformDotnetTestSupport>true</TestingPlatformDotnetTestSupport>` in `.csproj` or `Directory.Build.props` on SDK 8/9. If neither signal is present, the project uses VSTest.

Why does dotnet test say the --report-trx option is unrecognized?

The `--report-trx` flag requires the `Microsoft.Testing.Extensions.TrxReport` package on MTP projects, and it does not exist on VSTest at all. For VSTest projects use `--logger trx` instead.

Does dotnet test need the -- separator on .NET 10?

No. On .NET SDK 10+ with MTP configured in `global.json`, MTP arguments pass directly, for example `dotnet test --project . --report-trx`. The `--` separator is only required on SDK 8 and 9.

How do I run tests for a single target framework in a multi-TFM project?

Pass `--framework <TFM>` such as `--framework net8.0` to select one target framework. This flag is consumed by `dotnet test` itself, so it always goes before the `--` separator on SDK 8/9 MTP projects.