NextUnit 1.18.0
dotnet add package NextUnit --version 1.18.0
NuGet\Install-Package NextUnit -Version 1.18.0
<PackageReference Include="NextUnit" Version="1.18.0" />
<PackageVersion Include="NextUnit" Version="1.18.0" />
<PackageReference Include="NextUnit" />
paket add NextUnit --version 1.18.0
#r "nuget: NextUnit, 1.18.0"
#:package NextUnit@1.18.0
#addin nuget:?package=NextUnit&version=1.18.0
#tool nuget:?package=NextUnit&version=1.18.0
NextUnit - Modern Testing for .NET 10+
NextUnit is a modern, high-performance test framework for .NET 10+ that combines:
- TUnit's modern architecture - Microsoft.Testing.Platform, Native AOT, source generators
- xUnit's familiar assertions - Classic
Assert.Equal(expected, actual), no fluent syntax
Quick Start
Installation
Simple - One Package (Recommended):
dotnet add package NextUnit
This meta-package includes everything you need:
- NextUnit.Core - Attributes, assertions, execution engine
- NextUnit.Platform - Microsoft.Testing.Platform integration
- NextUnit.Generator - Source generator for zero-reflection discovery
- NextUnit.Analyzers - Compile-time validation
- Microsoft.Testing.Platform.MSBuild -
dotnet test,dotnet run, and IDE entry point generation - Microsoft.Testing.Extensions.TrxReport - CI-friendly TRX result files
Configure Your Test Project
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="NextUnit" Version="1.18.0" />
</ItemGroup>
</Project>
Note: No OutputType=Exe, Program.cs, or separate analyzer reference is needed. The package
configures Microsoft.Testing.Platform and registers NextUnit automatically.
Write Your First Test
using NextUnit;
public class CalculatorTests
{
[Test]
public void Add_TwoNumbers_ReturnsSum()
{
var result = 2 + 2;
Assert.Equal(4, result);
}
[Test]
[Arguments(1, 2, 3)]
[Arguments(5, 5, 10)]
public void Add_Parameterized(int a, int b, int expected)
{
Assert.Equal(expected, a + b);
}
}
Run Tests
dotnet run --project MyProject.Tests
To run an entire repository with dotnet test on the .NET 10 SDK, select
Microsoft.Testing.Platform in the repository's global.json:
{
"test": {
"runner": "Microsoft.Testing.Platform"
}
}
Key Features
- Zero-reflection execution - Fast test discovery via source generators
- Rich assertions - Collections, strings, numerics, reference identity, and tolerance comparisons
- Async tests -
Task,Task<T>,ValueTask, andValueTask<T>return types for tests and lifecycle hooks - Test artifacts - Attach screenshots, logs, videos to test results
- Combined data sources -
[Values],[ValuesFromMember],[ValuesFrom<T>]with Cartesian product - Matrix data source -
[Matrix]for Cartesian product test generation - Class data source -
[ClassDataSource<T>]with shared instance support - Typed data rows - Per-row display names, categories, tags, and skip reasons
- Explicit tests -
[Explicit]to exclude from default runs - Roslyn analyzers - Compile-time validation of test code
- Multi-scope lifecycle - Test, Class, Assembly scopes
- Parallel control -
[ParallelLimit],[NotInParallel("key")],[ParallelGroup("name")] - Execution priority -
[ExecutionPriority(N)]for controlling test order - Test dependencies -
[DependsOn]withProceedOnFailureoption - Native AOT compatible - Full trim and AOT support
Packages
| Package | Description |
|---|---|
| NextUnit | Single-package setup with runtime, generator, analyzers, and platform integration |
| NextUnit.Core | Core attributes, assertions, and execution engine |
| NextUnit.Platform | Microsoft.Testing.Platform integration |
| NextUnit.Generator | Source generator for test discovery |
| NextUnit.TestAdapter | Optional legacy VSTest adapter |
Documentation
- Getting Started Guide
- Migration from xUnit
- Best Practices
- Performance methodology and results
- Full Documentation
What's Different from xUnit?
| Feature | xUnit | NextUnit |
|---|---|---|
| Test Attribute | [Fact] |
[Test] (clearer) |
| Parameterized | [Theory] + [InlineData] |
[Test] + [Arguments] |
| Discovery | Runtime reflection | Source generator (faster) |
| Parallelism | Limited control | Fine-grained with [ParallelLimit] |
| Lifecycle | Constructor + IDisposable |
Multi-scope [Before]/[After] |
| AOT Support | Limited | Full Native AOT compatible |
Contributing
Contributions welcome! See our Contributing Guide.
License
Acknowledgments
Inspired by:
- TUnit - Modern architecture, source generators
- xUnit - Ergonomic assertions, proven patterns
- NUnit/MSTest - Battle-tested reliability
Built with love for .NET 10+ developers who want modern performance with familiar syntax.
Learn more about Target Frameworks and .NET Standard.
-
net10.0
- Microsoft.Testing.Extensions.TrxReport (>= 2.0.2)
- Microsoft.Testing.Platform.MSBuild (>= 2.0.2)
- NextUnit.Core (>= 1.18.0)
- NextUnit.Platform (>= 1.18.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.18.0 | 142 | 7/26/2026 |
| 1.17.0 | 200 | 7/25/2026 |
| 1.16.0 | 162 | 7/25/2026 |
| 1.15.1 | 207 | 7/22/2026 |
| 1.13.0 | 862 | 1/24/2026 |
| 1.12.0 | 342 | 1/24/2026 |
| 1.11.0 | 314 | 1/24/2026 |
| 1.10.0 | 322 | 1/24/2026 |
| 1.9.0 | 324 | 1/22/2026 |
| 1.8.0 | 351 | 1/22/2026 |
| 1.7.1 | 1,073 | 1/19/2026 |
| 1.7.0 | 617 | 1/18/2026 |
| 1.6.9 | 333 | 1/18/2026 |
| 1.6.8 | 359 | 1/18/2026 |
| 1.6.7 | 318 | 1/18/2026 |
| 1.6.6 | 378 | 1/14/2026 |
| 1.6.2 | 1,355 | 12/20/2025 |
| 1.6.1 | 522 | 12/15/2025 |
See https://github.com/crane-valley/NextUnit/blob/main/CHANGELOG.md for release notes.