Skip to main content

Intro

TUnit is another testing framework for C# / .NET. Use it for unit testing, integration testing, acceptance testing, or anything else.

TUnit provides flexible ways to inject test data (new or shared instances) and hooks to run before and after tests, with minimal opinions on test style.

Built on Microsoft.Testing.Platform for simpler, more extensible .NET testing.

Performance

TUnit is designed for speed. Through source generation and compile-time optimizations, TUnit significantly outperforms traditional testing frameworks. See the performance benchmarks for real-world speed comparisons.

What's in These Docs

  • Getting Started — Install TUnit, write your first test, and run it
  • Writing Tests — Test data, lifecycle hooks, dependency injection, parallelism, and mocking
  • Assertions — Fluent assertion syntax for values, collections, strings, exceptions, and more
  • Running Tests — Filters, timeouts, retries, CI/CD reporting, and AOT
  • Integrations — ASP.NET Core, Aspire, Playwright, and other integration examples
  • Extending TUnit — Custom data sources, formatters, and event subscribers
  • Comparing Frameworks — Feature comparisons with xUnit, NUnit, and MSTest
  • Migration — Step-by-step guides for switching from xUnit, NUnit, or MSTest