Skip to content

thomhurst/TUnit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🚀 The Modern Testing Framework for .NET

TUnit is a next-generation testing framework for C# that outpaces traditional frameworks with source-generated tests, parallel execution by default, and Native AOT support. Built on the modern Microsoft.Testing.Platform, TUnit delivers faster test runs, better developer experience, and unmatched flexibility.

thomhurst%2FTUnit | Trendshift

Codacy BadgeGitHub Repo stars GitHub Issues or Pull Requests GitHub Sponsors nuget NuGet Downloads GitHub Workflow Status (with event) GitHub last commit (branch) License

⚡ Why Choose TUnit?

Feature Traditional Frameworks TUnit
Test Discovery ❌ Runtime reflection Compile-time generation
Execution Speed ❌ Sequential by default Parallel by default
Modern .NET ⚠️ Limited AOT support Full Native AOT & trimming
Test Dependencies ❌ Not supported [DependsOn] chains
Resource Management ❌ Manual lifecycle Intelligent cleanup

Parallel by Default - Tests run concurrently with intelligent dependency management

🎯 Compile-Time Discovery - Know your test structure before runtime

🔧 Modern .NET Ready - Native AOT, trimming, and latest .NET features

🎭 Extensible - Customize data sources, attributes, and test behavior


🚀 New to TUnit? Start with our Getting Started Guide

🔄 Migrating? See our Migration Guides

🎯 Advanced Features? Explore Data-Driven Testing, Test Dependencies, and Parallelism Control


🏁 Quick Start

Using the Project Template (Recommended)

dotnet new install TUnit.Templates
dotnet new TUnit -n "MyTestProject"

Manual Installation

dotnet add package TUnit --prerelease

📖 📚 Complete Documentation & Guides - Everything you need to master TUnit

✨ Key Features

🚀 Performance & Modern Platform

  • 🔥 Source-generated tests (no reflection)
  • ⚡ Parallel execution by default
  • 🚀 Native AOT & trimming support
  • 📈 Optimized for performance

🎯 Advanced Test Control

  • 🔗 Test dependencies with [DependsOn]
  • 🎛️ Parallel limits & custom scheduling
  • 🛡️ Built-in analyzers & compile-time checks
  • 🎭 Custom attributes & extensible conditions

📊 Rich Data & Assertions

  • 📋 Multiple data sources ([Arguments], [Matrix], [ClassData])
  • ✅ Fluent async assertions
  • 🔄 Smart retry logic & conditional execution
  • 📝 Rich test metadata & context

🔧 Developer Experience

  • 💉 Full dependency injection support
  • 🪝 Comprehensive lifecycle hooks
  • 🎯 IDE integration (VS, Rider, VS Code)
  • 📚 Extensive documentation & examples

📝 Simple Test Example

[Test]
public async Task User_Creation_Should_Set_Timestamp()
{
    // Arrange
    var userService = new UserService();

    // Act
    var user = await userService.CreateUserAsync("[email protected]");

    // Assert - TUnit's fluent assertions
    await Assert.That(user.CreatedAt)
        .IsEqualTo(DateTime.Now)
        .Within(TimeSpan.FromMinutes(1));

    await Assert.That(user.Email)
        .IsEqualTo("[email protected]");
}

🎯 Data-Driven Testing

[Test]
[Arguments("[email protected]", "ValidPassword123")]
[Arguments("[email protected]", "AnotherPassword456")]
[Arguments("[email protected]", "AdminPass789")]
public async Task User_Login_Should_Succeed(string email, string password)
{
    var result = await authService.LoginAsync(email, password);
    await Assert.That(result.IsSuccess).IsTrue();
}

// Matrix testing - tests all combinations
[Test]
[MatrixDataSource]
public async Task Database_Operations_Work(
    [Matrix("Create", "Update", "Delete")] string operation,
    [Matrix("User", "Product", "Order")] string entity)
{
    await Assert.That(await ExecuteOperation(operation, entity))
        .IsTrue();
}

🔗 Advanced Test Orchestration

[Before(Class)]
public static async Task SetupDatabase(ClassHookContext context)
{
    await DatabaseHelper.InitializeAsync();
}

[Test, DisplayName("Register a new account")]
[MethodDataSource(nameof(GetTestUsers))]
public async Task Register_User(string username, string password)
{
    // Test implementation
}

[Test, DependsOn(nameof(Register_User))]
[Retry(3)] // Retry on failure
public async Task Login_With_Registered_User(string username, string password)
{
    // This test runs after Register_User completes
}

[Test]
[ParallelLimit<LoadTestParallelLimit>] // Custom parallel control
[Repeat(100)] // Run 100 times
public async Task Load_Test_Homepage()
{
    // Performance testing
}

// Custom attributes
[Test, WindowsOnly, RetryOnHttpError(5)]
public async Task Windows_Specific_Feature()
{
    // Platform-specific test with custom retry logic
}

public class LoadTestParallelLimit : IParallelLimit
{
    public int Limit => 10; // Limit to 10 concurrent executions
}

🔧 Smart Test Control

// Custom conditional execution
public class WindowsOnlyAttribute : SkipAttribute
{
    public WindowsOnlyAttribute() : base("Windows only test") { }

