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("john.doe@example.com");

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

    await Assert.That(user.Email)
        .IsEqualTo("john.doe@example.com");
}

🎯 Data-Driven Testing

[Test]
[Arguments("user1@test.com", "ValidPassword123")]
[Arguments("user2@test.com", "AnotherPassword456")]
[Arguments("admin@test.com", "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 Sonoma 14.7.6 (23H626) [Darwin 23.6.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.1 1.070 s 0.0395 s 0.1127 s 1.0489 s
Build_NUnit 4.4.0 1.128 s 0.0786 s 0.2304 s 1.0753 s
Build_xUnit 2.9.3 1.011 s 0.0398 s 0.1162 s 0.9856 s
Build_MSTest 3.10.2 1.018 s 0.0465 s 0.1370 s 0.9742 s

ubuntu-latest


BenchmarkDotNet v0.15.2, Linux Ubuntu 24.04.2 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.1 1.864 s 0.0343 s 0.0563 s 1.854 s
Build_NUnit 4.4.0 1.534 s 0.0194 s 0.0172 s 1.533 s
Build_xUnit 2.9.3 1.551 s 0.0126 s 0.0117 s 1.554 s
Build_MSTest 3.10.2 1.551 s 0.0242 s 0.0226 s 1.551 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.1 1.866 s 0.0368 s 0.0655 s 1.859 s
Build_NUnit 4.4.0 1.558 s 0.0265 s 0.0273 s 1.574 s
Build_xUnit 2.9.3 1.558 s 0.0261 s 0.0244 s 1.560 s
Build_MSTest 3.10.2 1.559 s 0.0153 s 0.0135 s 1.558 s

Scenario: Tests focused on assertion performance and validation

macos-latest


BenchmarkDotNet v0.15.2, macOS Sonoma 14.7.6 (23H626) [Darwin 23.6.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.1 NA NA NA NA
TUnit 0.57.1 NA NA NA NA
NUnit 4.4.0 NA NA NA NA
xUnit 2.9.3 NA NA NA NA
MSTest 3.10.2 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.2 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.1 NA NA NA NA
TUnit 0.57.1 NA NA NA NA
NUnit 4.4.0 NA NA NA NA
xUnit 2.9.3 NA NA NA NA
MSTest 3.10.2 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.1 NA NA NA NA
TUnit 0.57.1 NA NA NA NA
NUnit 4.4.0 NA NA NA NA
xUnit 2.9.3 NA NA NA NA
MSTest 3.10.2 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 Sonoma 14.7.6 (23H626) [Darwin 23.6.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.1 93.57 ms 1.832 ms 2.628 ms 92.88 ms
TUnit 0.57.1 638.23 ms 15.982 ms 46.621 ms 640.30 ms
NUnit 4.4.0 795.77 ms 16.791 ms 48.714 ms 796.41 ms
xUnit 2.9.3 842.98 ms 18.862 ms 55.320 ms 845.14 ms
MSTest 3.10.2 734.61 ms 14.687 ms 39.201 ms 729.18 ms

ubuntu-latest


BenchmarkDotNet v0.15.2, Linux Ubuntu 24.04.2 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.1 27.60 ms 0.242 ms 0.226 ms 27.66 ms
TUnit 0.57.1 950.14 ms 18.500 ms 21.305 ms 949.73 ms
NUnit 4.4.0 1,327.77 ms 16.299 ms 15.246 ms 1,326.99 ms
xUnit 2.9.3 1,420.52 ms 11.791 ms 9.846 ms 1,420.35 ms
MSTest 3.10.2 1,274.85 ms 9.582 ms 8.001 ms 1,277.84 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.1 63.28 ms 1.231 ms 1.417 ms 62.50 ms
TUnit 0.57.1 1,027.30 ms 20.091 ms 23.136 ms 1,026.13 ms
NUnit 4.4.0 1,429.26 ms 28.551 ms 39.081 ms 1,420.45 ms
xUnit 2.9.3 1,508.59 ms 10.202 ms 9.543 ms 1,509.08 ms
MSTest 3.10.2 1,349.78 ms 16.275 ms 15.223 ms 1,346.82 ms

Scenario: Simple tests with basic operations and assertions

macos-latest


BenchmarkDotNet v0.15.2, macOS Sonoma 14.7.6 (23H626) [Darwin 23.6.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.1 108.8 ms 4.25 ms 11.93 ms 104.8 ms
TUnit 0.57.1 700.4 ms 48.22 ms 142.19 ms 641.5 ms
NUnit 4.4.0 966.6 ms 43.50 ms 125.51 ms 935.2 ms
xUnit 2.9.3 927.6 ms 41.55 ms 121.20 ms 901.8 ms
MSTest 3.10.2 780.5 ms 20.89 ms 61.26 ms 788.4 ms

ubuntu-latest


BenchmarkDotNet v0.15.2, Linux Ubuntu 24.04.2 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.1 27.80 ms 0.545 ms 0.605 ms 27.86 ms
TUnit 0.57.1 961.82 ms 18.707 ms 28.567 ms 960.94 ms
NUnit 4.4.0 1,307.59 ms 18.466 ms 16.370 ms 1,304.20 ms
xUnit 2.9.3 1,377.66 ms 12.424 ms 11.621 ms 1,376.23 ms
MSTest 3.10.2 1,246.71 ms 12.384 ms 11.584 ms 1,242.57 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.1 55.80 ms 1.088 ms 1.489 ms 55.46 ms
TUnit 0.57.1 993.90 ms 19.424 ms 24.565 ms 997.01 ms
NUnit 4.4.0 1,333.75 ms 12.000 ms 11.225 ms 1,335.31 ms
xUnit 2.9.3 1,390.91 ms 11.064 ms 10.349 ms 1,388.71 ms
MSTest 3.10.2 1,277.25 ms 8.568 ms 8.015 ms 1,279.95 ms

Scenario: Parameterized tests with multiple test cases using data attributes

macos-latest


BenchmarkDotNet v0.15.2, macOS Sonoma 14.7.6 (23H626) [Darwin 23.6.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.1 NA NA NA NA
TUnit 0.57.1 NA NA NA NA
NUnit 4.4.0 977.8 ms 67.99 ms 190.66 ms 930.7 ms
xUnit 2.9.3 844.4 ms 17.99 ms 52.20 ms 820.3 ms
MSTest 3.10.2 811.2 ms 36.18 ms 102.62 ms 792.1 ms

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.2 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.1 NA NA NA NA
TUnit 0.57.1 NA NA NA NA
NUnit 4.4.0 1.286 s 0.0144 s 0.0135 s 1.281 s
xUnit 2.9.3 1.356 s 0.0116 s 0.0109 s 1.351 s
MSTest 3.10.2 1.233 s 0.0088 s 0.0074 s 1.233 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.1 NA NA NA NA
TUnit 0.57.1 NA NA NA NA
NUnit 4.4.0 1.331 s 0.0176 s 0.0165 s 1.327 s
xUnit 2.9.3 1.376 s 0.0116 s 0.0097 s 1.377 s
MSTest 3.10.2 1.279 s 0.0164 s 0.0153 s 1.278 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 Sonoma 14.7.6 (23H626) [Darwin 23.6.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.1 89.32 ms 2.651 ms 7.563 ms 88.37 ms
TUnit 0.57.1 647.89 ms 24.996 ms 73.702 ms 633.08 ms
NUnit 4.4.0 797.25 ms 23.006 ms 66.376 ms 778.82 ms
xUnit 2.9.3 1,032.78 ms 34.587 ms 101.981 ms 1,016.54 ms
MSTest 3.10.2 907.92 ms 26.952 ms 78.192 ms 899.58 ms

ubuntu-latest


BenchmarkDotNet v0.15.2, Linux Ubuntu 24.04.2 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.1 26.33 ms 0.166 ms 0.139 ms 26.32 ms
TUnit 0.57.1 950.98 ms 15.664 ms 14.652 ms 949.59 ms
NUnit 4.4.0 1,311.38 ms 9.445 ms 8.835 ms 1,312.31 ms
xUnit 2.9.3 1,391.09 ms 12.243 ms 10.853 ms 1,389.79 ms
MSTest 3.10.2 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.1 53.50 ms 1.060 ms 2.348 ms 53.31 ms
TUnit 0.57.1 1,007.58 ms 19.536 ms 22.497 ms 1,002.27 ms
NUnit 4.4.0 1,344.89 ms 11.696 ms 10.941 ms 1,343.43 ms
xUnit 2.9.3 1,417.17 ms 11.463 ms 10.161 ms 1,417.08 ms
MSTest 3.10.2 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 Sonoma 14.7.6 (23H626) [Darwin 23.6.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.1 90.81 ms 1.804 ms 3.112 ms 89.42 ms
TUnit 0.57.1 553.98 ms 11.028 ms 29.437 ms 558.64 ms
NUnit 4.4.0 750.93 ms 15.005 ms 39.790 ms 743.56 ms
xUnit 2.9.3 787.26 ms 15.729 ms 43.058 ms 780.67 ms
MSTest 3.10.2 720.10 ms 15.213 ms 44.618 ms 711.54 ms

ubuntu-latest


BenchmarkDotNet v0.15.2, Linux Ubuntu 24.04.2 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.1 26.93 ms 0.211 ms 0.197 ms 26.91 ms
TUnit 0.57.1 955.27 ms 18.226 ms 18.717 ms 949.58 ms
NUnit 4.4.0 1,353.14 ms 23.628 ms 22.101 ms 1,342.55 ms
xUnit 2.9.3 1,412.00 ms 13.684 ms 11.426 ms 1,415.62 ms
MSTest 3.10.2 1,332.24 ms 12.068 ms 10.698 ms 1,329.54 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.1 51.62 ms 1.027 ms 2.651 ms 51.21 ms
TUnit 0.57.1 996.11 ms 19.059 ms 20.393 ms 992.91 ms
NUnit 4.4.0 1,351.22 ms 17.989 ms 16.827 ms 1,348.02 ms
xUnit 2.9.3 1,402.05 ms 19.963 ms 18.673 ms 1,402.10 ms
MSTest 3.10.2 1,284.92 ms 14.406 ms 13.475 ms 1,284.40 ms

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

macos-latest


BenchmarkDotNet v0.15.2, macOS Sonoma 14.7.6 (23H626) [Darwin 23.6.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.1 NA NA NA NA
TUnit 0.57.1 NA NA NA NA
NUnit 4.4.0 NA NA NA NA
xUnit 2.9.3 NA NA NA NA
MSTest 3.10.2 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.2 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.1 NA NA NA NA
TUnit 0.57.1 NA NA NA NA
NUnit 4.4.0 NA NA NA NA
xUnit 2.9.3 NA NA NA NA
MSTest 3.10.2 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.1 NA NA NA NA
TUnit 0.57.1 NA NA NA NA
NUnit 4.4.0 NA NA NA NA
xUnit 2.9.3 NA NA NA NA
MSTest 3.10.2 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 Sonoma 14.7.6 (23H626) [Darwin 23.6.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.1 108.4 ms 3.09 ms 8.82 ms 110.2 ms
TUnit 0.57.1 709.1 ms 29.60 ms 86.80 ms 688.6 ms
NUnit 4.4.0 924.4 ms 37.54 ms 110.68 ms 911.3 ms
xUnit 2.9.3 855.5 ms 29.40 ms 85.29 ms 840.3 ms
MSTest 3.10.2 914.8 ms 24.99 ms 72.10 ms 907.5 ms

ubuntu-latest


BenchmarkDotNet v0.15.2, Linux Ubuntu 24.04.2 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.1 27.30 ms 0.280 ms 0.248 ms 27.23 ms
TUnit 0.57.1 973.78 ms 18.855 ms 20.957 ms 978.18 ms
NUnit 4.4.0 1,342.02 ms 15.406 ms 14.411 ms 1,342.78 ms
xUnit 2.9.3 1,406.28 ms 9.363 ms 8.300 ms 1,407.05 ms
MSTest 3.10.2 1,291.61 ms 8.551 ms 7.580 ms 1,289.84 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.1 49.00 ms 0.952 ms 1.018 ms 48.92 ms
TUnit 0.57.1 988.42 ms 19.214 ms 18.871 ms 979.33 ms
NUnit 4.4.0 1,329.58 ms 10.821 ms 10.122 ms 1,328.27 ms
xUnit 2.9.3 1,382.73 ms 18.600 ms 16.489 ms 1,386.15 ms
MSTest 3.10.2 1,279.43 ms 8.031 ms 7.120 ms 1,279.52 ms