Use the open-source free `coverlet` toolchain for .NET code coverage.
MSTest
Write, run, or repair .NET tests that use MSTest. Use when a repo uses `MSTest.Sdk`, `MSTest`, `[TestClass]`, `[TestMethod]`, `DataRow`, or Microsoft.Testing.Platform-based MSTest execution. USE FOR: the repo uses MSTest; you need to add, run, debug, or repair MSTest tests; the repo is moving between VSTest and Microsoft.Testing.Platform. DO NOT USE FOR: xUnit projects; TUnit projects. INVOKES: inspect the repository context, edit targeted files, and run relevant build, test, lint, or validation commands when changes are made.
Trigger On
- the repo uses MSTest
- you need to add, run, debug, or repair MSTest tests
- the repo is moving between VSTest and Microsoft.Testing.Platform
Workflow
- Detect the MSTest project style first:
- MSTest.Sdk project SDK - MSTest meta-package - legacy package set with explicit Microsoft.NET.Test.Sdk
- Read the repo's real
testcommand fromAGENTS.md. If the repo has no explicit command yet, start withdotnet test PROJECT_OR_SOLUTION. - Keep the runner model consistent:
- MSTest.Sdk defaults to the MSTest runner on Microsoft.Testing.Platform - VSTest is opt-in with UseVSTest=true or legacy package choices - do not pass VSTest-only switches or assume legacy .runsettings behavior on Microsoft.Testing.Platform jobs
- Prefer
[DataRow]orDynamicDatafor stable data-driven coverage. Keep test lifecycle hooks minimal and deterministic. - Keep MSTest analyzers enabled and fix findings instead of muting them casually.
- Align coverage/reporting packages with the active runner.
Deliver
- MSTest tests that match the repo's runner model
- commands that work in local and CI runs
- explicit guidance for VSTest versus Microsoft.Testing.Platform usage
Validate
- the runner model is documented and consistent
- test commands match that runner
- data-driven tests stay deterministic
- analyzer, coverage, and reporting packages align with the chosen runner
Load References
Related skills
Write, run, or repair .NET tests that use NUnit.
Analyzes the variety and depth of assertions across .NET test suites.