use this skill when creating new or reviewing xunit v3 test projects using Microsoft Testing Platform (MTP) to ensure best patterns, practices, and proper configuration
/plugin marketplace add rcmx/claude-plugins/plugin install dotnet-developer@rcmx-toolsThis skill inherits all available tools. When active, it can use any tool Claude has access to.
this skill provides guidance for creating and reviewing xunit v3 test projects that use Microsoft Testing Platform (MTP) for modern, performant test execution.
dotnet test integrationall xunit v3 MTP projects must include:
<PropertyGroup>
<!-- required: makes the test project executable -->
<OutputType>Exe</OutputType>
<!-- required: enables MTP for command-line execution -->
<UseMicrosoftTestingPlatformRunner>true</UseMicrosoftTestingPlatformRunner>
<!-- recommended: enables `dotnet test` support -->
<TestingPlatformDotnetTestSupport>true</TestingPlatformDotnetTestSupport>
<!-- recommended: shows test failures per test (has performance impact) -->
<TestingPlatformShowTestsFailure>true</TestingPlatformShowTestsFailure>
<!-- standard test project flags -->
<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
</PropertyGroup>
<ItemGroup>
<!-- core xunit v3 packages -->
<PackageReference Include="xunit.v3" Version="3.1.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.5" />
<!-- code coverage support -->
<PackageReference Include="Microsoft.Testing.Extensions.CodeCoverage" Version="17.10.1" />
<!-- optional: TRX reporting -->
<PackageReference Include="Microsoft.Testing.Extensions.TrxReport" Version="1.7.0" />
</ItemGroup>
<ItemGroup>
<Using Include="Xunit" />
</ItemGroup>
SolutionRoot/
├── src/
│ └── YourProject/
└── tests/
└── YourProject.Tests/ # test project
├── YourProject.Tests.csproj
├── testconfig.json # MTP configuration (optional)
├── UnitTests/ # organize by test type
├── IntegrationTests/
└── Fixtures/ # shared test fixtures
namespace YourProject.Tests.UnitTests;
// organize tests by the class they're testing
public class CalculatorTests
{
// use descriptive test method names that explain the scenario
[Fact]
public void Add_WithPositiveNumbers_ReturnsCorrectSum()
{
// arrange
var calculator = new Calculator();
// act
var result = calculator.Add(2, 3);
// assert
Assert.Equal(5, result);
}
// use theory for parameterized tests
[Theory]
[InlineData(2, 3, 5)]
[InlineData(-1, 1, 0)]
[InlineData(0, 0, 0)]
public void Add_WithVariousInputs_ReturnsCorrectSum(int a, int b, int expected)
{
var calculator = new Calculator();
var result = calculator.Add(a, b);
Assert.Equal(expected, result);
}
}
for MTP-specific configuration, create a testconfig.json file:
{
"Microsoft.Testing.Platform": {
"TelemetryOptOut": true,
"ExitProcessOnUnhandledException": false
}
}
# disable telemetry
TESTINGPLATFORM_TELEMETRY_OPTOUT=1
# enable diagnostic logging
TESTINGPLATFORM_DIAGNOSTIC=1
TESTINGPLATFORM_DIAGNOSTIC_OUTPUT_DIRECTORY=/path/to/logs
# run the test project directly as an executable
dotnet run --project YourProject.Tests
# or after building
./bin/Debug/net8.0/YourProject.Tests
# with MTP options
dotnet run --project YourProject.Tests -- --minimum-expected-tests 10
# standard execution
dotnet test
# with code coverage
dotnet test --coverage --coverage-output-format cobertura
# with TRX reporting
dotnet test -- --report-trx
# filter tests
dotnet test --filter "FullyQualifiedName~Calculator"
update package references:
xunit with xunit.v3Microsoft.NET.Test.Sdk (optional, but recommended)add MSBuild properties:
<OutputType>Exe</OutputType><UseMicrosoftTestingPlatformRunner>true</UseMicrosoftTestingPlatformRunner><TestingPlatformDotnetTestSupport>true</TestingPlatformDotnetTestSupport>update code coverage:
coverlet.collector with Microsoft.Testing.Extensions.CodeCoverage--coverage instead of /p:CollectCoverage=trueupdate CI/CD pipelines:
dotnet test commandsduring migration, you can maintain both VSTest and MTP support:
Microsoft.NET.Test.Sdk package referencesolution: ensure TestingPlatformDotnetTestSupport is set to true in the project file.
solution: add Microsoft.Testing.Extensions.CodeCoverage package and use --coverage flag.
solution: ensure Visual Studio 2022 version is 17.14.16 or later, and rebuild the solution.
solution: this property has a performance impact. disable it for large test suites:
<TestingPlatformShowTestsFailure>false</TestingPlatformShowTestsFailure>
when reviewing xunit v3 MTP projects, verify:
OutputType is set to ExeUseMicrosoftTestingPlatformRunner is set to trueTestingPlatformDotnetTestSupport is set to true (if using dotnet test)async Task instead of async voidThis skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.