    public override Task<bool> ShouldSkip(TestContext testContext)
        => Task.FromResult(!OperatingSystem.IsWindows());
}

// Custom retry logic
public class RetryOnHttpErrorAttribute : RetryAttribute
{
    public RetryOnHttpErrorAttribute(int times) : base(times) { }

    public override Task<bool> ShouldRetry(TestInformation testInformation,
        Exception exception, int currentRetryCount)
        => Task.FromResult(exception is HttpRequestException { StatusCode: HttpStatusCode.ServiceUnavailable });
}

🎯 Perfect For Every Testing Scenario

🧪 Unit Testing

[Test]
[Arguments(1, 2, 3)]
[Arguments(5, 10, 15)]
public async Task Calculate_Sum(int a, int b, int expected)
{
    await Assert.That(Calculator.Add(a, b))
        .IsEqualTo(expected);
}

Fast, isolated, and reliable

🔗 Integration Testing

[Test, DependsOn(nameof(CreateUser))]
public async Task Login_After_Registration()
{
    // Runs after CreateUser completes
    var result = await authService.Login(user);
    await Assert.That(result.IsSuccess).IsTrue();
}

Stateful workflows made simple

Load Testing

[Test]
[ParallelLimit<LoadTestLimit>]
[Repeat(1000)]
public async Task API_Handles_Concurrent_Requests()
{
    await Assert.That(await httpClient.GetAsync("/api/health"))
        .HasStatusCode(HttpStatusCode.OK);
}

Built-in performance testing

🚀 What Makes TUnit Different?

Compile-Time Intelligence

Tests are discovered at build time, not runtime - enabling faster discovery, better IDE integration, and precise resource lifecycle management.

Parallel-First Architecture

Built for concurrency from day one with [DependsOn] for test chains, [ParallelLimit] for resource control, and intelligent scheduling.

Extensible by Design

The DataSourceGenerator<T> pattern and custom attribute system let you extend TUnit's capabilities without modifying core framework code.

🏆 Community & Ecosystem

🌟 Join thousands of developers modernizing their testing

Downloads Contributors Discussions

🤝 Active Community

🛠️ IDE Support

TUnit works seamlessly across all major .NET development environments:

Visual Studio (2022 17.13+)

Fully supported - No additional configuration needed for latest versions

⚙️ Earlier versions: Enable "Use testing platform server mode" in Tools > Manage Preview Features

JetBrains Rider

Fully supported

⚙️ Setup: Enable "Testing Platform support" in Settings > Build, Execution, Deployment > Unit Testing > VSTest

Visual Studio Code

Fully supported

⚙️ Setup: Install C# Dev Kit and enable "Use Testing Platform Protocol"

Command Line

Full CLI support - Works with dotnet test, dotnet run, and direct executable execution

📦 Package Options

Package Use Case
TUnit Start here - Complete testing framework (includes Core + Engine + Assertions)
TUnit.Core 📚 Test libraries and shared components (no execution engine)
TUnit.Engine 🚀 Test execution engine and adapter (for test projects)
TUnit.Assertions ✅ Standalone assertions (works with any test framework)
TUnit.Playwright 🎭 Playwright integration with automatic lifecycle management

🎯 Migration from Other Frameworks

Coming from NUnit or xUnit? TUnit maintains familiar syntax while adding modern capabilities:

// Enhanced with TUnit's advanced features
[Test]
[Arguments("value1")]
[Arguments("value2")]
[Retry(3)]
[ParallelLimit<CustomLimit>]
public async Task Modern_TUnit_Test(string value) { }

📖 Need help migrating? Check our detailed Migration Guides with step-by-step instructions for xUnit, NUnit, and MSTest.

💡 Current Status

The API is mostly stable, but may have some changes based on feedback or issues before v1.0 release.


🚀 Ready to Experience the Future of .NET Testing?

Start in 30 Seconds

# Create a new test project with examples
dotnet new install TUnit.Templates && dotnet new TUnit -n "MyAwesomeTests"

# Or add to existing project
dotnet add package TUnit --prerelease

🎯 Why Wait? Join the Movement

📈 Performance

Optimized execution Parallel by default Zero reflection overhead

🔮 Future-Ready

Native AOT support Latest .NET features Source generation

🛠️ Developer Experience

Compile-time checks Rich IDE integration Intelligent debugging

🎭 Flexibility

Test dependencies Custom attributes Extensible architecture


📖 Learn More: tunit.dev | 💬 Get Help: GitHub Discussions | ⭐ Show Support: Star on GitHub

TUnit is actively developed and production-ready. Join our growing community of developers who've made the switch!

Performance Benchmark

Scenario: Building the test project

macos-latest


BenchmarkDotNet v0.15.2, macOS Sequoia 15.5 (24F74) [Darwin 24.5.0]
Apple M1 (Virtual), 1 CPU, 3 logical and 3 physical cores
.NET SDK 9.0.304
  [Host]     : .NET 9.0.8 (9.0.825.36511), Arm64 RyuJIT AdvSIMD
  Job-YNJDZW : .NET 9.0.8 (9.0.825.36511), Arm64 RyuJIT AdvSIMD

