TracingAssertions.TUnit 0.1.2

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

TracingAssertions.TUnit

NuGet License: MIT .NET

Scope: Test projects only. Not intended for production code.

TUnit-native OpenTelemetry distributed-tracing (Activity / span) assertions for .NET tests. Fluent entry points over TUnit's Assert.That(...) pipeline for asserting on captured spans. AOT-compatible, trimmable, no runtime reflection in the assertion path.

What ships

Span assertions on Assert.That(span) where span is a System.Diagnostics.Activity:

Entry point Behavior
HasOperationName(name) Asserts the span's OperationName equals name (ordinal).
HasTag(key) Asserts a tag key is present (non-null value).
HasTagValue(key, value) Asserts the tag key matches value (compared by invariant ToString).
HasStatus(status) Asserts the span's Status equals the given ActivityStatusCode.
IsChildOf(parent) Asserts a single-hop parent/child relationship in the same trace.
SharesTraceWith(other) Asserts two spans share a TraceId.
HasSpan(operationName) (on SpanCapture) Asserts the capture contains a span with that operation name.

The framework-agnostic core (TracingAssertions) ships SpanCapture for collecting spans from one or more ActivitySources via a raw ActivityListener (no OpenTelemetry SDK or NuGet runtime dependency), plus the query helpers FindByOperationName, FindByOperationNameAndTag, and ChildrenOf.

Install

dotnet add package TracingAssertions.TUnit

Requirements: TUnit 1.50.0 or later, .NET 10. The framework-agnostic TracingAssertions core comes transitively.

Quick start

using System.Diagnostics;
using TracingAssertions;

using var capture = SpanCapture.ForSource("MyCompany.MyService");

using (var span = MyActivitySource.StartActivity("order.created"))
{
    await Assert.That(span).HasOperationName("order.created");
}

The full reference is in the GitHub README.

License

MIT. No runtime dependencies beyond the BCL.

Product Compatible and additional computed target framework versions.
.NET 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

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
0.1.2 0 6/6/2026
0.1.1 49 6/5/2026
0.1.0 69 6/4/2026
0.0.1 51 6/4/2026

View the rendered release notes: https://github.com/JohnVerheij/TracingAssertions.TUnit/releases/tag/v0.1.2

Metadata-only release. No API or behavior change.

### Fixed

- Corrected the NuGet package `<Description>`. It described a foundation release carrying only `HasOperationName` and said the full fluent surface "lands in 0.1.0"; the package has shipped the complete surface (operation name, tag existence and value, status, parent/child, same-trace) since 0.1.0. The description now matches the README.

### Added

- README: a short example showing `.Because(reason)` chained on a span assertion, plus a test covering it. `.Because` is inherited from TUnit's base assertion type and has always worked on the generated span assertions; the note makes that explicit.

### Changed

- The release workflow now publishes the matching `CHANGELOG.md` section as the GitHub release body (`body_path`), so release notes carry the full hand-written detail instead of GitHub's auto-generated commit summary.