TUnit.Assertions.FSharp 0.90.0

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package TUnit.Assertions.FSharp --version 0.90.0
                    
NuGet\Install-Package TUnit.Assertions.FSharp -Version 0.90.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="TUnit.Assertions.FSharp" Version="0.90.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="TUnit.Assertions.FSharp" Version="0.90.0" />
                    
Directory.Packages.props
<PackageReference Include="TUnit.Assertions.FSharp" />
                    
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 TUnit.Assertions.FSharp --version 0.90.0
                    
#r "nuget: TUnit.Assertions.FSharp, 0.90.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 TUnit.Assertions.FSharp@0.90.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=TUnit.Assertions.FSharp&version=0.90.0
                    
Install as a Cake Addin
#tool nuget:?package=TUnit.Assertions.FSharp&version=0.90.0
                    
Install as a Cake Tool

alternate text is missing from this package README image

🚀 The Modern Testing Framework for .NET

TUnit is a modern testing framework for .NET that uses source-generated tests, parallel execution by default, and Native AOT support. Built on Microsoft.Testing.Platform, it's faster than traditional reflection-based frameworks and gives you more control over how your tests run.

<div align="center">

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

</div>

Why 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 Native AOT & trimming
Test Dependencies ❌ Not supported [DependsOn] chains
Resource Management ❌ Manual lifecycle Automatic cleanup

Parallel by Default - Tests run concurrently with dependency management

Compile-Time Discovery - Test structure is known before runtime

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

Extensible - Customize data sources, attributes, and test behavior


<div align="center">

Documentation

New to TUnit? Start with the Getting Started Guide

Migrating? See the Migration Guides

Learn more: Data-Driven Testing, Test Dependencies, Parallelism Control

</div>


Quick Start

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

Manual Installation

dotnet add package TUnit --prerelease

📖 Complete Documentation & Guides

Key Features

<table> <tr> <td width="50%">

Performance

  • Source-generated tests (no reflection)
  • Parallel execution by default
  • Native AOT & trimming support
  • Optimized for speed

</td> <td width="50%">

Test Control

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

</td> </tr> <tr> <td>

Data & Assertions

  • Multiple data sources ([Arguments], [Matrix], [ClassData])
  • Fluent async assertions
  • Retry logic & conditional execution
  • Test metadata & context

</td> <td>

Developer Tools

  • Full dependency injection support
  • Lifecycle hooks
  • IDE integration (VS, Rider, VS Code)
  • Documentation & examples

</td> </tr> </table>

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
}

Custom 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 });
}

Common Use Cases

<table> <tr> <td width="33%">

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);
}

</td> <td width="33%">

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();
}

</td> <td width="33%">

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);
}

</td> </tr> </table>

What Makes TUnit Different?

Compile-Time Test Discovery

Tests are discovered at build time, not runtime. This means faster discovery, better IDE integration, and more predictable resource management.

Parallel by Default

Tests run in parallel by default. Use [DependsOn] to chain tests together, and [ParallelLimit] to control resource usage.

Extensible

The DataSourceGenerator<T> pattern and custom attribute system let you extend TUnit without modifying the framework.

Community & Ecosystem

<div align="center">

Downloads Contributors Discussions

</div>

Resources

IDE Support

TUnit works with all major .NET IDEs:

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 > Testing Platform

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 uses familiar syntax with some additions:

// TUnit test with dependency management and retries
[Test]
[Arguments("value1")]
[Arguments("value2")]
[Retry(3)]
[ParallelLimit<CustomLimit>]
public async Task Modern_TUnit_Test(string value) { }

📖 Need help migrating? Check our Migration Guides for xUnit, NUnit, and MSTest.

Current Status

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


<div align="center">

Getting Started

# Create a new test project
dotnet new install TUnit.Templates && dotnet new TUnit -n "MyTestProject"

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

Learn More: tunit.dev | Get Help: GitHub Discussions | Star on GitHub: github.com/thomhurst/TUnit

</div>

Performance Benchmark

Scenario: Building the test project