Runtime=.NET 9.0  

Method Version Mean Error StdDev Median
Build_TUnit 0.57.24 984.5 ms 19.69 ms 53.57 ms 972.6 ms
Build_NUnit 4.4.0 879.8 ms 17.49 ms 16.36 ms 878.2 ms
Build_xUnit 2.9.3 830.0 ms 8.21 ms 6.86 ms 831.6 ms
Build_MSTest 3.10.4 891.7 ms 16.60 ms 18.45 ms 888.6 ms

ubuntu-latest


BenchmarkDotNet v0.15.2, Linux Ubuntu 24.04.3 LTS (Noble Numbat)
AMD EPYC 7763, 1 CPU, 4 logical and 2 physical cores
.NET SDK 9.0.304
  [Host]     : .NET 9.0.8 (9.0.825.36511), X64 RyuJIT AVX2
  Job-YNJDZW : .NET 9.0.8 (9.0.825.36511), X64 RyuJIT AVX2

Runtime=.NET 9.0  

Method Version Mean Error StdDev Median
Build_TUnit 0.57.24 1.841 s 0.0364 s 0.0556 s 1.819 s
Build_NUnit 4.4.0 1.534 s 0.0176 s 0.0165 s 1.537 s
Build_xUnit 2.9.3 1.546 s 0.0243 s 0.0216 s 1.545 s
Build_MSTest 3.10.4 1.528 s 0.0189 s 0.0177 s 1.533 s

windows-latest


BenchmarkDotNet v0.15.2, Windows 10 (10.0.20348.4052) (Hyper-V)
AMD EPYC 7763 2.44GHz, 1 CPU, 4 logical and 2 physical cores
.NET SDK 9.0.304
  [Host]     : .NET 9.0.8 (9.0.825.36511), X64 RyuJIT AVX2
  Job-YNJDZW : .NET 9.0.8 (9.0.825.36511), X64 RyuJIT AVX2

Runtime=.NET 9.0  

Method Version Mean Error StdDev Median
Build_TUnit 0.57.24 1.859 s 0.0347 s 0.0775 s 1.832 s
Build_NUnit 4.4.0 1.546 s 0.0221 s 0.0196 s 1.543 s
Build_xUnit 2.9.3 1.550 s 0.0292 s 0.0273 s 1.542 s
Build_MSTest 3.10.4 1.597 s 0.0317 s 0.0503 s 1.580 s

Scenario: Tests focused on assertion performance and validation

macos-latest


BenchmarkDotNet v0.15.2, macOS Sequoia 15.5 (24F74) [Darwin 24.5.0]
Apple M1 (Virtual), 1 CPU, 3 logical and 3 physical cores
.NET SDK 9.0.304
  [Host]     : .NET 9.0.8 (9.0.825.36511), Arm64 RyuJIT AdvSIMD
  Job-YNJDZW : .NET 9.0.8 (9.0.825.36511), Arm64 RyuJIT AdvSIMD

Runtime=.NET 9.0  

Method Version Mean Error StdDev Median
TUnit_AOT 0.57.24 NA NA NA NA
TUnit 0.57.24 NA NA NA NA
NUnit 4.4.0 NA NA NA NA
xUnit 2.9.3 NA NA NA NA
MSTest 3.10.4 NA NA NA NA

Benchmarks with issues: RuntimeBenchmarks.TUnit_AOT: Job-YNJDZW(Runtime=.NET 9.0) RuntimeBenchmarks.TUnit: Job-YNJDZW(Runtime=.NET 9.0) RuntimeBenchmarks.NUnit: Job-YNJDZW(Runtime=.NET 9.0) RuntimeBenchmarks.xUnit: Job-YNJDZW(Runtime=.NET 9.0) RuntimeBenchmarks.MSTest: Job-YNJDZW(Runtime=.NET 9.0)

ubuntu-latest


BenchmarkDotNet v0.15.2, Linux Ubuntu 24.04.3 LTS (Noble Numbat)
AMD EPYC 7763, 1 CPU, 4 logical and 2 physical cores
.NET SDK 9.0.304
  [Host]     : .NET 9.0.8 (9.0.825.36511), X64 RyuJIT AVX2
  Job-YNJDZW : .NET 9.0.8 (9.0.825.36511), X64 RyuJIT AVX2

Runtime=.NET 9.0  

Method Version Mean Error StdDev Median
TUnit_AOT 0.57.24 NA NA NA NA
TUnit 0.57.24 NA NA NA NA
NUnit 4.4.0 NA NA NA NA
xUnit 2.9.3 NA NA NA NA
MSTest 3.10.4 NA NA NA NA

Benchmarks with issues: RuntimeBenchmarks.TUnit_AOT: Job-YNJDZW(Runtime=.NET 9.0) RuntimeBenchmarks.TUnit: Job-YNJDZW(Runtime=.NET 9.0) RuntimeBenchmarks.NUnit: Job-YNJDZW(Runtime=.NET 9.0) RuntimeBenchmarks.xUnit: Job-YNJDZW(Runtime=.NET 9.0) RuntimeBenchmarks.MSTest: Job-YNJDZW(Runtime=.NET 9.0)

