Skip to content

Diagram Customisation

aryehcitron@gmail.com edited this page Nov 5, 2026 · 20 revisions

The TrackingDiagramOverride static class (available in every integration package) lets you manually control what appears in the generated diagrams.

TrackingDiagramOverride API

Each integration package provides a TrackingDiagramOverride class that wraps the core DefaultTrackingDiagramOverride and automatically resolves the current test ID from the framework's test context. The API is identical across all integrations:

TrackingDiagramOverride.StartOverride(plantUml?);
TrackingDiagramOverride.EndOverride(plantUml?);
TrackingDiagramOverride.InsertPlantUml(plantUml);
TrackingDiagramOverride.InsertTestDelimiter(testIdentifier);
TrackingDiagramOverride.StartSetup();
TrackingDiagramOverride.StartAction();

Direct use (v2.0.131+): DefaultTrackingDiagramOverride also accepts a Func<string> delegate for test ID resolution, so you can call it directly without the framework-specific wrapper:

DefaultTrackingDiagramOverride.StartOverride(() => TestContext.Current.Test!.UniqueID);
DefaultTrackingDiagramOverride.InsertPlantUml(() => myTestId, "note across: custom");

StartOverride / EndOverride

Suppress automatic diagram generation for a section of your test. Any HTTP calls made between StartOverride() and EndOverride() will not appear in the diagram. Optionally inject custom PlantUML at the start/end boundaries:

TrackingDiagramOverride.StartOverride("note across: Starting setup phase");

// These HTTP calls will NOT appear in the diagram
await client.PostAsync("/api/seed-data", content);

TrackingDiagramOverride.EndOverride("note across: Setup complete");

InsertPlantUml

Insert arbitrary PlantUML code into the diagram at the current position:

TrackingDiagramOverride.InsertPlantUml("note across: User is now authenticated");
TrackingDiagramOverride.InsertPlantUml("== Phase 2: Order Processing ==");

Any valid PlantUML syntax can be injected — notes, dividers, delays, groups, etc.

InsertTestDelimiter

Insert a visual test boundary marker in the diagram. Useful when a single test logically contains multiple phases:

TrackingDiagramOverride.InsertTestDelimiter("Verify Initial State");
// ... test code ...
TrackingDiagramOverride.InsertTestDelimiter("Verify After Update");

This renders as a black horizontal note across all participants with white text showing Test {identifier}.

Tip: InsertTestDelimiter is particularly useful when using TabularAttributes, where a single scenario runs multiple iterations. Insert a delimiter between each iteration to clearly separate them in the diagram.

Setup Separation

Setup separation visually distinguishes the "arrange" phase of a test from the "act" phase in the generated sequence diagrams by wrapping setup HTTP calls in a PlantUML partition block.

To enable it, set SeparateSetup = true on ReportConfigurationOptions:

new ReportConfigurationOptions
{
    SeparateSetup = true,
    HighlightSetup = true // default — adds a background colour to the partition
}
Property Effect
SeparateSetup = false No partition — all calls rendered sequentially (default)
SeparateSetup = true, HighlightSetup = true Setup calls wrapped in a coloured partition
SeparateSetup = true, HighlightSetup = false Setup calls wrapped in a plain partition (no background colour)