BenchmarkDotNet v0.15.5, Linux Ubuntu 24.04.3 LTS (Noble Numbat)
Intel Xeon Platinum 8370C CPU 2.80GHz (Max: 2.79GHz), 1 CPU, 4 logical and 2 physical cores
.NET SDK 10.0.100-rc.2.25502.107
  [Host]     : .NET 10.0.0 (10.0.0-rc.2.25502.107, 10.0.25.50307), X64 RyuJIT x86-64-v4
  Job-GVKUBM : .NET 10.0.0 (10.0.0-rc.2.25502.107, 10.0.25.50307), X64 RyuJIT x86-64-v4

Runtime=.NET 10.0  

Method Version Mean Error StdDev Median
Build_TUnit 0.86.10 1.745 s 0.0348 s 0.0326 s 1.746 s
Build_NUnit 4.4.0 1.543 s 0.0158 s 0.0148 s 1.538 s
Build_MSTest 4.0.1 1.613 s 0.0197 s 0.0184 s 1.616 s
Build_xUnit3 3.1.0 1.513 s 0.0157 s 0.0147 s 1.518 s

Scenario: Tests running asynchronous operations and async/await patterns


BenchmarkDotNet v0.15.5, Linux Ubuntu 24.04.3 LTS (Noble Numbat)
AMD EPYC 7763 2.45GHz, 1 CPU, 4 logical and 2 physical cores
.NET SDK 10.0.100-rc.2.25502.107
  [Host]     : .NET 10.0.0 (10.0.0-rc.2.25502.107, 10.0.25.50307), X64 RyuJIT x86-64-v3
  Job-GVKUBM : .NET 10.0.0 (10.0.0-rc.2.25502.107, 10.0.25.50307), X64 RyuJIT x86-64-v3

Runtime=.NET 10.0  

Method Version Mean Error StdDev Median
TUnit 0.86.10 550.3 ms 5.18 ms 4.84 ms 549.2 ms
NUnit 4.4.0 699.9 ms 6.28 ms 5.88 ms 700.4 ms
MSTest 4.0.1 667.9 ms 7.47 ms 6.23 ms 666.9 ms
xUnit3 3.1.0 641.9 ms 3.04 ms 2.84 ms 641.9 ms
TUnit_AOT 0.86.10 173.8 ms 0.58 ms 0.54 ms 173.9 ms

Scenario: Parameterized tests with multiple test cases using data attributes


BenchmarkDotNet v0.15.5, Linux Ubuntu 24.04.3 LTS (Noble Numbat)
AMD EPYC 7763 2.45GHz, 1 CPU, 4 logical and 2 physical cores
.NET SDK 10.0.100-rc.2.25502.107
  [Host]     : .NET 10.0.0 (10.0.0-rc.2.25502.107, 10.0.25.50307), X64 RyuJIT x86-64-v3
  Job-GVKUBM : .NET 10.0.0 (10.0.0-rc.2.25502.107, 10.0.25.50307), X64 RyuJIT x86-64-v3

Runtime=.NET 10.0  

Method Version Mean Error StdDev Median
TUnit 0.86.10 519.03 ms 5.999 ms 5.611 ms 519.52 ms
NUnit 4.4.0 619.54 ms 12.145 ms 17.025 ms 614.65 ms
MSTest 4.0.1 632.36 ms 12.544 ms 12.319 ms 631.28 ms
xUnit3 3.1.0 507.74 ms 4.370 ms 4.087 ms 506.88 ms
TUnit_AOT 0.86.10 74.88 ms 0.324 ms 0.303 ms 74.93 ms

Scenario: Tests executing massively parallel workloads with CPU-bound, I/O-bound, and mixed operations


BenchmarkDotNet v0.15.5, Linux Ubuntu 24.04.3 LTS (Noble Numbat)
Intel Xeon Platinum 8370C CPU 2.80GHz (Max: 2.79GHz), 1 CPU, 4 logical and 2 physical cores
.NET SDK 10.0.100-rc.2.25502.107
  [Host]     : .NET 10.0.0 (10.0.0-rc.2.25502.107, 10.0.25.50307), X64 RyuJIT x86-64-v4
  Job-GVKUBM : .NET 10.0.0 (10.0.0-rc.2.25502.107, 10.0.25.50307), X64 RyuJIT x86-64-v4

