NextUnit.Platform
1.13.0
dotnet add package NextUnit.Platform --version 1.13.0
NuGet\Install-Package NextUnit.Platform -Version 1.13.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="NextUnit.Platform" Version="1.13.0"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="NextUnit.Platform" Version="1.13.0" />
<PackageReference Include="NextUnit.Platform"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add NextUnit.Platform --version 1.13.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: NextUnit.Platform, 1.13.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package NextUnit.Platform@1.13.0
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=NextUnit.Platform&version=1.13.0
#tool nuget:?package=NextUnit.Platform&version=1.13.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
NextUnit
A modern, high-performance test framework for .NET 10+ with zero-reflection execution and xUnit-style assertions.
Features
- Zero-reflection execution - Source generators produce delegate-based test registry
- Familiar assertions -
Assert.Equal,Assert.True,Assert.Throws, etc. - Multi-scope lifecycle -
[Before]/[After]at Test, Class, Assembly, or Session level - Fine-grained parallelism -
[ParallelLimit(N)],[NotInParallel("key")],[ParallelGroup] - Parameterized tests -
[Arguments],[TestData],[Matrix]attributes - Combined data sources -
[Values],[ValuesFromMember],[ValuesFrom<T>]with Cartesian product - Class data source -
[ClassDataSource<T>]with shared instance support - Category/Tag filtering -
[Category],[Tag]with CLI and environment variable support - Test dependencies -
[DependsOn]for ordered execution withProceedOnFailureoption - Explicit tests -
[Explicit]to exclude from default runs - Roslyn analyzers - Compile-time test validation
- VSTest integration - Works with Visual Studio Test Explorer and
dotnet test - Native AOT compatible
Quick Start
Installation
dotnet add package NextUnit
Project Configuration
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="NextUnit" Version="1.13.0" />
</ItemGroup>
</Project>
Writing Tests
using NextUnit;
public class CalculatorTests
{
[Test]
public void Add_ReturnsSum()
{
Assert.Equal(4, 2 + 2);
}
[Test]
public void Divide_ThrowsOnZero()
{
Assert.Throws<DivideByZeroException>(() => { var x = 1 / 0; });
}
[Test]
[Arguments(2, 3, 5)]
[Arguments(-1, 1, 0)]
public void Add_Parameterized(int a, int b, int expected)
{
Assert.Equal(expected, a + b);
}
}
Running Tests
dotnet test # Run all tests
dotnet test --filter "FullyQualifiedName~Calc" # Filter by name
Assertions
| Category | Methods |
|---|---|
| Basic | Equal, NotEqual, True, False, Null, NotNull |
| Collections | Contains, DoesNotContain, Empty, NotEmpty, Single, All |
| Strings | StartsWith, EndsWith, Contains |
| Numeric | InRange, NotInRange, Equal(expected, actual, precision) |
| Exceptions | Throws<T>, ThrowsAsync<T> |
| Advanced | Equivalent, Subset, Disjoint |
Lifecycle Hooks
public class DatabaseTests
{
[Before(LifecycleScope.Test)] // Before each test
public void Setup() { }
[After(LifecycleScope.Test)] // After each test
public void Cleanup() { }
[Before(LifecycleScope.Class)] // Once before all tests in class
public void ClassSetup() { }
[Test]
public void MyTest() { }
}
Scopes: Test, Class, Assembly, Session
Parallel Execution
[NotInParallel] // Run tests serially
public class SlowTests { }
[ParallelLimit(2)] // Max 2 concurrent tests
public class ModerateTests { }
Filtering
[Category("Integration")]
[Tag("Slow")]
public class MyTests { }
# Environment variables
NEXTUNIT_INCLUDE_CATEGORIES=Integration dotnet test
NEXTUNIT_EXCLUDE_TAGS=Slow dotnet test
Performance
| Metric | Result |
|---|---|
| Discovery (1,000 tests) | ~2ms |
| Per-test overhead | ~0.7ms |
| Throughput | 1,852 tests/sec |
See benchmark results for comparison with xUnit, NUnit, and MSTest.
Documentation
- Getting Started
- Migration from xUnit
- Best Practices
- Performance Analysis
- CI/CD Integration
- Changelog
Sample Projects
- Class Library Testing - Business logic testing patterns
- Console App Testing - CLI argument parsing, file processing
- Framework Tests - All NextUnit features demonstrated
Contributing
- Open an issue to discuss your idea
- Fork and create a feature branch
- Write tests for your changes
- Submit a PR
Note: English-only for code, comments, and documentation.
dotnet build --configuration Release
dotnet test samples/NextUnit.SampleTests/NextUnit.SampleTests.csproj
License
Acknowledgments
Inspired by TUnit (architecture), xUnit (assertions), and NUnit/MSTest.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net10.0
- Microsoft.Testing.Platform (>= 2.0.2)
- NextUnit.Core (>= 1.13.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.13.0 | 90 | 1/24/2026 |
| 1.12.0 | 88 | 1/24/2026 |
| 1.11.0 | 89 | 1/24/2026 |
| 1.10.0 | 89 | 1/24/2026 |
| 1.9.0 | 93 | 1/22/2026 |
| 1.8.0 | 94 | 1/22/2026 |
| 1.7.1 | 91 | 1/19/2026 |
| 1.7.0 | 84 | 1/18/2026 |
| 1.6.9 | 90 | 1/18/2026 |
| 1.6.8 | 89 | 1/18/2026 |
| 1.6.7 | 88 | 1/18/2026 |
| 1.6.6 | 95 | 1/14/2026 |
| 1.6.5 | 89 | 1/14/2026 |
| 1.6.3 | 91 | 1/14/2026 |
| 1.6.2 | 1,109 | 12/20/2025 |
| 1.6.1 | 276 | 12/15/2025 |
| 1.6.0 | 451 | 12/14/2025 |
| 1.5.0 | 686 | 12/10/2025 |
| 1.4.0 | 881 | 12/10/2025 |
| 1.3.1 | 467 | 12/9/2025 |
Loading failed
See https://github.com/crane-valley/NextUnit/blob/main/CHANGELOG.md for release notes.