windows-latest


BenchmarkDotNet v0.15.2, Windows 10 (10.0.20348.4052) (Hyper-V)
AMD EPYC 7763 2.44GHz, 1 CPU, 4 logical and 2 physical cores
.NET SDK 9.0.304
  [Host]     : .NET 9.0.8 (9.0.825.36511), X64 RyuJIT AVX2
  Job-YNJDZW : .NET 9.0.8 (9.0.825.36511), X64 RyuJIT AVX2

Runtime=.NET 9.0  

Method Version Mean Error StdDev Median
TUnit_AOT 0.57.24 NA NA NA NA
TUnit 0.57.24 NA NA NA NA
NUnit 4.4.0 NA NA NA NA
xUnit 2.9.3 NA NA NA NA
MSTest 3.10.4 NA NA NA NA

Benchmarks with issues: RuntimeBenchmarks.TUnit_AOT: Job-YNJDZW(Runtime=.NET 9.0) RuntimeBenchmarks.TUnit: Job-YNJDZW(Runtime=.NET 9.0) RuntimeBenchmarks.NUnit: Job-YNJDZW(Runtime=.NET 9.0) RuntimeBenchmarks.xUnit: Job-YNJDZW(Runtime=.NET 9.0) RuntimeBenchmarks.MSTest: Job-YNJDZW(Runtime=.NET 9.0)

Scenario: Tests running asynchronous operations and async/await patterns

macos-latest


BenchmarkDotNet v0.15.2, macOS Sequoia 15.5 (24F74) [Darwin 24.5.0]
Apple M1 (Virtual), 1 CPU, 3 logical and 3 physical cores
.NET SDK 9.0.304
  [Host]     : .NET 9.0.8 (9.0.825.36511), Arm64 RyuJIT AdvSIMD
  Job-YNJDZW : .NET 9.0.8 (9.0.825.36511), Arm64 RyuJIT AdvSIMD

Runtime=.NET 9.0  

Method Version Mean Error StdDev Median
TUnit_AOT 0.57.24 217.4 ms 16.00 ms 46.66 ms 209.1 ms
TUnit 0.57.24 686.4 ms 41.32 ms 118.57 ms 657.3 ms
NUnit 4.4.0 1,072.3 ms 90.35 ms 266.39 ms 1,003.4 ms
xUnit 2.9.3 855.3 ms 19.42 ms 56.33 ms 842.8 ms
MSTest 3.10.4 750.1 ms 18.63 ms 54.63 ms 721.4 ms

ubuntu-latest


BenchmarkDotNet v0.15.2, Linux Ubuntu 24.04.3 LTS (Noble Numbat)
AMD EPYC 7763, 1 CPU, 4 logical and 2 physical cores
.NET SDK 9.0.304
  [Host]     : .NET 9.0.8 (9.0.825.36511), X64 RyuJIT AVX2
  Job-YNJDZW : .NET 9.0.8 (9.0.825.36511), X64 RyuJIT AVX2

Runtime=.NET 9.0  

Method Version Mean Error StdDev Median
TUnit_AOT 0.57.24 28.37 ms 0.362 ms 0.321 ms 28.37 ms
TUnit 0.57.24 977.58 ms 18.905 ms 22.505 ms 971.07 ms
NUnit 4.4.0 1,355.81 ms 10.553 ms 9.871 ms 1,359.75 ms
xUnit 2.9.3 1,454.32 ms 10.270 ms 9.104 ms 1,455.52 ms
MSTest 3.10.4 1,305.68 ms 9.067 ms 8.481 ms 1,304.82 ms

windows-latest


BenchmarkDotNet v0.15.2, Windows 10 (10.0.20348.4052) (Hyper-V)
AMD EPYC 7763 2.44GHz, 1 CPU, 4 logical and 2 physical cores
.NET SDK 9.0.304
  [Host]     : .NET 9.0.8 (9.0.825.36511), X64 RyuJIT AVX2
  Job-YNJDZW : .NET 9.0.8 (9.0.825.36511), X64 RyuJIT AVX2

Runtime=.NET 9.0  

Method Version Mean Error StdDev Median
TUnit_AOT 0.57.24 67.70 ms 1.440 ms 4.246 ms 66.47 ms
TUnit 0.57.24 991.80 ms 19.736 ms 28.929 ms 986.33 ms
NUnit 4.4.0 1,357.18 ms 13.302 ms 12.443 ms 1,359.28 ms
xUnit 2.9.3 1,446.33 ms 13.258 ms 11.752 ms 1,448.19 ms
MSTest 3.10.4 1,293.78 ms 10.067 ms 9.417 ms 1,295.59 ms

Scenario: Simple tests with basic operations and assertions

macos-latest


BenchmarkDotNet v0.15.2, macOS Sequoia 15.5 (24F74) [Darwin 24.5.0]
Apple M1 (Virtual), 1 CPU, 3 logical and 3 physical cores
.NET SDK 9.0.304
  [Host]     : .NET 9.0.8 (9.0.825.36511), Arm64 RyuJIT AdvSIMD
  Job-YNJDZW : .NET 9.0.8 (9.0.825.36511), Arm64 RyuJIT AdvSIMD