Runtime=.NET 10.0  

Method Version Mean Error StdDev Median
TUnit 0.86.10 696.8 ms 5.14 ms 4.81 ms 696.1 ms
NUnit 4.4.0 1,202.2 ms 6.87 ms 6.09 ms 1,202.2 ms
MSTest 4.0.1 3,001.0 ms 5.96 ms 5.28 ms 3,001.6 ms
xUnit3 3.1.0 2,966.4 ms 8.21 ms 7.28 ms 2,964.4 ms
TUnit_AOT 0.86.10 279.2 ms 0.66 ms 0.62 ms 279.1 ms

Scenario: Tests with complex parameter combinations creating 25-125 test variations


BenchmarkDotNet v0.15.5, Linux Ubuntu 24.04.3 LTS (Noble Numbat)
AMD EPYC 7763 2.45GHz, 1 CPU, 4 logical and 2 physical cores
.NET SDK 10.0.100-rc.2.25502.107
  [Host]     : .NET 10.0.0 (10.0.0-rc.2.25502.107, 10.0.25.50307), X64 RyuJIT x86-64-v3
  Job-GVKUBM : .NET 10.0.0 (10.0.0-rc.2.25502.107, 10.0.25.50307), X64 RyuJIT x86-64-v3

Runtime=.NET 10.0  

Method Version Mean Error StdDev Median
TUnit 0.86.10 626.5 ms 6.15 ms 5.75 ms 624.8 ms
NUnit 4.4.0 1,535.8 ms 10.02 ms 8.37 ms 1,533.9 ms
MSTest 4.0.1 1,499.8 ms 9.65 ms 9.03 ms 1,499.5 ms
xUnit3 3.1.0 1,517.8 ms 5.74 ms 5.37 ms 1,516.8 ms
TUnit_AOT 0.86.10 177.0 ms 0.49 ms 0.43 ms 177.0 ms

Scenario: Large-scale parameterized tests with 100+ test cases testing framework scalability


BenchmarkDotNet v0.15.5, Linux Ubuntu 24.04.3 LTS (Noble Numbat)
AMD EPYC 7763 2.62GHz, 1 CPU, 4 logical and 2 physical cores
.NET SDK 10.0.100-rc.2.25502.107
  [Host]     : .NET 10.0.0 (10.0.0-rc.2.25502.107, 10.0.25.50307), X64 RyuJIT x86-64-v3
  Job-GVKUBM : .NET 10.0.0 (10.0.0-rc.2.25502.107, 10.0.25.50307), X64 RyuJIT x86-64-v3

Runtime=.NET 10.0  

