Xunit

From managedcode/dotnet-skills · View interactive version

Xunit is an AI agent skill from the GitHub repository managedcode/dotnet-skills. Write, run, or repair .NET tests that use xUnit with the right package, CLI, and runner guidance. USE FOR: xUnit v2 or xUnit v3 projects; adding, running, debugging, or repairing xUnit tests; choosing between VSTest and Microsoft.Testing.Platform. DO NOT USE FOR: TUnit projects; MSTest projects. INV

How to use this skill

Skill file

xUnit.net

Diagnostic Output Budget

Keep native test progress and ANSI visible; use the detected runner's supported flags (--progress on --ansi on for MTP/TUnit), not MTP switches on VSTest. Keep console logs at Warning or higher and one concise final summary. Do not replay progress redraws, successful-test output, or Information/Debug/Trace logs into model context. On failure/crash, show only the failing test/resource, root error, and relevant stack frames; deduplicate and cap each diagnostic response at 80 lines / 8 KiB. Never dump entire console/host/browser logs, HTML, TRX, or crash artifacts. Keep necessary artifacts size-bounded outside context, link them, and inspect exact bounded excerpts. Preserve the runner exit code through capture/filtering; disclose truncation. Silence alone does not establish a hang.

Trigger On

Value

Do Not Use For

Inputs

Quick Start

  1. Read the nearest AGENTS.md and confirm scope and constraints.
  2. Run this skill's Workflow through the Ralph Loop until outcomes are acceptable.
  3. Return the Required Result Format with concrete artifacts and verification evidence.

Workflow

  1. Detect the active xUnit model before changing commands:
  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:
  1. Run the narrowest useful scope first:
  1. Prefer [Theory] for stable data-driven coverage and [Fact] for single-path invariant checks.
  2. Keep xunit.analyzers enabled when present. Fix analyzer findings instead of muting them casually.

Bootstrap When Missing

If xUnit is requested but not configured:

  1. Detect current framework first:
  1. If the repo currently uses TUnit or MSTest, do not auto-migrate. Return status: not_applicable unless migration is explicitly requested.
  2. For explicit xUnit adoption, add packages to the target test project:
  1. Add repo test commands and runner notes to AGENTS.md.
  2. Run dotnet test TEST_PROJECT.csproj or repo-defined xUnit command and return status: configured or status: improved.

Deliver

Validate

Ralph Loop

Use the Ralph Loop for every task, including docs, architecture, testing, and tooling work.

  1. Plan first (mandatory):
  1. Execute one planned step and produce a concrete delta.
  2. Review the result and capture findings with actionable next fixes.
  3. Apply fixes in small batches and rerun the relevant checks or review steps.
  4. Update the plan after each iteration.
  5. Repeat until outcomes are acceptable or only explicit exceptions remain.
  6. If a dependency is missing, bootstrap it or return status: not_applicable with explicit reason and fallback path.

Required Result Format

For setup-only requests with no execution, return status: configured and exact next commands.

Load References

Example Requests

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.