xUnit

<PackageReference Include="Tracera.Xunit" Version="*" />

Requires .NET ≥ 8 and xUnit.net v3 (see Autotest adapters). Tracera.Xunit on NuGet.

Environment variables, run mode, and retries: Autotest adapters.

Register the adapter once per test assembly:

[assembly: TraceraXunit]
[assembly: TestPipelineStartup(typeof(TraceraXunitStartup))]

Bind testCaseId and autotestName

Use stock xUnit APIs and the global Tracera type.

At declaration (preferred — bind runs even if the body skips early):

using Xunit;

public class LoginTests
{
    [Fact]
    [Tracera.Id(42, name: "e2e/login")]
    public void Login()
    {
        Assert.True(true);
    }
}

Inside the test:

[Fact]
public void Login()
{
    Tracera.TestCase(42, "e2e/login");
    Assert.True(true);
}

Skip

Use stock xUnit skip (Assert.Skip, [Fact(Skip = "…")], …). The skip reason is added to the result as comment.

Steps

Use Tracera.Step("…", () => { … }), Tracera.Step("…", async () => { … }) (async lambdas are awaited), or put [Tracera.Step("…")] on a method (sync and async Task). With [Tracera.Step], if the title is empty or omitted, the step title becomes the method name; {0} / {name} in the title are filled from the method arguments. The constructor and IAsyncLifetime.InitializeAsync map to Setup; IDisposable / IAsyncDisposable map to Teardown; the test method body is Test. If an IClassFixture / constructor / InitializeAsync fails before the body runs, declaratively bound tests still report Failed (empty steps, fixture error on the result).

using Xunit;

public class CheckoutTests
{
    [Tracera.Step("add {sku}")]
    public void AddSku(string sku) { }

    [Fact]
    [Tracera.Id(10, name: "e2e/checkout")]
    public void Checkout()
    {
        AddSku("SKU-1");
        Tracera.Step("pay", () => { });
    }
}

Comments, errors, and attachments

Comments, errors, and attachments: Autotest adapters.

Tracera.Comment("result-level note");
Tracera.Error("result-level error text");
Tracera.Step("open login", () =>
{
    Tracera.Comment("landed on login");
});

Parameterized tests

Put [Tracera.Id] on each [Theory] method (same id for every row, or call Tracera.TestCase inside when the id varies). Optional name may include placeholders: {login} (and other argument names) from the method parameters, or {param_id} for the xUnit test name. If name is omitted, autotestName takes the value of the xUnit test name.

[Tracera.Id(42, name: "login as {login}")]
[Theory]
[InlineData("ok")]
[InlineData("sso")]
public void Login(string login)
{
    Assert.False(string.IsNullOrEmpty(login));
}