dotnet-xunit

Write .NET unit tests using xUnit.net v3 features and fixtures.

71|10|Updated Feb 11, 2026
One-click install
npx skills add https://github.com/wshaddix/dotnet-skills --skill dotnet-xunit-wshaddix
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dotnet-xunit
Source: https://github.com/wshaddix/dotnet-skills/tree/main/skills/dotnet-xunit
Command: npx skills add https://github.com/wshaddix/dotnet-skills --skill dotnet-xunit-wshaddix

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps developers write effective and maintainable unit tests in .NET using the xUnit.net framework, covering advanced features and best practices for reliable testing.

Core Features & Use Cases

  • xUnit v3 Features: Explains [Fact], [Theory], InlineData, MemberData, ClassData, fixtures (IClassFixture, ICollectionFixture), and IAsyncLifetime.
  • Parallelism Control: Guides on configuring test execution parallelism and disabling it when necessary.
  • Test Output & Logging: Demonstrates capturing test output and integrating with Microsoft.Extensions.Logging.
  • Custom Assertions: Shows how to create domain-specific assertions for cleaner tests.
  • Analyzers: Highlights the use of xUnit analyzers to catch common testing mistakes.
  • Use Case: You need to write unit tests for a new C# class that performs complex calculations. This Skill will guide you on how to use [Theory] with InlineData for different input scenarios and how to set up a fixture for any shared resources needed by your tests.

Quick Start

Use the dotnet-xunit skill to learn how to write parameterized tests using [Theory] and InlineData.

Frequently Asked Questions about dotnet-xunit

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write parameterized unit tests in .NET using xUnit?

To write parameterized unit tests in xUnit, use the [Theory] attribute combined with InlineData, MemberData, or ClassData to pass multiple input scenarios into a single test method.

What is the best way to share resources across multiple xUnit test classes?

To share resources across multiple xUnit test classes, implement ICollectionFixture to create a collection fixture that initializes shared state once for all tests within that collection.

How do I control parallel test execution in xUnit?

You can control parallel test execution in xUnit by configuring parallelism settings, which allows you to enable or disable parallel execution for specific test collections to prevent state conflicts.

How does IAsyncLifetime work for async unit test setup in xUnit?

IAsyncLifetime provides asynchronous initialization and cleanup for xUnit unit tests, allowing you to await asynchronous operations during test setup and teardown without blocking threads.

Can I capture test output and integrate Microsoft.Extensions.Logging in xUnit?

Yes, you can capture test output in xUnit using ITestOutputHelper, which integrates with Microsoft.Extensions.Logging to route log messages directly into the test runner output.

Are there xUnit analyzers to catch common testing mistakes in C#?

Yes, xUnit includes analyzers that automatically inspect code to catch common testing mistakes and enforce best practices, improving the reliability of your test suite.