Skill page Testing v1.0.0

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.

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

  1. Detect the MSTest project style first:

- MSTest.Sdk project SDK - MSTest meta-package - legacy package set with explicit Microsoft.NET.Test.Sdk

  1. Read the repo's real test command from AGENTS.md. If the repo has no explicit command yet, start with dotnet test PROJECT_OR_SOLUTION.
  2. 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

  1. Prefer [DataRow] or DynamicData for stable data-driven coverage. Keep test lifecycle hooks minimal and deterministic.
  2. Keep MSTest analyzers enabled and fix findings instead of muting them casually.
  3. 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

Use the open-source free `ReportGenerator` tool for turning .NET coverage outputs into HTML, Markdown, Cobertura, badges, and merged reports.

dotnet skills install reportgenerator