SweDevTools.LiveDoc.xUnit 0.2.0

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

SweDevTools.LiveDoc.xUnit

A BDD-style testing framework for xUnit that brings the clarity and readability of Gherkin specifications to C#.

📖 Full Documentation →

Quick Start

1. Install the package

dotnet add package SweDevTools.LiveDoc.xUnit

2. Create a test class

using SweDevTools.LiveDoc.xUnit;
using Xunit.Abstractions;

[Feature]
public class ShippingCostsTests : FeatureTest
{
    public ShippingCostsTests(ITestOutputHelper output) : base(output) { }

    private ShoppingCart _cart = new();

    [Scenario]
    public void Free_shipping_in_Australia()
    {
        Given("the customer is from Australia", () =>
        {
            _cart.Country = "Australia";
        });

        When("the customer's order totals '$100'", ctx =>
        {
            _cart.AddItem(new CartItem { Price = ctx.Step!.Values[0].AsDecimal() });
            _cart.Calculate();
        });

        Then("they are charged 'Free' shipping", ctx =>
        {
            Assert.Equal(ctx.Step!.Values[0].AsString(), _cart.ShippingType);
        });
    }
}

3. Run your tests

dotnet test

Output is beautifully formatted in Gherkin style in the Test Detail Summary panel.


AI Coding Skills

Install the LiveDoc AI skill for your coding assistant:

dotnet msbuild -t:LiveDocInstallSkills

Supports GitHub Copilot, Claude Code, Roo Code, Cursor, and Windsurf. See the AI Skill Setup Guide for details.


Journey Scaffolding from .http files

The package includes a journey generator executable and MSBuild target that can scaffold LiveDoc xUnit tests from annotated .http files.

Enable it in your test project:

<PropertyGroup>
  <LiveDocJourneysEnabled>true</LiveDocJourneysEnabled>
  <LiveDocJourneysDir>$(MSBuildProjectDirectory)\..\..\journeys</LiveDocJourneysDir>
  <LiveDocJourneyOutputDir>$(MSBuildProjectDirectory)\Journeys</LiveDocJourneyOutputDir>
  <LiveDocJourneyBaseNamespace>MyProject.Specs.Journeys</LiveDocJourneyBaseNamespace>
  <LiveDocJourneyInfrastructureNamespace>MyProject.Specs.Journeys.Infrastructure</LiveDocJourneyInfrastructureNamespace>
  <LiveDocJourneyFixtureType>JourneyServerFixture</LiveDocJourneyFixtureType>
  <LiveDocJourneyMode>scaffold</LiveDocJourneyMode>
  <LiveDocHttpYacEnsure>check</LiveDocHttpYacEnsure>
</PropertyGroup>
  • LiveDocJourneyMode: scaffold, validate, or force
  • LiveDocHttpYacEnsure: check, auto-install, or off

The generated journey tests expect the configured fixture type to expose the same runtime API used by the reference pattern (RunJourneyAsync, LoadResponseFile, JourneysDir).

Capture Mode

Auto-generate .Response.json contract files by running journeys against a live server:

dotnet msbuild -t:LiveDocCaptureJourneys \
  -p:LiveDocCaptureVars="--var baseUrl=http://localhost:5000 --var adminToken=my-token"

This runs each .http file via httpYac, captures response bodies, and saves them as contract files. Use -p:LiveDocCaptureOverwrite=true to regenerate existing contracts.


Documentation

📖 Full documentation at livedoc.swedevtools.com →

Covers getting started, features, specifications, value extraction, scenario outlines, viewer integration, debugging, best practices, and more.


License

MIT

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 was computed.  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

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.2.0 92 4/22/2026