NextUnit 1.6.8

There is a newer version of this package available.
See the version list below for details.
dotnet add package NextUnit --version 1.6.8
                    
NuGet\Install-Package NextUnit -Version 1.6.8
                    
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" Version="1.6.8">
  <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" Version="1.6.8" />
                    
Directory.Packages.props
<PackageReference Include="NextUnit">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
Project file
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 --version 1.6.8
                    
#r "nuget: NextUnit, 1.6.8"
                    
#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@1.6.8
                    
#: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&version=1.6.8
                    
Install as a Cake Addin
#tool nuget:?package=NextUnit&version=1.6.8
                    
Install as a Cake Tool

NextUnit - Modern Testing for .NET 10+

NuGet License

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.Generator - Source generator for zero-reflection discovery
  • NextUnit.TestAdapter - VSTest adapter for Visual Studio Test Explorer
  • Microsoft.NET.Test.Sdk - Test platform SDK

Configure Your Test Project

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>net10.0</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="NextUnit" Version="1.6.8" />
  </ItemGroup>
</Project>

Note: No OutputType=Exe or Program.cs needed - NextUnit works as a class library with VSTest adapter.

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 test

Key Features

  • Zero-reflection execution - Fast test discovery via source generators
  • Rich assertions - Collections, strings, numerics with great error messages
  • Multi-scope lifecycle - Test, Class, Assembly scopes
  • Parallel control - [ParallelLimit], [NotInParallel]
  • Test dependencies - [DependsOn] for ordered execution
  • Native AOT compatible - Full trim and AOT support

Packages

Package Description Size
NextUnit Meta-package with all components (recommended) 4.2 KB
NextUnit.Core Core attributes, assertions, execution engine 32.1 KB
NextUnit.Generator Source generator for test discovery 20.7 KB
NextUnit.TestAdapter VSTest adapter for Visual Studio Test Explorer 15.4 KB

Total Size: 72.4 KB (ultra-lightweight!)

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

MIT 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

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

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 276 1/24/2026
1.12.0 140 1/24/2026
1.11.0 116 1/24/2026
1.10.0 121 1/24/2026
1.9.0 122 1/22/2026
1.8.0 151 1/22/2026
1.7.1 874 1/19/2026
1.7.0 415 1/18/2026
1.6.9 135 1/18/2026
1.6.8 160 1/18/2026
1.6.7 122 1/18/2026
1.6.6 176 1/14/2026
1.6.2 1,152 12/20/2025
1.6.1 328 12/15/2025
1.6.0 512 12/14/2025
1.5.0 726 12/10/2025
1.4.0 934 12/10/2025
Loading failed