![]() |
VOOZH | about |
dotnet add package TUnit.OpenTelemetry --version 1.56.0
NuGet\Install-Package TUnit.OpenTelemetry -Version 1.56.0
<PackageReference Include="TUnit.OpenTelemetry" Version="1.56.0" />
<PackageVersion Include="TUnit.OpenTelemetry" Version="1.56.0" />Directory.Packages.props
<PackageReference Include="TUnit.OpenTelemetry" />Project file
paket add TUnit.OpenTelemetry --version 1.56.0
#r "nuget: TUnit.OpenTelemetry, 1.56.0"
#:package TUnit.OpenTelemetry@1.56.0
#addin nuget:?package=TUnit.OpenTelemetry&version=1.56.0Install as a Cake Addin
#tool nuget:?package=TUnit.OpenTelemetry&version=1.56.0Install as a Cake Tool
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">
๐ 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>
[DependsOn] to express ordering and [ParallelLimiter] to cap concurrency[Arguments], [Matrix], [ClassData], and custom DataSourceGenerator<T> sourcesasync, incorrect method signatures, and invalid attribute combinations[Before] / [After] at method, class, assembly, or test session scopedotnet new install TUnit.Templates
dotnet new TUnit -n "MyTestProject"
cd MyTestProject
dotnet run
dotnet add package TUnit
Getting Started Guide ยท Migration Guides
[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);
}
[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();
}
[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
}
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 | 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 |
| 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.Assertions.Should |
Optional FluentAssertions-style value.Should().BeEqualTo(...) syntax over TUnit.Assertions (beta) |
TUnit.Mocks |
Source-generated, AOT-compatible mocking framework โ works with any test runner |
TUnit.Mocks.Http |
HttpClient mocking helpers built on TUnit.Mocks |
TUnit.Mocks.Logging |
ILogger capture/verification helpers built on TUnit.Mocks |
TUnit.AspNetCore |
ASP.NET Core integration โ WebApplicationFactory-based test fixtures |
TUnit.Aspire |
Aspire integration โ distributed app host fixtures with OpenTelemetry capture |
TUnit.Playwright |
Playwright integration with automatic browser lifecycle management |
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.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 is compatible. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 is compatible. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
Showing the top 2 NuGet packages that depend on TUnit.OpenTelemetry:
| Package | Downloads |
|---|---|
|
TUnit.AspNetCore.Core
A .NET Testing Framework |
|
|
TUnit.Aspire.Core
A .NET Testing Framework |
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.56.0 | 748 | 6/15/2026 |
| 1.55.2 | 637 | 6/14/2026 |
| 1.55.0 | 142 | 6/14/2026 |
| 1.54.0 | 418 | 6/12/2026 |
| 1.53.0 | 2,195 | 6/8/2026 |
| 1.51.0 | 698 | 6/7/2026 |
| 1.50.0 | 444 | 6/5/2026 |
| 1.49.0 | 1,272 | 6/3/2026 |
| 1.48.6 | 17,335 | 6/1/2026 |
| 1.48.0 | 577 | 5/31/2026 |
| 1.47.0 | 977 | 5/29/2026 |
| 1.46.0 | 344 | 5/28/2026 |
| 1.45.29 | 2,856 | 5/21/2026 |
| 1.45.22 | 727 | 5/20/2026 |
| 1.45.8 | 1,603 | 5/18/2026 |
| 1.45.0 | 4,927 | 5/18/2026 |
| 1.44.39 | 1,900 | 5/14/2026 |
| 1.44.0 | 4,279 | 5/10/2026 |
| 1.43.41 | 1,393 | 5/9/2026 |
| 1.43.38 | 186 | 5/8/2026 |