TUnit tests for .NET
Writes, runs and fixes TUnit tests in .NET, or moves xUnit and NUnit tests across, so your suite runs cleanly.
What we improved
Added working test code to SKILL.md: a test class with Arguments, MethodDataSource, an exception assertion and a Timeout test that takes the CancellationToken, plus a shared PerTestSession fixture with IAsyncInitializer and per-test unique
Improved by YourAISkill from the original by managedcode, under its MIT licence. The download includes the author's licence and a CHANGES.md listing every change. Both Claude reviews read the improved version.
Claude's review
8/10 Current TUnit guide covering MTP versus VSTest commands, treenode filters, awaited assertions, shared fixtures, parallelism discipline and a detailed migration reference.
We asked Claude the question you would ask: would I be glad I installed this? Two separate reviews, the second blind to the first, must both rate a skill 7 or higher before we sell it.
In detail
Write, run, or repair .NET tests that use TUnit. Use when a repo uses `TUnit`, `TUnit.Playwright`, `[Test]`, `[Arguments]`, `ClassDataSource`, `SharedType.PerTestSession`, or Microsoft.Testing.Platform-based execution. Preserve TUnit's parallel-by-default model and constrain only destructive shared-state collisions. DO NOT USE FOR: xUnit projects; MSTest projects.
How you use it
- Add it to your pack, then download your pack (1 credit).
- In Claude, open Customize > Skills and upload the zip. Code execution needs to be on under Settings > Capabilities.
- Ask Claude for the job in your own words. It uses the skill when your request matches what it does. Step by step guide
Safety check
Nothing risky found: no hidden instructions, no download and run, no reading of saved passwords or keys.
An automated scan lowers risk but cannot promise zero risk. How we check skills
Preview
The first lines of SKILL.md
---
name: tunit
description: "Write, run, or repair .NET tests that use TUnit. Use when a repo uses `TUnit`, `TUnit.Playwright`, `[Test]`, `[Arguments]`, `ClassDataSource`, `SharedType.PerTestSession`, `--treenode-filter`, or Microsoft.Testing.Platform-based execution, or when migrating xUnit or NUnit tests to TUnit. Covers current TUnit test and assertion syntax, the right dotnet test or dotnet run command for the SDK's runner mode, shared fixtures for integration and Playwright suites, and keeping TUnit's parallel-by-default model while constraining only destructive shared-state collisions. DO NOT USE FOR: projects that stay on xUnit or MSTest."
---
<!-- Modified by YourAISkill (youraiskill.com) on 2 December 2026 from the original by managedcode. See CHANGES.md. -->
# TUnit
## Trigger On
- the repo uses TUnit (`PackageReference Include="TUnit"`, `[Test]` with `await Assert.That(...)`)
- you need to add, run, debug, or repair TUnit tests, or migrate xUnit/NUnit tests to TUnit
- the repo uses `ClassDataSource<...>(Shared = SharedType.PerTestSession)`, `TUnit.Playwright`, or `--treenode-filter`
## Do Not Use For
- xUnit or MSTest projects that are not moving to TUnit
- generic test strategy with no TUnit-specific mechanics
## Inputs
- the repo's documented test command: README, CONTRIBUTING, `AGENTS.md` or similar agent notes, and the CI workflow
- the test project file, package references and TUnit version (`Directory.Packages.props` if central package management is used)
- `global.json` (it decides how `dotnet test` behaves on .NET 10)
## Workflow
1. Confirm the project really uses TUnit and not a different Microsoft.Testing.Platform (MTP) framework.
2. Use the repo's documented test command. If there is none, pick the command shape from the runner mode below.
3. Keep the TUnit execution model intact:
- tests are source-generated at build time (discovery problems show up as build errors or analyzer warnings)
- tests run in parallel by default
- built-in analyzers stay enabled; fix their warnings rather than suppressing them
4. Choose the fixture level deliberately:
- plain TUnit tests for isolated logic
- shared AppHost/Aspire (or other host) fixtures for HTTP, SignalR, SSE, or UI flows
- `WebApplicationFactory` layered over shared infrastructure when tests need Host DI services, `IGrainFactory`, or other runtime internals
5. Reuse expensive fixtures with `ClassDataSource<Fixture>(Shared = SharedType.PerTestSession)` instead of booting infrastructure per test. Fixture reuse does not serialize consumers: keep the fixture concurrency-safe and give each test unique mutable state.
6. Keep tests and test modules parallel. Do not add `--maximum-parallel-tests 1`, `TUNIT_MAX_PARALLEL_TESTS=1`, `--max-parallel-test-modules 1`, `[assembly: NotInParallel]`, a class-wide `[NotInParallel]`, or an equivalent global restriction.
7. Use keyed `[NotInParallel("collision-domain")]` only on the smallest tests that perform destructive changes to the same shared state and can corrupt one another. A shared read-only fixture, expensive startup, module boundary, or vague CI-stability concern is not a reason to limit parallelism. For a resource with limited capacity (a connection pool), cap only its users with `[ParallelLimiter<T>]`.
...From managedcode's repository, MIT licence.
Related skills
-
Checked
.NET trimming and Native AOT
Fixes trimming and Native AOT warnings in your .NET code step by step, so your app publishes small and fast.
9/101 credit -
Checked
MAUI safe area layout
Handles safe areas and edge to edge layouts in .NET MAUI, so content clears notches and the keyboard.
7/101 credit -
Checked
.NET MAUI sign in
Adds Google, Apple and Microsoft sign in to your .NET MAUI app, so login works on Android, iOS and Windows.
8/101 credit -
Checked
Xamarin.Forms to .NET MAUI
Moves your Xamarin.Forms app to .NET MAUI and keeps its store identity and user data, so nothing breaks quietly.
8/101 credit -
Checked
Godot C# scripting
Writes, ports and debugs C# scripts for Godot 4, so your game builds and runs without the common C# traps.
8/101 credit -
Checked
.NET Native Interop Helper
Writes correct P/Invoke calls from .NET to C and C++ libraries, avoiding crashes, leaks and garbled text.
8/101 credit