Runtime=.NET 9.0  

Method Version Mean Error StdDev Median
TUnit_AOT 0.57.24 144.9 ms 10.03 ms 29.56 ms 139.6 ms
TUnit 0.57.24 597.2 ms 18.14 ms 52.33 ms 579.3 ms
NUnit 4.4.0 997.1 ms 74.98 ms 218.71 ms 933.7 ms
xUnit 2.9.3 850.3 ms 22.92 ms 65.77 ms 841.4 ms
MSTest 3.10.4 755.8 ms 20.32 ms 59.27 ms 736.9 ms

ubuntu-latest


BenchmarkDotNet v0.15.2, Linux Ubuntu 24.04.3 LTS (Noble Numbat)
AMD EPYC 7763, 1 CPU, 4 logical and 2 physical cores
.NET SDK 9.0.304
  [Host]     : .NET 9.0.8 (9.0.825.36511), X64 RyuJIT AVX2
  Job-YNJDZW : .NET 9.0.8 (9.0.825.36511), X64 RyuJIT AVX2

Runtime=.NET 9.0  

Method Version Mean Error StdDev Median
TUnit_AOT 0.57.24 25.70 ms 0.504 ms 0.517 ms 25.47 ms
TUnit 0.57.24 927.42 ms 18.102 ms 21.549 ms 915.34 ms
NUnit 4.4.0 1,295.60 ms 9.018 ms 8.435 ms 1,298.18 ms
xUnit 2.9.3 1,361.93 ms 9.564 ms 8.946 ms 1,360.56 ms
MSTest 3.10.4 1,234.26 ms 8.955 ms 8.377 ms 1,237.06 ms

windows-latest


BenchmarkDotNet v0.15.2, Windows 10 (10.0.20348.4052) (Hyper-V)
AMD EPYC 7763 2.44GHz, 1 CPU, 4 logical and 2 physical cores
.NET SDK 9.0.304
  [Host]     : .NET 9.0.8 (9.0.825.36511), X64 RyuJIT AVX2
  Job-YNJDZW : .NET 9.0.8 (9.0.825.36511), X64 RyuJIT AVX2

Runtime=.NET 9.0  

Method Version Mean Error StdDev Median
TUnit_AOT 0.57.24 61.74 ms 1.168 ms 1.200 ms 62.29 ms
TUnit 0.57.24 1,026.12 ms 20.259 ms 36.011 ms 1,027.34 ms
NUnit 4.4.0 1,367.22 ms 8.256 ms 6.894 ms 1,367.64 ms
xUnit 2.9.3 1,440.34 ms 19.238 ms 17.996 ms 1,433.93 ms
MSTest 3.10.4 1,326.16 ms 16.486 ms 14.614 ms 1,321.91 ms

Scenario: Parameterized tests with multiple test cases using data attributes

macos-latest


BenchmarkDotNet v0.15.2, macOS Sequoia 15.5 (24F74) [Darwin 24.5.0]
Apple M1 (Virtual), 1 CPU, 3 logical and 3 physical cores
.NET SDK 9.0.304
  [Host]     : .NET 9.0.8 (9.0.825.36511), Arm64 RyuJIT AdvSIMD
  Job-YNJDZW : .NET 9.0.8 (9.0.825.36511), Arm64 RyuJIT AdvSIMD

Runtime=.NET 9.0  

Method Version Mean Error StdDev Median
TUnit_AOT 0.57.24 NA NA NA NA
TUnit 0.57.24 NA NA NA NA
NUnit 4.4.0 1.454 s 0.1478 s 0.4288 s 1.318 s
xUnit 2.9.3 1.215 s 0.0644 s 0.1807 s 1.191 s
MSTest 3.10.4 1.075 s 0.0668 s 0.1918 s 1.051 s

Benchmarks with issues: RuntimeBenchmarks.TUnit_AOT: Job-YNJDZW(Runtime=.NET 9.0) RuntimeBenchmarks.TUnit: Job-YNJDZW(Runtime=.NET 9.0)

ubuntu-latest


BenchmarkDotNet v0.15.2, Linux Ubuntu 24.04.3 LTS (Noble Numbat)
AMD EPYC 7763, 1 CPU, 4 logical and 2 physical cores
.NET SDK 9.0.304
  [Host]     : .NET 9.0.8 (9.0.825.36511), X64 RyuJIT AVX2
  Job-YNJDZW : .NET 9.0.8 (9.0.825.36511), X64 RyuJIT AVX2

Runtime=.NET 9.0  

Method Version Mean Error StdDev Median
TUnit_AOT 0.57.24 NA NA NA NA
TUnit 0.57.24 NA NA NA NA
NUnit 4.4.0 1.301 s 0.0162 s 0.0152 s 1.297 s
xUnit 2.9.3 1.371 s 0.0110 s 0.0103 s 1.371 s
MSTest 3.10.4 1.246 s 0.0098 s 0.0091 s 1.243 s

Benchmarks with issues: RuntimeBenchmarks.TUnit_AOT: Job-YNJDZW(Runtime=.NET 9.0) RuntimeBenchmarks.TUnit: Job-YNJDZW(Runtime=.NET 9.0)

