KaizenReport.Kensho.Xunit
0.3.0
dotnet add package KaizenReport.Kensho.Xunit --version 0.3.0
NuGet\Install-Package KaizenReport.Kensho.Xunit -Version 0.3.0
<PackageReference Include="KaizenReport.Kensho.Xunit" Version="0.3.0" />
<PackageVersion Include="KaizenReport.Kensho.Xunit" Version="0.3.0" />
<PackageReference Include="KaizenReport.Kensho.Xunit" />
paket add KaizenReport.Kensho.Xunit --version 0.3.0
#r "nuget: KaizenReport.Kensho.Xunit, 0.3.0"
#:package KaizenReport.Kensho.Xunit@0.3.0
#addin nuget:?package=KaizenReport.Kensho.Xunit&version=0.3.0
#tool nuget:?package=KaizenReport.Kensho.Xunit&version=0.3.0
KaizenReport.Kensho.Xunit
xUnit hook that emits the canonical Kensho v1 JSON format.
xUnit doesn't ship a logger SPI like NUnit's ITestEventListener or
VSTest's ITestLogger, so this adapter uses xUnit's
BeforeAfterTestAttribute extensibility point. Apply the attribute at
the assembly level (or inherit KenshoTestBase) and the writer takes
care of the rest.
Install
dotnet add package KaizenReport.Kensho.Xunit
Wire it up by adding one line:
[assembly: KaizenReport.Kensho.Xunit.KenshoTracked]
Or extend the helper base class:
public class CartTests : KaizenReport.Kensho.Xunit.KenshoTestBase
{
[Fact]
public void Adds_first_item() { /* ... */ }
}
Run
dotnet test
# => kensho-results/run.json + kensho-results/cases/*.json
npx kensho generate
npx kensho open
Configuration
Environment variables:
| Env var | Effect |
|---|---|
KENSHO_OUTPUT |
Output dir (default: ./kensho-results) |
KENSHO_PROJECT_NAME |
Project name in run.json |
KENSHO_PROJECT_SLUG |
Project slug |
KENSHO_RUN_ID |
Override the auto-generated run id |
Mapping xUnit → Kensho
| xUnit | Kensho |
|---|---|
[Fact] / [Theory] |
One case |
[InlineData(...)] / [MemberData(...)] / [ClassData(...)] |
One case per row, args round-tripped from the display name into case.parameters[] |
[Trait("severity","blocker")] |
case.severity = "blocker" |
[Trait("feature","Cart")] |
case.behavior.feature |
[Trait("epic","Checkout")] |
case.behavior.epic |
[Trait("story","...")] |
case.behavior.scenario |
[Trait("owner","alice")] |
case.owner |
[Trait("description","...")] |
case.description |
[Trait("tag","smoke")] / [Trait("category","x")] |
case.tags[] |
Other [Trait("k","v")] |
case.labels["k"] = "v" |
| Test passed | pass |
| Test failed | fail (see "Outcome detection" below) |
| Test skipped | skip |
Outcome detection — known limitation
xUnit's BeforeAfterTestAttribute does not receive the test outcome
in After(). The pragmatic workaround:
- The helper API still works —
using (Kensho.Step("..."))blocks that throw will be markedfail, and the case status reflects them. - For assertion failures outside of a step, wrap the assertion in a
Kensho.Step("assert ...")block. xUnit's exception will close the step asfail, which the writer reads as a failed case. - Alternatively, install the framework name as
junit-xml(the default) and add a small post-run xUnit logger pass — outside the scope of this adapter.
Because the xUnit name is not in the Kensho v1 framework enum, the
adapter writes framework.name = "junit-xml". Bumping the schema to
add xunit is a v2 concern.
Helper API
using KaizenReport.Kensho.Core;
using Xunit;
public class LoginTests : KaizenReport.Kensho.Xunit.KenshoTestBase
{
[Fact]
public void Redirects_to_home_after_signin()
{
using (Kensho.Step("open the login page"))
Page.Goto("/login");
using (Kensho.Step("submit credentials"))
{
Page.Fill("#user", "demo");
Page.Click("text=Sign in");
}
Kensho.Label("team", "growth");
Kensho.Link("https://jira.example.com/browse/PROJ-123",
kind: "jira", label: "PROJ-123");
Kensho.Attach("/tmp/login.png", kind: "screenshot");
}
}
License
Apache-2.0.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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 was computed. 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. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- KaizenReport.Kensho.Core (>= 0.3.0)
- xunit.extensibility.core (>= 2.6.1)
- xunit.extensibility.execution (>= 2.6.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.