Skip to main content

TUNITTesting Made Simple

Modern .NET Testing

A modern testing framework for .NET built with performance in mind. Leveraging source generation and AOT compilation for efficient test execution.

SourceGenerated
AOTCompatible
ParallelExecution
CalculatorTests.cs
[Test]
public async Task MyTest()
{
// Arrange
var calculator = new Calculator();

// Act
var result = calculator.Add(2, 3);

// Assert
await Assert.That(result).IsEqualTo(5);
}
Test Results
MyTest 2ms
1 test passed • 0 failed • 2ms total

Quick Start

Get up and running in seconds

1

Install

dotnet add package TUnit
2

Write

[Test]
public async Task TestAddition()
{
await Assert.That(1 + 1).IsEqualTo(2);
}
3

Run

dotnet test

Core Features

Everything you need for modern test development

🔧

Flexible Test Design

Multiple ways to write, inject data, and control tests. Support for data-driven testing, matrix tests, and custom data sources.

[Test]
[Arguments(1, 2, 3)]
[Arguments(4, 5, 9)]
public void TestAdd(int a, int b, int expected)
{
Assert.That(a + b).IsEqualTo(expected);
}

Intuitive Syntax

Clean attribute-based syntax that's easy to read and write. Fluent assertions make tests expressive and self-documenting.

[Test]
public async Task TestAsync()
{
var result = await GetDataAsync();
await Assert.That(result)
.IsNotNull()
.And.HasCount(5);
}

Performance Optimized

Source generated tests with Native AOT support. Built on Microsoft Testing Platform to reduce overhead and improve efficiency.

// AOT Compatible
[Test]
public void PerformantTest()
{
// Source generated
// No reflection overhead
Assert.That(true).IsTrue();
}

Why TUnit?

Built for modern .NET development

Performance Focused

Source generated code eliminates reflection overhead. Built on the modern Microsoft Testing Platform.

🎯

Compile-Time Validation

Source generators provide early error detection and full IntelliSense support.

🚀

AOT Compatible

Native AOT support enables faster startup times and reduced memory usage.

🔧

Extensible

Rich extension points and customization options to fit your testing needs.

📊

Data Driven

Powerful data source attributes for parameterized and matrix testing.

🎨

Modern API

Fluent assertions, async-first design, and intuitive test organization.