From 5.8.0 the partition is a rounded frame with a thin light edge. Its default background (#F6F6F6) follows the report's theme, so the dark theme draws a dark Setup box (before 5.8.0 it stayed near-white there, and the labels in it were hard to read). A colour set with SetupHighlightColor is kept as it is. See Report Themes.

Example diagram with SeparateSetup enabled

The boundary between setup and action is determined by:

  1. Explicit — Call TrackingDiagramOverride.StartAction() in your test code (see StartAction below)
  2. From the steps — Drawn once per test, the first time its steps go from a Setup step to an Action step: a GIVEN step then a WHEN or THEN step on BDDfy, LightBDD and ReqNRoll, and since 5.31.0 a [GivenStep] then a [WhenStep] on any suite (a [ThenStep] draws none, as a test's body can hold its act between a Given and a Then). It no longer needs an HTTP call on either side. A GIVEN step with no tracked call draws no partition, and a test whose first act comes before any Setup step draws none, as a partition over that act would have the Setup filter hide it. A framework that starts no steps, through a custom CurrentStepTypeFetcher, has its client mark the boundary just before its first request in a later step, once a request was made during a GIVEN step.
  3. Ingested runs (4.1.0+) — kronikol ingest --separate-setup places the boundary from each test's steps (the first When or Then step after a Given step), else from its calls' phases; a capture that carries its own boundary keeps it. See Ingesting External Captures › The Setup partition

StartAction

For non-BDD frameworks (or to override automatic detection), explicitly mark the boundary by calling TrackingDiagramOverride.StartAction(). Only the first explicit call logs a marker, and it replaces a boundary the same step drew:

// Setup phase — these calls appear inside the partition
await client.PostAsync("/api/seed-data", content);
await client.PostAsync("/api/configure", settings);

TrackingDiagramOverride.StartAction();

// Action phase — these calls appear after the partition
var response = await client.GetAsync("/api/cake");

Steps: the boundary is drawn automatically at the step that goes from Setup to Action. You only need StartAction() to override it, which works while that framework step is open in your flow, or at any time after a step attribute drew it. So to put what a When does before the boundary, call it inside that When. After that framework step has ended, StartAction() logs nothing, so a marking check in a Then does not swallow the When into the partition. To have no partition, leave SeparateSetup off.

StartSetup

Explicitly mark the beginning of the setup phase. This sets the ambient TestPhaseContext.Current to Setup, enabling Phase-Aware Tracking — per-phase verbosity overrides and enable/disable toggles on all tracking extensions.

TrackingDiagramOverride.StartSetup();

// Setup phase — tracking extensions can use different verbosity or be disabled
await client.PostAsync("/api/seed-data", content);

TrackingDiagramOverride.StartAction();

// Action phase — full tracking detail
var response = await client.GetAsync("/api/cake");

BDD frameworks: the step keyword sets the phase automatically: Given → Setup, When and Then → Action, and And and But continue the step before. You only need StartSetup() explicitly in non-BDD tests.

See Phase-Aware Tracking for the full guide on configuring per-phase verbosity and enable/disable behaviour.

Field Highlighting with DiagramFocus

For controlling which JSON fields are visually emphasised or de-emphasised within diagram notes, see Content Formatting › DiagramFocus (Field Highlighting). The preferred approach is the fluent WithDiagramFocus() extension method on HttpClient, which makes the association between focus and HTTP call explicit:

var response = await client.WithDiagramFocus()
                           .OnRequest<CreateCakeRequest>(x => x.Flour, x => x.Eggs)
                           .OnResponse<CreateCakeResponse>(x => x.BatchId)
                           .PostAsJsonAsync("/api/cake", requestBody);

Focused fields are rendered in bold (or coloured), while non-focused fields are grayed out or hidden. Configure the styling globally via the FocusEmphasis and FocusDeEmphasis properties on ReportConfigurationOptions.

PlantUML Themes

You can apply a PlantUML theme to all generated diagrams by setting the PlantUmlTheme property on ReportConfigurationOptions:

new ReportConfigurationOptions
{
    PlantUmlTheme = "spacelab"
}

This injects a !theme spacelab directive into every generated diagram. What the directive does depends on the rendering mode:

PlantUmlRendering What a theme does
Server, Local The engine applies it: colours, fonts and styling change to match the theme. Themes are not checked against Kronikol's notes and page, and some of them hide arrow labels or note controls.
BrowserJs (the default), NodeJs Nothing: the renderer loads the engine without its theme bundle, so every diagram is drawn unthemed, and the engine warns (themes.js could not be loaded) in the browser console. Under NodeJs the warning goes to the Node renderer's stderr, which Kronikol does not keep for a diagram that renders. From 3.30.0 the run also records an OptionNotApplied diagnostic naming the option and the mode, in TestRunReport.json and in kronikol query summary. From 3.0.76 to 3.29.5 a theme under these modes left the report without diagrams; see [[PlantUML Browser Rendering

The directive is written into every diagram source either way, so it is in the report's JSON and mergeable output too. Making a theme work under every mode, notes included, is planned (THEME_PLAN.md under plans/ in the repository).

Browse available themes:

When PlantUmlTheme is null (the default), no theme directive is emitted and diagrams use PlantUML's default styling.

Tip: You can also use themes hosted on remote URLs by specifying the full !theme directive value, e.g. "amiga from https://raw.githubusercontent.com/plantuml/plantuml/master/themes".

Dependency-Type Coloring

By default, sequence diagram arrows and participants are coloured by the target service's dependency type. This is determined automatically from the DependencyCategory set by extension packages (CosmosDB, Redis, EF Core, ServiceBus, BigQuery, BlobStorage).

Default Palette

Dependency Type Colour Hex Shape
HTTP API Blue #438DD5 entity
Database Red #E74C3C database
Cache Orange #F39C12 collections
Message Queue Purple #9B59B6 queue
Storage Green #2ECC71 database
Unknown Grey #95A5A6 participant

Disabling Arrow Colors

new ReportConfigurationOptions
{
    SequenceDiagramArrowColors = false  // plain arrows, no dependency coloring
}

Enabling Participant Background Colors

new ReportConfigurationOptions
{
    SequenceDiagramParticipantColors = true  // add colored backgrounds to participant boxes
}

Custom Colors per Dependency

new ReportConfigurationOptions
{
    DependencyColors = new Dictionary<string, string>
    {
        ["CosmosDB"] = "#FF0000",  // red for CosmosDB
        ["Redis"] = "#00FF00"      // green for Redis
    }
}

Overriding Service Types

If a service is being mis-classified (e.g., a caching proxy showing as HTTP instead of Cache), use ServiceTypeOverrides:

new ReportConfigurationOptions
{
    ServiceTypeOverrides = new Dictionary<string, string>
    {
        ["CachingProxy"] = "Redis"  // treat CachingProxy as Cache type
    }
}

Home · 🔍 Search this wiki Full-text search across every page. The “Pages” list above matches page and heading names, not page content.


Demo


Getting Started

Common Tasks

Integration Guides

Uninstrumentable / polyglot backends

Extensions

Configuration

Features

Reference

Clone this wiki locally