Labcoat.Aspire.Hosting 1.2.2

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

Labcoat.Aspire.Hosting

Aspire hosting integration for Labcoat, a web UI for Microsoft.Testing.Platform tests. Add it to your AppHost and Labcoat shows up as a resource in the Aspire dashboard, with a Labcoat UI link, commands to run your tests and the suite result in the resource state.

Labcoat showing a failed test with its source, error and an expected/actual diff

Install

dotnet add MyApp.AppHost package Labcoat.Aspire.Hosting

The package contains Labcoat itself. On build it is copied to your AppHost's output folder (bin/<config>/<tfm>/labcoat/) and started from there with dotnet, so there is nothing else to install. It needs Aspire 13.4.5 or later.

Usage

var builder = DistributedApplication.CreateBuilder(args);

var api = builder.AddProject<Projects.MyApp_Api>("api");

builder.AddLabcoat("tests");     // scans the solution for test projects

builder.Build().Run();

Options:

builder.AddLabcoat("tests")
       .WithTestProject("../MyApp.Tests")   // repeatable: a .csproj, solution or directory, relative to the AppHost
       .WithWatch()                         // start with watch mode on
       .WithCoverage()                      // start with code coverage on
       .WithTestTracing()                   // start with per-test traces on
       .WithTestTimeout(TimeSpan.FromMinutes(5)) // optional per-test timeout (off by default)
       .WithHostPort(4300);                 // a fixed port instead of a random one

Vitest projects: add the Labcoat.Vitest package to the AppHost too. Each Labcoat resource then runs .NET and Vitest tests; WithRunners picks per resource:

builder.AddLabcoat("tests-dotnet").WithRunners("dotnet");   // MSTest, NUnit, xUnit v3, TUnit
builder.AddLabcoat("tests-web").WithTestProject("../MyApp.Web").WithRunners("vitest");

See docs/runners.md.

Or all in one place, with defaults for the Labcoat UI's settings (theme, mode, motion, editor, coverage tint, confetti, …). A choice made in the browser wins over a default, unless the setting is locked:

builder.AddLabcoat("tests", labcoat =>
{
    labcoat.TestProjects.Add("../MyApp.Tests");
    labcoat.Watch = true;
    labcoat.Ui.Theme = LabcoatTheme.Aspire;
    labcoat.Ui.Mode = LabcoatThemeMode.Dark;
    labcoat.Ui.Editor = LabcoatEditor.Rider;
    labcoat.Ui.Lock(s => s.Editor);       // shown disabled: "Set by the AppHost (Program.cs)"
});

// or on the resource builder
builder.AddLabcoat("smoke").WithUiSettings(ui => ui.Confetti = true);

The same options can come from appsettings.json (section Labcoat, or Labcoat:Resources:<name> for one resource).

Tests run with the environment dotnet test gets in your terminal: the variables of the Aspire run (ASPIRE_* such as ASPIRE_BACKCHANNEL_PATH, DCP_*, the Labcoat resource's OTEL_* and PORT, ...) are left out, so a nested AppHost in a test doesn't talk to the outer aspire CLI or dashboard. Keep one your tests need with .WithPassThroughEnvironment("NAME"), or set one for the tests with .WithTestEnvironment("NAME", "value").

In the dashboard

  • A Labcoat UI link on the resource, and a link back to the dashboard in the UI.
  • The suite result as the resource state: ✓ 12 passed, ✕ 1 failed · 20 tests, ▶ Running 3/20.
  • Commands: Run all tests, Run failed tests, Cancel run, Restart test host, Toggle watch mode, Toggle code coverage and Toggle test tracing.

Traces and logs per test (opt-in)

Turned on (.WithTestTracing(), the Toggle test tracing command or the toggle in the UI), every test links to the traces and structured logs it caused in the dashboard, and a failed integration test shows the error spans and warning logs of the services it called inline. Your tests need the package for their test framework for that: Labcoat.Testing.MSTest or Labcoat.Testing.TUnit.

To trace only some tests, pass a filter in the UI's search syntax: .WithTestTracing(filter: "cat:Integration") (or o.TestTracingFilter, "Labcoat": { "TestTracingFilter": "cat:Integration" } in appsettings.json). See Trace only some tests.

More

The full guide, including how to keep an Aspire app warm between test runs: docs/aspire.md.

MIT license. Not affiliated with or endorsed by Microsoft or the .NET Foundation.

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
1.2.2 88 11/1/2026
1.2.1 109 11/1/2026
1.2.0 122 11/1/2026
1.1.2 907 10/16/2026
1.1.1 642 10/11/2026
1.1.0 210 10/11/2026
1.0.0 124 10/11/2026