dotnet-xunit

Author xUnit v3 tests in .NET with Facts, Theories, and fixtures.

1|Updated Feb 22, 2026
One-click install
npx skills add https://github.com/rudironsoni/dotnet-agent-harness --skill dotnet-xunit-rudironsoni
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dotnet-xunit
Source: https://github.com/rudironsoni/dotnet-agent-harness/tree/main/.rulesync/skills/dotnet-xunit
Command: npx skills add https://github.com/rudironsoni/dotnet-agent-harness --skill dotnet-xunit-rudironsoni

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps .NET developers write robust and efficient unit tests using the xUnit v3 framework, covering advanced features and migration considerations from v2.

Core Features & Use Cases

  • Parameterized Tests: Implement [Fact] and [Theory] with [InlineData], [MemberData], and [ClassData].
  • Fixtures & Lifecycles: Manage shared resources with IClassFixture, ICollectionFixture, and IAsyncLifetime.
  • Parallelism Control: Configure test execution order and parallelism at assembly or collection levels.
  • Use Case: You need to write a comprehensive suite of unit tests for a new ASP.NET Core API endpoint, ensuring all edge cases and valid inputs are covered using xUnit's advanced features like parameterized tests and fixtures for database setup.

Quick Start

Use the dotnet-xunit skill to create a new xUnit test class with a basic [Fact] method.

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 xUnit tests in .NET using InlineData, MemberData, and ClassData?

You can write parameterized xUnit tests in .NET by decorating methods with [Theory] and supplying data via [InlineData], [MemberData], or [ClassData] attributes to execute the test logic against multiple input sets.

How do I manage shared test resources in xUnit using fixtures and IAsyncLifetime?

Manage shared test resources in xUnit by implementing IClassFixture or ICollectionFixture for database setup, and use IAsyncLifetime to handle asynchronous initialization and cleanup tasks efficiently.

What are the key differences when migrating xUnit tests from v2 to v3 in .NET 8?

Migrating xUnit tests from v2 to v3 involves adapting to key framework differences, utilizing updated custom assertions, and ensuring your .NET 8.0+ project aligns with the new v3 execution and analyzer rules.

How do I configure parallel test execution and collection behavior in xUnit?

Configure parallel test execution in xUnit by adjusting assembly or collection level settings to control test execution order and manage parallelism across your .NET test suite effectively.

Does xUnit v3 work with .NET 8 projects and how do I capture test output?

xUnit v3 fully supports .NET 8.0+ projects, allowing you to capture test output directly within your methods and utilize analyzers to enforce robust unit testing practices during development.

When should I use xUnit collection fixtures versus class fixtures for .NET unit testing?

Use xUnit class fixtures for shared resources across a single test class, and apply collection fixtures when multiple test classes need to share the exact same resource state across your .NET unit testing suite.