windows-latest


BenchmarkDotNet v0.15.2, Windows 10 (10.0.20348.4052) (Hyper-V)
AMD EPYC 7763 2.44GHz, 1 CPU, 4 logical and 2 physical cores
.NET SDK 9.0.304
  [Host]     : .NET 9.0.8 (9.0.825.36511), X64 RyuJIT AVX2
  Job-YNJDZW : .NET 9.0.8 (9.0.825.36511), X64 RyuJIT AVX2

Runtime=.NET 9.0  

Method Version Mean Error StdDev Median
TUnit_AOT 0.57.24 NA NA NA NA
TUnit 0.57.24 NA NA NA NA
NUnit 4.4.0 1.419 s 0.0257 s 0.0241 s 1.419 s
xUnit 2.9.3 1.438 s 0.0193 s 0.0180 s 1.436 s
MSTest 3.10.4 1.342 s 0.0222 s 0.0207 s 1.351 s

Benchmarks with issues: RuntimeBenchmarks.TUnit_AOT: Job-YNJDZW(Runtime=.NET 9.0) RuntimeBenchmarks.TUnit: Job-YNJDZW(Runtime=.NET 9.0)

Scenario: Tests utilizing class fixtures and shared test context

macos-latest


BenchmarkDotNet v0.15.2, macOS Sequoia 15.5 (24F74) [Darwin 24.5.0]
Apple M1 (Virtual), 1 CPU, 3 logical and 3 physical cores
.NET SDK 9.0.304
  [Host]     : .NET 9.0.8 (9.0.825.36511), Arm64 RyuJIT AdvSIMD
  Job-YNJDZW : .NET 9.0.8 (9.0.825.36511), Arm64 RyuJIT AdvSIMD

Runtime=.NET 9.0  

Method Version Mean Error StdDev Median
TUnit_AOT 0.57.24 156.5 ms 15.65 ms 46.15 ms 147.2 ms
TUnit 0.57.24 605.0 ms 18.14 ms 52.62 ms 598.3 ms
NUnit 4.4.0 991.5 ms 68.49 ms 197.62 ms 936.9 ms
xUnit 2.9.3 903.6 ms 20.08 ms 58.25 ms 905.9 ms
MSTest 3.10.4 NA NA NA NA

Benchmarks with issues: RuntimeBenchmarks.MSTest: Job-YNJDZW(Runtime=.NET 9.0)

ubuntu-latest


BenchmarkDotNet v0.15.2, Linux Ubuntu 24.04.3 LTS (Noble Numbat)
AMD EPYC 7763, 1 CPU, 4 logical and 2 physical cores
.NET SDK 9.0.304
  [Host]     : .NET 9.0.8 (9.0.825.36511), X64 RyuJIT AVX2
  Job-YNJDZW : .NET 9.0.8 (9.0.825.36511), X64 RyuJIT AVX2

Runtime=.NET 9.0  

Method Version Mean Error StdDev Median
TUnit_AOT 0.57.24 26.91 ms 0.253 ms 0.225 ms 26.89 ms
TUnit 0.57.24 943.89 ms 18.172 ms 22.981 ms 938.79 ms
NUnit 4.4.0 1,308.10 ms 10.602 ms 9.398 ms 1,310.90 ms
xUnit 2.9.3 1,391.49 ms 23.792 ms 22.255 ms 1,383.43 ms
MSTest 3.10.4 NA NA NA NA

Benchmarks with issues: RuntimeBenchmarks.MSTest: Job-YNJDZW(Runtime=.NET 9.0)

windows-latest


BenchmarkDotNet v0.15.2, Windows 10 (10.0.20348.4052) (Hyper-V)
AMD EPYC 7763 2.44GHz, 1 CPU, 4 logical and 2 physical cores
.NET SDK 9.0.304
  [Host]     : .NET 9.0.8 (9.0.825.36511), X64 RyuJIT AVX2
  Job-YNJDZW : .NET 9.0.8 (9.0.825.36511), X64 RyuJIT AVX2

Runtime=.NET 9.0  

Method Version Mean Error StdDev Median
TUnit_AOT 0.57.24 53.08 ms 0.994 ms 1.064 ms 53.11 ms
TUnit 0.57.24 1,008.43 ms 19.548 ms 24.007 ms 1,000.10 ms
NUnit 4.4.0 1,348.25 ms 12.527 ms 12.303 ms 1,346.46 ms
xUnit 2.9.3 1,444.66 ms 15.684 ms 14.671 ms 1,443.64 ms
MSTest 3.10.4 NA NA NA NA

Benchmarks with issues: RuntimeBenchmarks.MSTest: Job-YNJDZW(Runtime=.NET 9.0)

Scenario: Tests executing in parallel to test framework parallelization

macos-latest


BenchmarkDotNet v0.15.2, macOS Sequoia 15.5 (24F74) [Darwin 24.5.0]
Apple M1 (Virtual), 1 CPU, 3 logical and 3 physical cores
.NET SDK 9.0.304
  [Host]     : .NET 9.0.8 (9.0.825.36511), Arm64 RyuJIT AdvSIMD
  Job-YNJDZW : .NET 9.0.8 (9.0.825.36511), Arm64 RyuJIT AdvSIMD

