dotnet-mstest

Write, run, and repair .NET tests using the MSTest framework and runner models.

Updated Mar 31, 2026
One-click install
npx skills add https://github.com/zhenpengLai/myuseskill --skill dotnet-mstest-zhenpenglai
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: dotnet-mstest
Source: https://github.com/zhenpengLai/myuseskill/tree/main/dotnet-mstest
Command: npx skills add https://github.com/zhenpengLai/myuseskill --skill dotnet-mstest-zhenpenglai

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? .NET teams using MSTest often struggle with inconsistent runner configurations, mixing VSTest and Microsoft.Testing.Platform patterns, and writing flaky or duplicated tests. This Skill provides a structured workflow to detect the repo's MSTest setup, write correct tests, and keep commands consistent across local and CI runs. ## Core Features & Use Cases - Runner Model Detection: Identifies whether a project uses MSTest.Sdk, the MSTest meta-package, or legacy VSTest packages, and keeps commands aligned with that model. - Test Authoring Guidance: Provides patterns for [DataRow], DynamicData, lifecycle hooks, async tests, and assertions, plus a catalog of anti-patterns to avoid. - Bootstrap and Migration Support: Adds MSTest packages to projects lacking them and documents VSTest versus Microsoft.Testing.Platform choices in AGENTS.md. - Use Case: A developer asks to fix a broken MSTest CI pipeline; the Skill detects the runner model, corrects the test commands, aligns coverage packages, and returns verification evidence. ## Quick Start Ask the AI to add or fix MSTest tests in your .NET project and have it run the repo's test command to verify the results.

Frequently Asked Questions about dotnet-mstest

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

FAQPage Schema
How do I add MSTest to an existing .NET test project?▼

Run dotnet add TEST_PROJECT.csproj package MSTest to add the MSTest meta-package, which includes the framework, adapter, and analyzers. Then run dotnet test on the project and document the runner model in AGENTS.md.

What is the difference between MSTest.Sdk and VSTest?▼

MSTest.Sdk is the modern project SDK that uses Microsoft.Testing.Platform as the default runner, while VSTest is the legacy runner opted into with UseVSTest=true. VSTest-only switches and .runsettings assumptions do not apply on Microsoft.Testing.Platform jobs.

How do I write data-driven tests in MSTest?▼

Use [DataRow] attributes on a [TestMethod] for inline test data, or [DynamicData] pointing to a property or method returning IEnumerable<object[]> for complex cases. This replaces duplicated test methods with a single parameterized test.

Can I use this Skill with xUnit or TUnit projects?▼

No, it is scoped to MSTest only. If the repo uses xUnit or TUnit, the Skill returns status not_applicable and does not auto-migrate unless migration to MSTest is explicitly requested.

Why do my MSTest tests fail after moving to Microsoft.Testing.Platform?▼

Failures usually come from mixing VSTest-specific patterns like DeploymentItem or legacy .runsettings behavior with the new runner. Use runner-agnostic approaches such as embedded resources or paths relative to AppContext.BaseDirectory instead.