Method Version Mean Error StdDev Median
TUnit 0.86.10 520.12 ms 6.200 ms 5.496 ms 519.39 ms
NUnit 4.4.0 688.25 ms 8.293 ms 7.757 ms 686.78 ms
MSTest 4.0.1 686.01 ms 11.597 ms 10.280 ms 687.04 ms
xUnit3 3.1.0 492.65 ms 3.582 ms 3.176 ms 492.63 ms
TUnit_AOT 0.86.10 80.02 ms 0.194 ms 0.162 ms 79.99 ms
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in 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.0.0 29 11/5/2025
0.90.45 96 11/5/2025
0.90.42 55 11/4/2025
0.90.38 65 11/4/2025
0.90.35 56 11/4/2025
0.90.32 56 11/4/2025
0.90.28 66 11/4/2025
0.90.19 120 11/3/2025
0.90.17 86 11/3/2025
0.90.6 147 11/2/2025
0.90.0 132 11/2/2025
0.89.2 95 11/2/2025
0.89.0 123 11/1/2025
0.88.0 159 11/1/2025
0.87.8 178 10/31/2025
0.86.10 195 10/30/2025
0.86.5 233 10/30/2025
0.86.0 191 10/30/2025
0.85.1 193 10/29/2025
0.85.0 174 10/29/2025
0.81.7 208 10/29/2025
0.81.0 177 10/29/2025
0.80.0 224 10/28/2025
0.79.0 190 10/28/2025
0.78.0 290 10/28/2025
0.77.10 264 10/27/2025
0.77.3 226 10/27/2025
0.77.0 200 10/26/2025
0.76.26 205 10/26/2025
0.76.18 220 10/25/2025
0.76.11 243 10/25/2025
0.76.7 249 10/24/2025
0.76.0 140 10/24/2025
0.75.30 352 10/23/2025
0.75.11 327 10/22/2025
0.75.5 194 10/22/2025
0.75.4 184 10/22/2025
0.75.0 237 10/21/2025
0.74.2 239 10/20/2025
0.74.0 172 10/20/2025
0.73.19 229 10/18/2025
0.73.14 147 10/17/2025
0.73.11 165 10/17/2025
0.73.4 240 10/16/2025
0.73.0 212 10/16/2025
0.72.0 258 10/15/2025
0.71.4 189 10/14/2025
0.71.0 212 10/14/2025
0.70.7 187 10/14/2025
0.70.4 195 10/14/2025
0.70.2 185 10/13/2025
0.70.0 180 10/13/2025
0.67.19 689 10/10/2025
0.67.10 507 10/8/2025
0.67.9 163 10/8/2025
0.67.4 270 10/7/2025
0.67.0 202 10/6/2025
0.66.13 231 10/6/2025
0.66.6 229 10/6/2025
0.66.0 208 10/5/2025
0.64.0 290 10/5/2025
0.63.3 489 10/2/2025
0.63.0 214 10/2/2025
0.61.58 435 9/29/2025
0.61.39 370 9/25/2025
0.61.38 181 9/25/2025
0.61.31 257 9/24/2025
0.61.25 213 9/23/2025
0.61.22 206 9/22/2025
0.61.13 373 9/21/2025
0.61.6 257 9/21/2025
0.61.2 217 9/20/2025
0.60.15 189 9/20/2025
0.60.1 437 9/19/2025
0.59.0 268 9/19/2025
0.58.3 387 9/18/2025
0.58.0 312 9/18/2025
0.57.65 668 9/10/2025
0.57.63 196 9/10/2025
0.57.24 645 8/30/2025
0.57.1 421 8/21/2025
0.57.0 169 8/21/2025
0.56.50 306 8/20/2025
0.56.44 286 8/18/2025
0.56.35 265 8/17/2025
0.56.5 1,008 8/14/2025
0.55.23 548 8/13/2025
0.55.21 245 8/13/2025
0.55.6 521 8/12/2025
0.55.0 263 8/11/2025
0.53.0 721 8/8/2025
0.52.64 333 8/7/2025
0.52.60 278 8/7/2025
0.52.56 327 8/7/2025
0.52.51 267 8/7/2025
0.52.49 326 8/7/2025
0.52.47 254 8/7/2025
0.52.30 401 8/6/2025
0.52.25 421 8/6/2025
0.52.24 267 8/6/2025
0.52.22 323 8/6/2025
0.52.8 315 8/6/2025
0.52.2 246 8/6/2025
0.52.0 247 8/6/2025
0.50.0 548 8/3/2025
0.25.21 379 6/10/2025
0.25.6 178 6/5/2025
0.25.0 215 6/5/2025
0.24.0 2,447 6/1/2025
0.23.5 222 6/1/2025
0.23.0 142 5/31/2025
0.22.31 142 5/30/2025
0.22.24 248 5/28/2025
0.22.20 218 5/27/2025
0.22.12 272 5/25/2025
0.22.10 254 5/25/2025
0.22.6 159 5/24/2025
0.21.16 347 5/21/2025
0.21.13 210 5/20/2025
0.21.7 215 5/20/2025
0.21.1 283 5/19/2025
0.20.18 206 5/19/2025
0.20.16 206 5/18/2025
0.20.11 190 5/18/2025
0.20.4 165 5/17/2025