Runtime=.NET 9.0  

Method Version Mean Error StdDev Median
TUnit_AOT 0.57.24 145.9 ms 12.45 ms 35.72 ms 132.9 ms
TUnit 0.57.24 583.5 ms 14.87 ms 42.67 ms 575.8 ms
NUnit 4.4.0 991.0 ms 73.28 ms 211.42 ms 922.0 ms
xUnit 2.9.3 881.2 ms 26.08 ms 76.48 ms 867.7 ms
MSTest 3.10.4 762.3 ms 14.79 ms 32.76 ms 765.3 ms

ubuntu-latest


BenchmarkDotNet v0.15.2, Linux Ubuntu 24.04.3 LTS (Noble Numbat)
AMD EPYC 7763, 1 CPU, 4 logical and 2 physical cores
.NET SDK 9.0.304
  [Host]     : .NET 9.0.8 (9.0.825.36511), X64 RyuJIT AVX2
  Job-YNJDZW : .NET 9.0.8 (9.0.825.36511), X64 RyuJIT AVX2

Runtime=.NET 9.0  

Method Version Mean Error StdDev Median
TUnit_AOT 0.57.24 25.07 ms 0.296 ms 0.247 ms 24.98 ms
TUnit 0.57.24 935.67 ms 17.999 ms 24.028 ms 927.65 ms
NUnit 4.4.0 1,319.65 ms 21.040 ms 19.681 ms 1,327.44 ms
xUnit 2.9.3 1,373.18 ms 8.356 ms 6.978 ms 1,373.86 ms
MSTest 3.10.4 1,252.41 ms 21.681 ms 20.280 ms 1,242.92 ms

windows-latest


BenchmarkDotNet v0.15.2, Windows 10 (10.0.20348.4052) (Hyper-V)
AMD EPYC 7763 2.44GHz, 1 CPU, 4 logical and 2 physical cores
.NET SDK 9.0.304
  [Host]     : .NET 9.0.8 (9.0.825.36511), X64 RyuJIT AVX2
  Job-YNJDZW : .NET 9.0.8 (9.0.825.36511), X64 RyuJIT AVX2

Runtime=.NET 9.0  

Method Version Mean Error StdDev Median
TUnit_AOT 0.57.24 55.25 ms 0.993 ms 1.658 ms 55.32 ms
TUnit 0.57.24 1,011.31 ms 19.780 ms 24.292 ms 1,012.52 ms
NUnit 4.4.0 1,359.47 ms 25.471 ms 23.826 ms 1,358.65 ms
xUnit 2.9.3 1,413.80 ms 12.016 ms 10.652 ms 1,412.58 ms
MSTest 3.10.4 1,294.86 ms 13.855 ms 12.960 ms 1,298.93 ms

Scenario: A test that takes 50ms to execute, repeated 100 times

macos-latest


BenchmarkDotNet v0.15.2, macOS Sequoia 15.5 (24F74) [Darwin 24.5.0]
Apple M1 (Virtual), 1 CPU, 3 logical and 3 physical cores
.NET SDK 9.0.304
  [Host]     : .NET 9.0.8 (9.0.825.36511), Arm64 RyuJIT AdvSIMD
  Job-YNJDZW : .NET 9.0.8 (9.0.825.36511), Arm64 RyuJIT AdvSIMD

Runtime=.NET 9.0  

Method Version Mean Error StdDev Median
TUnit_AOT 0.57.24 NA NA NA NA
TUnit 0.57.24 NA NA NA NA
NUnit 4.4.0 NA NA NA NA
xUnit 2.9.3 NA NA NA NA
MSTest 3.10.4 NA NA NA NA

Benchmarks with issues: RuntimeBenchmarks.TUnit_AOT: Job-YNJDZW(Runtime=.NET 9.0) RuntimeBenchmarks.TUnit: Job-YNJDZW(Runtime=.NET 9.0) RuntimeBenchmarks.NUnit: Job-YNJDZW(Runtime=.NET 9.0) RuntimeBenchmarks.xUnit: Job-YNJDZW(Runtime=.NET 9.0) RuntimeBenchmarks.MSTest: Job-YNJDZW(Runtime=.NET 9.0)

ubuntu-latest


BenchmarkDotNet v0.15.2, Linux Ubuntu 24.04.3 LTS (Noble Numbat)
AMD EPYC 7763, 1 CPU, 4 logical and 2 physical cores
.NET SDK 9.0.304
  [Host]     : .NET 9.0.8 (9.0.825.36511), X64 RyuJIT AVX2
  Job-YNJDZW : .NET 9.0.8 (9.0.825.36511), X64 RyuJIT AVX2

Runtime=.NET 9.0  

Method Version Mean Error StdDev Median
TUnit_AOT 0.57.24 NA NA NA NA
TUnit 0.57.24 NA NA NA NA
NUnit 4.4.0 NA NA NA NA
xUnit 2.9.3 NA NA NA NA
MSTest 3.10.4 NA NA NA NA

