Repository navigation
Marking New and Changed Tests
If you already know which tests a pull request added and which it edited, from your own script, a test-impact tool or
a diff of the test files, you can mark them in the Kronikol report. Give each one of two tags, pr-new or
pr-edited here (any names work). The report then has a chip for each in its Tags row, @pr-new in the search
keeps them, and kronikol query scenarios <reports> --tag pr-new lists them. Nothing runs twice and no new option is
needed: each route below puts the tag in something Kronikol already reads, before the report is built or rebuilt.
Kronikol does not work out what changed here. What counts as new or edited, and which test each change belongs to, is your detector's answer; this page carries it into the report.
- Every tag gets a chip in the report's Tags row, with the number of tests that carry it, and the row's ANY/ALL switch combines it with the tags you already have (Tags and Attributes › Tags). On a run ingested from a tests file, a tag that every test of a feature carries is also the feature's: the report draws it once, on the feature, and its chip still picks each of those tests.
- In the search,
@pr-newortag:pr-newmatches the tag (case-insensitively) and@pr-new || @pr-editedeither one (Search and Filter Syntax › Tag Filtering (@tag)). -
kronikol query scenarios --tagmatches any part of a name:--tag pr-newlists the new tests and--tag pr-both kinds (Querying Reports).--label, the flag's name before 5.0.0, does the same. - A tag does not change which test it is. History keys a test by its suite, feature, scenario name and outline row, so its history carries on.
Before 5.0.0 only a category got a button in the report, so these recipes added category:pr-new and wrote
categories into the data file. A category: tag still works, since the prefix is read and dropped.
| How your report is built | For example | Where the tag goes |
|---|---|---|
kronikol ingest of a capture in the tests format
|
Jest through the harness on Ingesting From Jest, or any runner whose capture writes tests.ndjson
|
tags on each test's start record |
kronikol ingest of Cucumber Messages
|
Cucumber-JVM, cucumber-js, playwright-bdd |
tags on each pickle |
| A Kronikol adapter in the test process | ReqNRoll, xUnit, NUnit, MSTest, TUnit, LightBDD, BDDfy |
tags on each scenario of the run's TestRunReport.json, rendered again with kronikol merge
|
Each example reads your detector's answer from changed.json, in this shape; convert your detector's output to it:
{
"tests": [
{ "path": "src/orders/orders.test.ts", "line": 40, "end": 58, "change": "edited" },
{ "path": "src/orders/refunds.test.ts", "line": 12, "end": 30, "change": "added" }
]
}-
pathis the test's file, from the repository's root with forward slashes. -
lineandendare the first and last lines of the test. For a Gherkin scenario,lineis the line of itsScenario:orScenario Outline:keyword andendis left out. -
changeisaddedoredited. An entry with any other value is ignored.
The examples use jq, which GitHub's hosted runners have.
Ingest reads a test's tags from its start record. Add the tag there, then run kronikol ingest as you do now:
jq -cR --slurpfile changed changed.json '
fromjson? // empty
| if .event == "start" then
(.sourceFile // "") as $file
| (.sourceLine // -1) as $line
| [ $changed[0].tests[]
| select(.path == $file and .line <= $line and $line <= (.end // .line))
| if .change == "added" then "pr-new"
elif .change == "edited" then "pr-edited"
else empty end ] as $marks
| if ($marks | length) > 0 then .tags = ((.tags // []) + $marks | unique) else . end
else . end' kronikol-capture/tests.ndjson > tests.tagged.ndjson
mv tests.tagged.ndjson kronikol-capture/tests.ndjson
kronikol ingest kronikol-capture --tests kronikol-capture/tests.ndjson -o Reports- A test matches when its
sourceFileis the entry'spathand itssourceLinefalls betweenlineandend. So every run of a test written once and run many times, such as Jest's.eachor a loop, is marked, and so is every attempt of a retried test. -
sourceFilehas to be written the waypathis. Ingest leaves the capture's paths as the capture wrote them, so an absolute path or a backslash matches nothing. - A capture with no
sourceLinecan match by name instead. The harness on Ingesting From Jest writes the file and the test's full name, its describe titles and its own title joined by›. Give each entry aname, bind the record's name beside its file with(.testName // "") as $name, and select on.path == $file and .name == $name. Each run of an.eachtable has a name of its own, so match those by line. - A line that is not JSON, such as the torn last line a killed worker can leave, is dropped; ingest would skip it anyway.
- If you write the capture yourself, your harness can add the tag when it writes the
startrecord instead.
Kronikol reads a scenario's tags from its pickle's tags, less its feature's (see tag conventions), so add the tag to each pickle. A pickle names its scenario by id, and the scenario's line is in the Gherkin document:
jq -c -n --slurpfile changed changed.json --slurpfile messages cucumber/messages.ndjson '
def scenarios: .feature.children[]? | (.scenario // empty), (.rule.children[]? | .scenario // empty);
def file: (if startswith("[") and index("]:") then .[index("]:") + 2:] else . end) | split("\\") | join("/");
(reduce ($messages[] | .gherkinDocument // empty | scenarios) as $s ({}; .[$s.id] = $s.location.line)) as $lines
| $messages[]
| if .pickle then
(.pickle.uri | file) as $uri
| $lines[.pickle.astNodeIds[0]] as $line
| [ $changed[0].tests[]
| select(.path == $uri and .line == $line)
| if .change == "added" then "@pr-new"
elif .change == "edited" then "@pr-edited"
else empty end ] as $marks
| if ($marks | length) > 0 then .pickle.tags = ((.pickle.tags // []) + ($marks | map({ name: . }))) else . end
else . end' > messages.tagged.ndjsonThen pass messages.tagged.ndjson to kronikol ingest --cucumber-messages.
-
lineis the line of the scenario's keyword. Every row of a scenario outline is a pickle of its own, with the outline's line, so every row is marked. - A pickle's URI is relative to the folder the runner ran in, so write
paththat way. The script drops the[chromium]:that playwright-bdd puts before the URI when the Playwright project has a name, and turns the backslashes of a run on Windows into forward slashes. Cucumber-JVM writes aclasspath:URI for a feature it found on the classpath and afile:URI for one it read from disk; for those, writepathas the URI the run wrote. -
--slurpfilereads the whole messages file into memory, attachments included. For a very large file, the same steps in a short script of your own do the job.
An adapter in the test process takes a test's tags from the test code (Tags and Attributes), so they cannot be added from outside the run. Tag the report's data instead, and build the report again from it:
- Set
GenerateMergeableData = truein the project'sReportConfigurationOptions. The run'sTestRunReport.jsonthen holds everything a report is built from (Merging Parallel Reports). - After the run, add the tags to
TestRunReport.jsonand render it withkronikol merge:
jq --arg project tests/Orders.Tests --slurpfile changed changed.json '
.features[].scenarios[] |= (
(if .sourceFile then $project + "/" + .sourceFile else "" end) as $file
| (.sourceLine // -1) as $line
| [ $changed[0].tests[]
| select(.path == $file and .line == $line)
| if .change == "added" then "pr-new"
elif .change == "edited" then "pr-edited"
else empty end ] as $marks
| if ($marks | length) > 0 then .tags = ((.tags // []) + $marks | unique) else . end)' \
Reports/TestRunReport.json > tagged-run.json
kronikol merge tagged-run.json -o Tagged/TestRunReport.html -t "Orders component tests"-
Reports/is the folder the run wrote its report to, under the test project's build output unless you configured another.$projectis the test project's folder from the repository's root: a ReqNRoll scenario'ssourceFileis relative to it, and itssourceLineis the line of itsScenario:keyword. - In the data file a tag is its bare name,
pr-new, with no@and nocategory:prefix. -
-tsets the title, which is otherwiseTest Run Report. Write the output to a folder of its own:kronikol mergealso writes a.jsonbeside the HTML, and refuses to overwrite its input. - The rebuilt report is the full interactive report. It has a History section only when
--historynames the ledger; Merging Parallel Reports lists the options.
Tests of the other adapters (xUnit, NUnit, MSTest, TUnit, LightBDD, BDDfy) carry no source location in the report, so
match them by name. Give each entry a feature and a scenario, as TestRunReport.json holds them (each feature's
name and each of its scenarios' name), and select on those:
jq --slurpfile changed changed.json '
.features[] |= (.name as $feature | .scenarios[] |= (
.name as $scenario
| [ $changed[0].tests[]
| select(.feature == $feature and .scenario == $scenario)
| if .change == "added" then "pr-new"
elif .change == "edited" then "pr-edited"
else empty end ] as $marks
| if ($marks | length) > 0 then .tags = ((.tags // []) + $marks | unique) else . end))' \
Reports/TestRunReport.json > tagged-run.jsonThe tags say which tests are new or edited, not what changed in them, and a removed test is not in the report to carry one. Showing the change itself in the report is #124.
Checked on a 5.0.0 build of Kronikol.Tool: a tests capture, a playwright-bdd run's Messages (a scenario outline among
them) and a data file, tagged by source location and by name, each give kronikol query scenarios --tag pr- the tests
marked and no others. There the edits were made by a script of the same logic as the jq programs; the programs
themselves ran with jq 1.7.1 in their 4.x form, which wrote category:pr-new, with Kronikol.Tool 4.26.4.
Home · 🔍 Search this wiki Full-text search across every page. The “Pages” list above matches page and heading names, not page content.
Getting Started
- Quick Start (xUnit)
- Project Templates
- AI Integration Prompt
- Framework Integration Guides
- Migrating to v5
- Migrating to v4
Common Tasks
Integration Guides
- Integration xUnit3
- Integration xUnit2
- Integration NUnit
- Integration MSTest
- Integration TUnit
- Integration BDDfy xUnit3
- Integration LightBDD xUnit2
- Integration LightBDD xUnit3
- Integration LightBDD TUnit
- Integration ReqNRoll xUnit2
- Integration ReqNRoll xUnit3
- Integration ReqNRoll TUnit
- Integration Playwright
Uninstrumentable / polyglot backends
- Integration ProxyTap Extension
- Integration TcpTap Extension
- Integration Otlp Extension
- Exporting to OpenTelemetry
- Ingesting External Captures
- Ingesting from Jest
- Integration Cucumber Messages
- Capture-Time Redaction
Extensions
- Integration AtlasDataApi Extension
- Integration BigQuery Extension
- Integration Bigtable Extension
- Integration BlobStorage Extension
- Integration ClickHouse Extension
- Integration CloudStorage Extension
- Integration CosmosDB Extension
- Integration Dapper Extension
- Integration DynamoDB Extension
- Integration EF Core Relational Extension
- Integration Elasticsearch Extension
- Integration EventBridge Extension
- Integration EventHubs Extension
- Integration Grpc Extension
- Integration Kafka Extension
- Integration MassTransit Extension
- Integration MongoDB Extension
- Integration MySqlConnector Extension
- Integration Npgsql Extension
- Integration Oracle Extension
- Integration PubSub Extension
- Integration Redis Extension
- Integration S3 Extension
- Integration ServiceBus Extension
- Integration SNS Extension
- Integration Spanner Extension
- Integration SqlClient Extension
- Integration Sqlite Extension
- Integration SQS Extension
- Integration StorageQueues Extension
- Integration OpenTelemetry Extension
- Integration DispatchProxy Extension
- Integration MediatR Extension
- Integration PlantUML IKVM
Configuration
- Tracking Dependencies
- Tracking Custom Dependencies
- HTTP Tracking Setup
- Report Configuration
- Diagram Customisation
- Phase-Aware Tracking
- Content Formatting
- PlantUML Server Configuration
Features
- Generated Reports
- Report Themes
- Search and Filter Syntax
- Component Diagrams
- PlantUML Browser Rendering
- Inline SVG Rendering
- Internal Flow Tracking
- Tags and Attributes
- Excluding Requests
- Excluded Headers
- Multi-Host Test Architectures
- Event-Driven Architecture Testing
- Service Bus Tracking Patterns
- Background Thread Correlation
- Parallel-Safe Background Correlation
- Event & Message Tracking
- Assertion Tracking
- Step Tracking
- Tabular Attributes
- Large Response and Diagram Handling
- Querying Reports
- Service Card
- Cross-Run History
- Diagnostics and Debugging
- CI Summary Integration
- CI Artifact Upload
- Merging Parallel Reports
Reference