Visual Studio Test Explorer adapter for NextUnit test framework. Enables test discovery and execution in Visual Studio Test Explorer, dotnet test, and other VSTest-compatible tools.
$ dotnet add package NextUnit.TestAdapterA modern, high-performance test framework for .NET 10+ with zero-reflection execution and xUnit-style assertions.
Assert.Equal, Assert.True, Assert.Throws, etc.[Before]/[After] at Test, Class, Assembly, or Session level[ParallelLimit(N)], [NotInParallel("key")], [ParallelGroup][Arguments], [TestData], [Matrix] attributes[Values], [ValuesFromMember], [ValuesFrom<T>] with Cartesian product[ClassDataSource<T>] with shared instance support[Category], [Tag] with CLI and environment variable support[DependsOn] for ordered execution with ProceedOnFailure option[Explicit] to exclude from default runsdotnet testdotnet add package NextUnit
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="NextUnit" Version="1.13.0" />
</ItemGroup>
</Project>
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);
}
}
dotnet test # Run all tests
dotnet test --filter "FullyQualifiedName~Calc" # Filter by name
| 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 |
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
[NotInParallel] // Run tests serially
public class SlowTests { }
[ParallelLimit(2)] // Max 2 concurrent tests
public class ModerateTests { }
[Category("Integration")]
[Tag("Slow")]
public class MyTests { }
# Environment variables
NEXTUNIT_INCLUDE_CATEGORIES=Integration dotnet test
NEXTUNIT_EXCLUDE_TAGS=Slow dotnet test
| 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.
Note: English-only for code, comments, and documentation.
dotnet build --configuration Release
dotnet test samples/NextUnit.SampleTests/NextUnit.SampleTests.csproj
Inspired by TUnit (architecture), xUnit (assertions), and NUnit/MSTest.