Benchmarks with issues: RuntimeBenchmarks.TUnit_AOT: Job-YNJDZW(Runtime=.NET 9.0) RuntimeBenchmarks.TUnit: Job-YNJDZW(Runtime=.NET 9.0) RuntimeBenchmarks.NUnit: Job-YNJDZW(Runtime=.NET 9.0) RuntimeBenchmarks.xUnit: Job-YNJDZW(Runtime=.NET 9.0) RuntimeBenchmarks.MSTest: Job-YNJDZW(Runtime=.NET 9.0)

windows-latest


BenchmarkDotNet v0.15.2, Windows 10 (10.0.20348.4052) (Hyper-V)
AMD EPYC 7763 2.44GHz, 1 CPU, 4 logical and 2 physical cores
.NET SDK 9.0.304
  [Host]     : .NET 9.0.8 (9.0.825.36511), X64 RyuJIT AVX2
  Job-YNJDZW : .NET 9.0.8 (9.0.825.36511), X64 RyuJIT AVX2

Runtime=.NET 9.0  

Method Version Mean Error StdDev Median
TUnit_AOT 0.57.24 NA NA NA NA
TUnit 0.57.24 NA NA NA NA
NUnit 4.4.0 NA NA NA NA
xUnit 2.9.3 NA NA NA NA
MSTest 3.10.4 NA NA NA NA

Benchmarks with issues: RuntimeBenchmarks.TUnit_AOT: Job-YNJDZW(Runtime=.NET 9.0) RuntimeBenchmarks.TUnit: Job-YNJDZW(Runtime=.NET 9.0) RuntimeBenchmarks.NUnit: Job-YNJDZW(Runtime=.NET 9.0) RuntimeBenchmarks.xUnit: Job-YNJDZW(Runtime=.NET 9.0) RuntimeBenchmarks.MSTest: Job-YNJDZW(Runtime=.NET 9.0)

Scenario: Tests with setup and teardown lifecycle methods

macos-latest


BenchmarkDotNet v0.15.2, macOS Sequoia 15.5 (24F74) [Darwin 24.5.0]
Apple M1 (Virtual), 1 CPU, 3 logical and 3 physical cores
.NET SDK 9.0.304
  [Host]     : .NET 9.0.8 (9.0.825.36511), Arm64 RyuJIT AdvSIMD
  Job-YNJDZW : .NET 9.0.8 (9.0.825.36511), Arm64 RyuJIT AdvSIMD

Runtime=.NET 9.0  

Method Version Mean Error StdDev Median
TUnit_AOT 0.57.24 110.0 ms 1.03 ms 0.91 ms 110.0 ms
TUnit 0.57.24 643.8 ms 32.55 ms 93.92 ms 615.5 ms
NUnit 4.4.0 821.2 ms 28.58 ms 83.82 ms 784.5 ms
xUnit 2.9.3 958.6 ms 52.01 ms 150.88 ms 942.6 ms
MSTest 3.10.4 758.5 ms 17.88 ms 51.60 ms 758.1 ms

ubuntu-latest


BenchmarkDotNet v0.15.2, Linux Ubuntu 24.04.3 LTS (Noble Numbat)
AMD EPYC 7763, 1 CPU, 4 logical and 2 physical cores
.NET SDK 9.0.304
  [Host]     : .NET 9.0.8 (9.0.825.36511), X64 RyuJIT AVX2
  Job-YNJDZW : .NET 9.0.8 (9.0.825.36511), X64 RyuJIT AVX2

Runtime=.NET 9.0  

Method Version Mean Error StdDev Median
TUnit_AOT 0.57.24 27.59 ms 0.431 ms 0.382 ms 27.61 ms
TUnit 0.57.24 991.59 ms 18.835 ms 20.153 ms 996.44 ms
NUnit 4.4.0 1,363.54 ms 19.683 ms 17.448 ms 1,370.90 ms
xUnit 2.9.3 1,421.67 ms 22.542 ms 21.086 ms 1,415.81 ms
MSTest 3.10.4 1,298.15 ms 13.429 ms 12.562 ms 1,300.88 ms

windows-latest


BenchmarkDotNet v0.15.2, Windows 10 (10.0.20348.4052) (Hyper-V)
AMD EPYC 7763 2.44GHz, 1 CPU, 4 logical and 2 physical cores
.NET SDK 9.0.304
  [Host]     : .NET 9.0.8 (9.0.825.36511), X64 RyuJIT AVX2
  Job-YNJDZW : .NET 9.0.8 (9.0.825.36511), X64 RyuJIT AVX2

Runtime=.NET 9.0  

Method Version Mean Error StdDev Median
TUnit_AOT 0.57.24 47.57 ms 0.927 ms 0.992 ms 46.91 ms
TUnit 0.57.24 987.26 ms 19.615 ms 23.350 ms 982.30 ms
NUnit 4.4.0 1,306.80 ms 7.338 ms 6.505 ms 1,306.14 ms
xUnit 2.9.3 1,367.02 ms 17.109 ms 15.167 ms 1,370.32 ms
MSTest 3.10.4 1,264.40 ms 5.830 ms 5.168 ms 1,264.42 ms