Analyzes the variety and depth of assertions across .NET test suites.
MTP Hot Reload for Iterative Test Fixing
Suggests using Microsoft Testing Platform (MTP) hot reload to iterate fixes on failing tests without rebuilding. Use when user says "hot reload tests", "iterate on test fix", "run tests without rebuilding", "speed up test loop", "fix test faster", or needs to set up MTP hot reload to rapidly iterate on test failures. Covers setup (NuGet package, environment variable, launchSettings.json) and the iterative workflow for fixing tests. DO NOT USE FOR: writing test code, diagnosing test failures, CI/CD pipeline configuration, or Visual Studio Test Explorer hot reload (which is a different feature).
Workflow
Step 1: Verify the project uses Microsoft Testing Platform
Hot reload requires MTP. It does not work with VSTest.
Follow the detection procedure in the platform-detection skill to determine the test platform.
If the project uses VSTest, inform the user that MTP hot reload is not available and suggest migrating to MTP first (see migrate-vstest-to-mtp), or using Visual Studio's built-in Test Explorer hot reload feature instead.
Step 2: Add the hot reload NuGet package
Install the Microsoft.Testing.Extensions.HotReload package:
dotnet add <project-path> package Microsoft.Testing.Extensions.HotReload
> Note: When using Microsoft.Testing.Platform.MSBuild (included transitively by MSTest, NUnit, and xUnit runners), the extension is auto-registered when you install its NuGet package -- no code changes needed.
Step 3: Enable hot reload
Hot reload is activated by setting the TESTINGPLATFORM_HOTRELOAD_ENABLED environment variable to 1.
Option A -- Set it in the shell before running tests:
# PowerShell
$env:TESTINGPLATFORM_HOTRELOAD_ENABLED = "1"
# bash/zsh
export TESTINGPLATFORM_HOTRELOAD_ENABLED=1
Option B -- Add it to `launchSettings.json` (recommended for repeatable use):
Create or update Properties/launchSettings.json in the test project:
{
"profiles": {
"<ProjectName>": {
"commandName": "Project",
"environmentVariables": {
"TESTINGPLATFORM_HOTRELOAD_ENABLED": "1"
}
}
}
}
Step 4: Run the tests with hot reload
Run the test project directly (not through dotnet test) to use hot reload in console mode:
dotnet run --project <project-path>
To filter to specific failing tests, pass the filter after --. The syntax depends on the test framework -- see the filter-syntax skill for full details. Quick examples:
| Framework | Filter syntax | |-----------|--------------| | MSTest | dotnet run --project <path> -- --filter "FullyQualifiedName~TestMethodName" | | NUnit | dotnet run --project <path> -- --filter "FullyQualifiedName~TestMethodName" | | xUnit v3 | dotnet run --project <path> -- --filter-method "*TestMethodName" | | TUnit | dotnet run --project <path> -- --treenode-filter "/*/*/ClassName/TestMethodName" |
The test host will start, run the tests, and remain running waiting for code changes.
Step 5: Iterate on the fix
- Edit the source code (test code or production code) in your editor
- The test host detects the changes and re-runs the affected tests automatically
- Review the updated results in the console
- Repeat until all targeted tests pass
> Important: Hot reload currently works in console mode only. There is no support for hot reload in Test Explorer for Visual Studio or Visual Studio Code.
Step 6: Finalize
Once all tests pass:
- Stop the test host (Ctrl+C)
- Run a full
dotnet testto confirm all tests pass with a clean build - Optionally remove
TESTINGPLATFORM_HOTRELOAD_ENABLEDfrom the environment or keeplaunchSettings.jsonfor future use
Related skills
Reference data for .NET test framework detection patterns, assertion APIs, skip annotations, setup/teardown methods, and common test smell indicators across MSTest, xUnit, NUnit…
Audits .NET test mock usage by tracing each mock setup through the production code's execution path to find dead, unreachable, redundant, or replaceable mocks.