TUnit.Logging.Microsoft 1.19.22

Prefix Reserved
dotnet add package TUnit.Logging.Microsoft --version 1.19.22
                    
NuGet\Install-Package TUnit.Logging.Microsoft -Version 1.19.22
                    
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.Logging.Microsoft" Version="1.19.22" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="TUnit.Logging.Microsoft" Version="1.19.22" />
                    
Directory.Packages.props
<PackageReference Include="TUnit.Logging.Microsoft" />
                    
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.Logging.Microsoft --version 1.19.22
                    
#r "nuget: TUnit.Logging.Microsoft, 1.19.22"
                    
#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.Logging.Microsoft@1.19.22
                    
#: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.Logging.Microsoft&version=1.19.22
                    
Install as a Cake Addin
#tool nuget:?package=TUnit.Logging.Microsoft&version=1.19.22
                    
Install as a Cake Tool

TUnit

TUnit

A modern .NET testing framework. Tests are source-generated at compile time, run in parallel by default, and support Native AOT — all built on Microsoft.Testing.Platform.

<div align="center">

thomhurst%2FTUnit | Trendshift

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

</div>

Features

  • Compile-time test discovery — tests are generated at build time rather than discovered via reflection at runtime, which means faster startup and better IDE integration
  • Parallel by default — tests run concurrently; use [DependsOn] to express ordering and [ParallelLimiter] to cap concurrency
  • Data-driven testing[Arguments], [Matrix], [ClassData], and custom DataSourceGenerator<T> sources
  • Async assertions with detailed failure messages
  • Built-in Roslyn analyzers — catch mistakes at compile time, such as missing async, incorrect method signatures, and invalid attribute combinations
  • Extensible — write your own skip conditions, retry logic, and attributes
  • Native AOT & trimming support
  • Lifecycle hooks[Before] / [After] at method, class, assembly, or test session scope

Getting Started

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

Manual Installation

dotnet add package TUnit

Getting Started Guide · Migration Guides

Examples

Basic test with assertions

[Test]
public async Task Parsing_A_Valid_Date_Succeeds()
{
    var date = DateTime.Parse("2025-01-01");

    await Assert.That(date.Year).IsEqualTo(2025);
    await Assert.That(date.Month).IsEqualTo(1);
}

Data-driven tests

[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 — generates a test for every combination (9 total here)
[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();
}

Hooks, dependencies, and retry

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

[Test]
[MethodDataSource(nameof(GetTestUsers))]
public async Task Register_User(string username, string password) { ... }

[Test, DependsOn(nameof(Register_User))]
[Retry(3)]
public async Task Login_With_Registered_User(string username, string password)
{
    // Guaranteed to run after Register_User passes
}

Custom attributes

Extend built-in base classes to create your own skip conditions, retry logic, and more:

public class WindowsOnlyAttribute : SkipAttribute
{
    public WindowsOnlyAttribute() : base("Windows only") { }

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

[Test, WindowsOnly]
public async Task Windows_Specific_Feature() { ... }

See the documentation for more examples, including custom retry logic and data sources.

IDE Support

IDE Notes
Visual Studio 2022 (17.13+) Works out of the box
Visual Studio 2022 (earlier) Enable "Use testing platform server mode" in Tools > Manage Preview Features
JetBrains Rider Enable "Testing Platform support" in Settings > Build, Execution, Deployment > Unit Testing > Testing Platform
VS Code Install C# Dev Kit and enable "Use Testing Platform Protocol"
CLI Works with dotnet test, dotnet run, and direct execution

Packages

Package Purpose
TUnit Start here — the full framework (Core + Engine + Assertions)
TUnit.Core Shared test library components without an execution engine
TUnit.Engine Execution engine for test projects
TUnit.Assertions Standalone assertions — works with other test frameworks too
TUnit.Playwright Playwright integration with automatic browser lifecycle management

Migrating from xUnit, NUnit, or MSTest?

The syntax will feel familiar. For example, xUnit's [Fact] becomes [Test], and [Theory] + [InlineData] becomes [Test] + [Arguments]. See the migration guides for full details: xUnit · NUnit · MSTest.

Community

Product Compatible and additional computed target framework versions.
.NET 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on TUnit.Logging.Microsoft:

Package Downloads
TUnit.AspNetCore

A .NET Testing Framework

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.19.22 163 3/10/2026
1.19.16 267 3/9/2026
1.19.11 112 3/8/2026
1.19.0 150 3/6/2026
1.18.37 144 3/6/2026
1.18.21 353 3/3/2026
1.18.9 224 3/3/2026
1.18.0 921 3/2/2026
1.17.54 434 2/27/2026
1.17.36 197 2/26/2026
1.17.29 167 2/26/2026
1.17.25 126 2/25/2026
1.17.20 121 2/25/2026
1.17.11 302 2/24/2026
1.17.7 581 2/22/2026
1.17.4 124 2/22/2026
1.17.0 161 2/22/2026
1.16.4 1,085 2/18/2026
1.16.0 137 2/18/2026
1.15.11 320 2/18/2026
Loading failed