Report results
Send a test report from your runner or CI pipeline. Check the tested commit's gate to see whether it meets the project's testing requirements. Include the pipeline's identity, retries, and case links so you can see who reported each result, what they tested, and what happened on each try.
Upload JUnit XML #
- Configure your runner to write a JUnit XML file, such as
results.xml. - Run
mainworthy report results.xmlto upload the file to your instance. - Run
mainworthy gateto read the gate's verdict for the tested commit.
You can pass several files or a shell glob such as results/*.xml.
The receipt lists the outcomes, new or existing questions, and the gate at upload time.
It also counts the results by basis, which tells you which case version a result is for.
Counts use the singular for one result, claim, attachment, or assumed case version. If Mainworthy declines a
case or version claim, it keeps the result without a case link. Skipped attachments leave the results intact.
"1 result had no case or version when recorded" counts results with an unresolved basis, even if the project's policy has since created cases or someone has linked the tests. See tests with no case for the policy choices.
The totals and basis counts use individual results, so one test can count more than once. For two passing results from one test with no case link, the receipt includes the following lines.
2 results 2 pass 0 fail 0 skip
2 results had no case or version when recorded
basis: unresolved 2 results (no case or version when recorded)
An assumed basis uses the current case version when Mainworthy records the result. If you link the test, edit the case, or change the policy, Mainworthy still returns the original receipt on a retry. A new report for an existing test records new evidence. The test view shows those results, while earlier report receipts keep their original contents. Passing, skipped and blocked results still contribute to the gate tally.
A successful report exits 0 even when tests fail. Use gate for the verdict.
An invalid input or refused command exits 4. See changes.
A result's corrects names an earlier result of yours that has not already been corrected.
If another report has replaced that result, or an accepted report is still waiting to apply
its correction, the server refuses the whole report with conflict before accepting it.
The refusal says whether the earlier correction is applied or still waiting.
After an interruption, retry the first report or let a background recovery job finish it.
Read the latest results and correct the current result instead.
Two results in one report cannot correct the same earlier result.
Sending an identical report again returns the original receipt and says
"already received; nothing was written". The receipt's gate line shows the verdict
at the first upload. A repeat can therefore show "blocked" for a commit
that has passed since. The command explains this on stderr and points at
mainworthy gate to read the current verdict.
Reports also fill qualifying slots in planned runs that
accept the tested commit, even after those runs close. A late report makes the run's gate pending until
Mainworthy applies all accepted reports. If the report added or corrected
qualifying slot results, Mainworthy reconsiders the run's sign-off on the new evidence. A report
that does neither leaves the approval in place. See planned runs.
If the server answers busy before acceptance, retry the unchanged report with the same command ID.
The CLI exits with code 4 and does not retry automatically.
If Mainworthy hits a lock timeout or deadlock while applying an accepted report, it rolls back the changes
and returns a pending receipt. The receipt names the accepted batch and says
pending: report accepted; waiting for application. It has no result IDs, and its outcome and basis counts
are zero. The CLI exits with code 0 because the server accepted the report.
Read mainworthy gate for the current verdict. Startup recovery or a same-id retry applies the batch.
The pending reply comes before the final stored receipt. A same-id retry after recovery returns the applied receipt.
While the result is unconfirmed, the browser keeps the original command and note. If you retry,
Mainworthy checks that command before recording another result.
The CLI and MCP generate a command id per report when none was supplied. Transport retries keep that id,
which also prevents duplication if a successful reply is lost. A new invocation or tool call gets a new id.
To retry across invocations, supply the same cmd in the report JSON. Resending a successful case or manual
report without the same id records a new fact.
An accepted report keeps qualifying runs pending until Mainworthy applies or cancels it. If you revoke the token, end the browser session, or remove the required grant before Mainworthy applies the report, Mainworthy refuses the report and stops waiting for it. To submit the results again, use a new command ID and a credential with access.
Upload a native report #
The same command reads Playwright JSON, Jest JSON, Vitest JSON,
pytest-json-report JSON, and Visual Studio Test TRX. It detects each file
independently, so one upload can include different formats:
$ mainworthy report playwright.json unit-results.json results.trx
Use --format with junit, playwright, jest, vitest, pytest, or trx to select
one format for every file in the command. The default is --format auto. Jest and Vitest use
the same JSON structure. Detection reads the content. A .trx extension also
selects TRX, and a .json extension makes invalid JSON an input error.
The commands below produce and upload each native report format.
| Runner | Produce the report | Upload |
|---|---|---|
| Playwright | PLAYWRIGHT_JSON_OUTPUT_FILE=results.json playwright test --reporter=json | mainworthy report results.json |
| Jest | jest --json --outputFile=results.json | mainworthy report results.json |
| Vitest | vitest run --reporter=json --outputFile=results.json | mainworthy report results.json |
pytest with pytest-json-report installed | pytest --json-report --json-report-file=results.json | mainworthy report results.json |
| .NET | dotnet test --logger "trx;LogFileName=results.trx" | mainworthy report TestResults/results.trx |
Pytest's built-in report export is JUnit XML (pytest --junitxml=results.xml).
Its JSON adapter requires the separate
pytest-json-report plugin,
with test details enabled. A summary-only report has no executions to upload.
CTRF is not supported.
Native adapters keep the file, suite path, test name, case annotations in the
name, duration, and failure diagnostics. Playwright includes the project name
in the test key, so Chromium and Firefox results stay separate. TRX uses the
class in TestDefinitions when present, together with the test name. Its
assembly path is not a source file. A TRX test without a definition keeps its name as its key.
The report's filename and TRX execution IDs do not enter test keys.
Jest and Vitest source paths are relative to the report's rootDir when present.
Otherwise the command uses the Git checkout's top level, or its working directory
outside Git. Run the command in the source checkout that produced the report,
including when the report file is stored elsewhere. Running from the source
checkout keeps keys stable between checkouts. The JSON reporters normally omit rootDir.
The command refuses a relative rootDir, a filesystem root, or a source path
outside the chosen root. It exits with code 4 and names the report file and root.
Keep source paths and suite names stable. Switching exporters can change those values. Before switching an existing pipeline, compare the exporters' keys. An unlinked native test follows the same project policy as an unlinked JUnit test.
Long names and source files are shortened to at most 500 UTF-16 units, failure messages to 4,000, and failure details to 20,000. Mainworthy keeps whole Unicode code points so the text stays valid. It can still shorten an emoji made of several code points. Test keys longer than 1,000 units keep a prefix and a digest of the full original identity, so differences beyond the prefix still distinguish tests. These limits apply to JUnit and native reports.
Mainworthy stores a runner's NUL character (U+0000) as ␀ (U+2400) in a test key, name, or file.
It does the same in a failure message or detail, an earlier try's diagnostic, or a step or action. The result is kept. The same report sent again is still
one report. A test whose key held a NUL shows ␀ in its key from then on.
If a note, a result you record against a case, or the report's target or job contains a NUL, Mainworthy returns
invalid and names the field. A NUL makes a TRX file invalid XML, so Mainworthy refuses that file.
Native reports with unknown statuses, malformed test details, or errors outside
test executions stop the upload with exit 4. No files in that command are
sent. A pytest test passes only when its call stage ran and passed: a test with
no call stage (other than one skipped in setup) is refused, a skipped call is a
skip, and a failed setup or teardown is an error. A pytest report with
exitcode 1 and no failed or errored test is refused too. Keep the runner's
exit status as a CI check too, since a report cannot prove work that the runner
omitted. JUnit keeps its existing parser and warnings.
Report that no tests are required #
When path filters require no tests for a commit, a pipeline can explicitly declare that fact:
$ mainworthy report --nothing-required --commit 1111111111111111111111111111111111111111
$ mainworthy gate --commit 1111111111111111111111111111111111111111
Use a pipeline token for this declaration. It takes no files, results, or planned run. CI detection can supply the commit, job, and other build metadata as for an ordinary report.
All policy presets keep this gate pending by default. Before the declaration can pass the gate, a project
admin must record mainworthy policy empty nothing-required. A project admin holds admin on the project,
which lets them accept its policy changes. See
reports with no tests for the policy choice
and its record.
The declaration passes only a commit with no ordinary reports. It cannot turn skips, refused results, agent results, or an existing failure into a pass. It never satisfies a planned run or a required CI job. An empty JUnit file without the explicit declaration is refused.
Identify the tested build #
Mainworthy detects GitHub Actions, GitLab CI, CircleCI, Buildkite, Jenkins, Azure Pipelines, and Bitbucket Pipelines. It reads the commit and available branch, repository, pull request, base commit, environment, job name, attempt number, and build URL. Not every provider supplies every field.
In GitHub Actions, pull request event data identifies the pull request's head commit.
It also supplies the base commit, title, and URL when present.
GITHUB_JOB supplies the job name, and GITHUB_RUN_ATTEMPT supplies the attempt.
The repository and run ID form the build URL.
If a pull_request_target event has no readable head commit, supply the tested
commit explicitly. If you test a checkout other than the detected head, override it too.
Mainworthy cannot infer which checkout your test command actually exercised.
Use these environment overrides when detection does not describe your run:
MAINWORTHY_COMMIT,MAINWORTHY_BRANCH, andMAINWORTHY_REPOidentify the tested code.MAINWORTHY_PRandMAINWORTHY_BASEidentify the change and its starting commit.MAINWORTHY_ENVnames the test environment.MAINWORTHY_JOB,MAINWORTHY_ATTEMPT, andMAINWORTHY_BUILD_URLdescribe the execution.
Nonempty overrides take precedence over provider variables. Empty values count as unset.
Command flags such as --commit, --job, and --attempt take precedence over detection.
See configuration and the CLI guide for the full forms.
Outside CI, Mainworthy reads the commit, branch, and repository from Git. If there is no Git checkout, name the commit:
$ mainworthy report results.xml --commit 1111111111111111111111111111111111111111
Use --session <name> for work with no build identity. A session proves nothing
about a commit's gate. A detected CI provider with no valid commit does not borrow
an unrelated commit from the local checkout.
Follow a branch reset #
If a branch is reset or force-pushed to a commit already reported, read its current head
from the code host when you send the report. Pass that hash with --head:
$ mainworthy report results.xml --pr 482 --commit 1111111111111111111111111111111111111111 --head 2222222222222222222222222222222222222222
--commit identifies what the results tested. --head identifies the change's current
head, which can be another commit. Use --pr or a non-trunk --branch to name the change.
Through the API, put the hash in target.head on report. A session target cannot carry a head or other build identity.
A pipeline or person can supply the head. An agent's report cannot move it. Mainworthy follows an explicit head in either direction. If that commit has no counted results, the change's gate is pending. The receipt still shows the tested commit's gate.
Only results for that current head can clear a failure question about the change or end an answer that needs a fix. A passing retry on a discarded commit stays recorded but leaves the current head's question or answer in place. A passing retry on the current head can still clear it.
CI detection does not supply --head. An old workflow event can name an outdated head,
so read the code host's current value instead of copying the event's commit.
Without --head, reports keep their first-reported ordering. A commit already reported
before a head observation cannot replace that head with a late job.
An identical report with the same head and build URL is a retry and does not move the
change again. With --head, the build URL distinguishes a new CI run even when its
results and attempt number match an earlier run. GitHub Actions supplies a URL containing
the run ID. Other producers can set MAINWORTHY_BUILD_URL or send buildUrl in JSON.
Keep it unchanged for a retry.
Without a build URL, use a new --attempt number for a fresh observation with identical
results and the same head. Through the API, a new cmd value also names a fresh
observation. Reuse that value when retrying the command.
Link tests to cases #
Put a case annotation in the test name, in JUnit or a native report:
<testcase name="percentage coupon @C-1@v1" classname="checkout" />
@C-1 names the case without claiming a version. @C-1@v1 also claims version 1.
You can instead put a property inside the test case:
<testcase name="percentage coupon" classname="checkout">
<properties>
<property name="mainworthy" value="C-1@v1" />
</properties>
</testcase>
An imported alias, such as C1234 or PAY-7,
works wherever a case ref does here. Use @C1234 in a name or C1234 in a property.
To claim version 1 in Mainworthy, add @v1. The claim does not name the version
in the source tool.
Aliases keep their original letter case and resolve within the report's project.
In a name, native refs match without regard to letter case: @c-2 names C-2.
Mainworthy normalizes native refs to uppercase and leaves alias letter case unchanged.
A non-native @token claims a case only when that alias exists in the report's project.
Mainworthy ignores other tokens, such as @smoke, @media, and the address in
[email protected], when those tokens name no alias. Those tokens do not hide a
later native ref or drop a link that an earlier decision established.
Trailing sentence punctuation is excluded from name claims: @C1234. names C1234.
Use explicit metadata for an alias whose final punctuation belongs to its identifier.
Separate claims with whitespace. Glued tokens such as @smoke@C-2,
@C-2x, and @C-2@v1x do not claim a case.
Name annotations work in JUnit, Playwright, Jest, Vitest, and TRX test names, and in pytest node IDs, including parameter IDs. The following formats also carry case claims outside the name:
- JUnit uses the
mainworthyproperty shown above. - Playwright JSON uses a test annotation with
type: "mainworthy"anddescription: "C1234@v1". - pytest-json-report uses
record_property("mainworthy", "C1234@v1"), serialized asuser_properties: [{"mainworthy": "C1234@v1"}].
Mainworthy resolves name claims when it receives the report, using the aliases in that project.
The last valid claim in a name wins. For example, checkout @C1234 then @C-2 names C-2.
With several native refs, this changes the earlier behavior that selected the first ref.
An unknown non-native token is ignored even after a valid claim.
These properties and Playwright annotations take precedence over every claim in the name. When several explicit metadata claims name the case on one test, the last syntactically valid claim wins. An unknown alias in explicit metadata is recorded without a case, just as for an unknown native ref. The receipt explains why. Metadata preserves the alias's punctuation and requires uppercase native refs. A test can also use an existing link from a decision in Queue.
Mainworthy uses the test's file, suite path, and name to identify it. If the report has no file, Mainworthy uses the class name in its place. Keep those values stable across reports. The report file's name is not the test's source file.
What happens to a test without a case is the project's choice. Under loose and standard
the policy starts as "Track without a case". Mainworthy keeps the test and asks
nobody. A project can instead create a case for each such test or raise an
unlinked-test question for each file. The strict preset starts with questions. See policy.
With Create a case for each test, the folder normally comes from the test file's
directories after Mainworthy removes conventional wrappers. For example, tests/checkout/coupon.spec.ts
becomes checkout.
If removing conventional directories leaves none, Mainworthy uses the file name
without a recognized lower-case source extension, then removes a trailing .test
or .spec marker. Other keys stay whole, including dotted class names such as
com.example.ui.Feature and com.example.Test. If the remaining name is empty or contains only whitespace, Mainworthy uses Automated. It applies the
same Unicode cleanup as for folder paths, then shortens the remaining name to fit the 120-character limit.
The fallback drops conventional src, test, tests, spec, specs, __tests__,
lib, and app wrappers. It keeps at most one e2e segment before the file stem,
so repeated wrappers cannot create deep folder chains.
For example, test/e2e/docs.test.ts becomes e2e/docs, and test/policy.test.ts
becomes policy. A report with no usable file name still uses Automated.
New cases use this computed folder even if you moved other cases from that file.
Existing cases keep their folders. The demo's unlinked shipping test uses
tests/e2e/shipping.spec.ts; creating its case puts it in e2e/shipping.
An unlinked automated test still counts toward the commit gate.
Read what each test did #
- Press g t to open Tests.
- Type a name or file in the filter.
- To show tests tracked without a case, check "Only tests with no case".
- Use j and k to select a test.
Tests lists every automated test the project's reports have named, newest first. Each row shows the test's file and its case or "no case".
While a test's page loads, it shows the test's name from the list and says so. Once loaded, the page shows the test's file, key, and case. It also shows how often the test flipped between passing and failing on the same code, and whether the test is in quarantine. "Latest results" lists its last twenty results, newest first. Each row shows the outcome, any commit and change reported with it, the job, duration, producer, and failure message when present. Attempts after the first show their number. If a later attempt passes on the same job, producer, environment, and commit, the failure says "flaky". It also says "passed on attempt" with the number of the passing attempt. A result whose runner tries disagree also says "flaky", lists the runner's tries in order, and shows an earlier try's failure when the result has none. The flip count leaves out a flip whose failure or pass its producer corrected. "build" opens the CI build when the report supplied an HTTP or HTTPS URL.
To see every result of one commit, open its change in Changes.
From the command line, mainworthy get T-12 prints the test's details as JSON.
Read the result's basis #
To report execution of a deployed artifact, use --build <label> --env <environment>.
This selects the announced artifact and overrides any commit detected from CI or Git.
The label must already be bound by announce. Check its planned release run with
gate --run, as described in release runs.
exact means the result names a case version, or a run pins that version.
assumed means a link or case annotation identifies the case. Mainworthy then uses
the case's current version without a version claim from the runner.
unresolved means the result has no resolved case and version.
The basis tells you how Mainworthy identifies the case version, regardless of the outcome.
A planned run can require exact results. The strict preset does so by default.
See runs.
If an automated test's case or version claim cannot be used, the receipt explains which claim was declined. The outcome stays recorded without a case, so a failure cannot disappear from the commit gate because its annotation is wrong.
Preserve attempts and retries #
If your CI provider does not supply an attempt number for a rerun,
use a higher --attempt.
Within one producer, job, target, and test, a higher attempt that passes or fails replaces the previous
outcome. The producer is the person, pipeline, or agent that sends the result. The target identifies what
you tested. An older attempt arriving late does not replace a newer one.
The same attempt reported twice keeps the worse outcome.
A skip or blocked result does not replace an existing pass or failure.
A pass from one job or environment does not clear another job's failure.
If a higher attempt changes from pass to failure or from failure to pass for the same producer, job, test,
and target, Mainworthy records a same-code flip. Failure includes fail and error.
A skip does not hide the previous decisive result. An old attempt or same-attempt
disagreement adds no flip. Identical reports add nothing.
Retries by the test runner #
A runner can retry a test during one run, for example with Playwright's retries or Maven Surefire's
rerunFailingTestsCount. Mainworthy records one result per test using its final outcome. It keeps earlier
tries beside the result, oldest first. The gate counts only the result.
Mainworthy records a flip between tries just as it does between pipeline attempts. If a test fails then passes on a runner retry, it reads "flaky" in the change's results and on the test page. The flip counts in Reports and in the same-code detector. If all tries fail or are skipped, they add no flip.
The JSON reporters keep different amounts of retry evidence:
| Reporter | Earlier tries Mainworthy can keep |
|---|---|
| Playwright JSON | Every execution before the final one, with its outcome, duration, and diagnostic. |
| Jest JSON, checked with Jest 30.5.2 | invocations gives the number of earlier failed tries. jest.retryTimes(2, { logErrorsBeforeRetry: true }) also keeps retryReasons. If the report has one reason per try, each try gets its diagnostic. A single earlier try keeps all its reasons together. Missing or flattened diagnostics produce a warning and failed tries without an attributed diagnostic. |
| Vitest JSON, checked with Vitest 5.0.4 | A passed test's retained failureMessages prove earlier failure. They are kept together as one failed try, with a warning: the reporter omits the retry count and the boundaries between tries. A failed test's messages cannot distinguish retries from several errors in one execution. |
pytest-json-report 1.5.0 with pytest-rerunfailures 16.7, checked with pytest 8.4.2 | A recovered test keeps outcome: "rerun" beside its final stages. Mainworthy judges those stages and keeps one earlier failed try, with a warning. The reporter overwrites earlier stages, so their count, durations, and diagnostics are unavailable. An exhausted failure retains no retry marker. |
Report errors and warnings quote and shorten external identifiers, including suite and test names,
report filenames and attachment paths, escaping terminal control characters. Human-readable receipts do the same
for failure titles. If a report file cannot be read, the error shows its quoted filename and filesystem error code,
such as EACCES. All CLI errors fold CR/LF runs into ; and escape other controls.
JSON output escapes controls while preserving JSON values. If the top-level value is absent, the CLI prints null.
Parsed test identities and failure evidence stay unchanged.
Each report keeps at most 1,000 warnings, each at most 1,000 UTF-16 units, followed by one line counting any omitted warnings.
The warning limit does not drop results or tries.
No adapter invents a duration or attributes a diagnostic to a try when the report lost that information. For exact retry histories, use a reporter that retains each execution, such as Playwright JSON or Surefire's retry elements.
If the pipeline reruns the job, Mainworthy compares the earlier attempt with the new attempt's first pass or
failure. Each recovery counts as one flip, whether the runner or the pipeline retried first. A correction of a result
withdraws the flips of its tries too. A result keeps at most a hundred tries. A Playwright report or a Jest invocation count with more is
refused rather than cut, because the try that was dropped could be the one that passed. A
Surefire testcase with more keeps its first run and its last 99, with a warning: every one
failed, so those decide every flip. In the API, a result's tries lists each try with an outcome, an optional durationMs, and an optional
failure. The command mainworthy get T-1 --json returns tries for each recent result. Each detector
sample names the runner's try for both results.
Mainworthy groups the cause of a failed try by file under the same conditions as a failed result, even if the result passed. Without diagnostic cause text, a failed try or result has an unknown cause. It has a signature unique to that test, labelled Unknown failure cause. A failed result with an unknown cause still opens a question you can answer in Queue. Your answer covers only that test's unknown failures within the answer's scope. Unknown causes do not join assertion groups, split by file, support detector suggestions, or establish that a head has the same cause as a failure on its base. Their outcome changes still count as flips in history and reports. Test names never supply diagnostic text. This applies to all report formats, including message-free Playwright and Surefire retries. Existing stored causes keep their earlier classification. Mainworthy gives each file its own assertion cause when the same assertion cause appears in more than 50 distinct tests across more than five reported files in one repository and commit. Failed tries and failed results both count. Repeated tries of one test count once. Runner and pipeline flips of that file's failure then count under the same cause. Earlier reports keep their original causes. After an upgrade or import, Mainworthy creates a missing file-specific cause when that file next appears in a report on the commit that crossed the limits. It waits for a report about that file.
A result's durationMs and each try's durationMs are nonnegative integer milliseconds, at most 30 days
(2,592,000,000 ms). If a report gives a longer duration, Mainworthy refuses it before recording results.
The detector counts recent flips for each test and failure signature. A signature identifies a cause
from its diagnostic text. The detector handles assertion, timeout, and infrastructure failures. By default, two flips of one cause within
14 days suggest investigation. A file-split signature is a separate cause.
Earlier flips of the original cause do not count toward the split cause's threshold.
The failure question shows its cause's count and up to three pairs of concrete results.
Expand a count to see the commit, job, environment, producer, result ids,
outcomes, and attempts. mainworthy get T-1 --json returns the current evidence in
sameCode, including signature, class, flips, suggested, and samples
for each cause. signature contains its id and normalized text.
The question keeps the evidence shown when its occurrence was recorded.
Both observations must be in the configured window. Corrected observations and
passes contradicted by a failure at the same attempt do not support a suggestion.
The detector uses automated results on commit targets. Agent results and sessions
are excluded. When diagnostic cause text is available, the detector classifies its normalized
message as assertion, timeout, or infrastructure. If the message contains only whitespace or
report headers such as Error: or FAILED, Mainworthy looks for diagnostic cause text in
detail before choosing unknown. Stack frames alone do not supply a failure class. If a failed result has no failure message, Mainworthy can use its note for cause text. If a message exists,
Mainworthy uses it even if it consists only of a header such as failed. Unknown causes stay outside the detector's
known-cause classes and suggestions.
Investigate the evidence before deciding whether infrastructure caused the failure.
To excuse a failure the detector flags, a person must give a flaky or infra answer under the
project's policy. Automatic quarantine and alternation
across different trunk commits are not built yet. Change the detector's settings
through a policy edit.
Playwright retries become one logical test result. The highest numbered decisive
execution supplies its outcome and failure, and the executions before it are its tries, each
with its own outcome, duration and failure. A skipped retry does not erase an
earlier failure. The logical result's duration sums all executions, and a pass after retries has
the same passed after N retries note as JUnit. An expected Playwright failure
counts as a pass. An unexpected pass counts as a failure, for a try as for the result.
In JUnit, Surefire's flakyFailure, flakyError, rerunFailure and rerunError
elements become failed tries with their message. A testcase with only flaky elements
passed after them, so it is a flip. A testcase with a failure and rerun elements failed
every time. Surefire writes the first run as the failure and the later runs after it, so the
last rerun is the result and the failure is the oldest try.
JUnit also recognizes separate testcases with retry suffixes: (retry #1), (retry 1),
[retry #1] and [retry 1], ignoring case and whitespace around the number. One
unsuffixed testcase followed by consecutive retry numbers, starting at 1, becomes one
result with earlier tries in report order. Other tests may appear between those testcases.
They must belong to the same suite instance and have byte-equal raw testcase identity.
Every testcase attribute counts, including classname alongside file, id, line, and
unknown attributes. Only the recognized retry suffix and at most one preceding ASCII space are removed
from name. All other name whitespace remains. The per-run attributes time, status, message, assertions and timestamp
may differ, as may outcomes and output. All other literal attribute values and their presence
must match. Attribute order and single versus double quote delimiters do not matter.
The comparison preserves literal XML entity spelling, whitespace and slashes. For example,
classname="a\b" differs from classname="a/b", and a missing file differs from file="".
Identical normalized test keys alone never identify a retry. Case annotations must also match,
and the testcases must use no Surefire retry elements.
The final testcase supplies the outcome, failure and attachment markers. The original supplies the test's name. The duration sums all executions.
A passing final testcase has a passed after N retries note. A sequence with more than
100 earlier tries is refused rather than losing flip evidence.
A missing initial testcase, gaps, repeated or reordered numbers, stacked retry suffixes, conflicting case annotations, malformed testcases, and testcases in separate suite instances stay separate results. Their worse outcome counts within the same pipeline attempt. A suffix alone does not prove that a testcase is a retry.
Jest and Vitest JSON keep the final assertion outcome and duration, together with the
retry evidence listed above. The pytest adapter sums its final setup, call, and teardown durations and keeps setup
or teardown failures as errors. Its failure message uses crash.message when
available and keeps the traceback in the details. Expected pytest failures are skipped.
TRX keeps each execution and its duration. Ambiguous or unfinished outcomes
count as errors.
Report from sharded jobs #
When a job's tests run in shards, report each shard as that shard of the job. Use one job name for all shards, and give each shard its index and the number of shards.
mainworthy report results.xml --job tests --shard 2/6
The commit's gate then waits for every shard of the job.
Until the last shard reports, the gate reads pending and names the missing shards,
for example pending: waiting for shards 3 and 5 of 6 of job tests.
A failure in a shard that already reported shows at once, and the reason says which shards are still due.
mainworthy gate --json lists them in waiting.
The web app draws the shards under the gate's reason, one strip for each job and one cell for each
shard. A missing shard is outlined in amber. The reason then counts the shards, for example
pending: waiting for 3 shards. To read which shards reported and which are still due, hover over a strip in the
web app. In a phone's browser, the page of a change or a run writes it under each strip. A row
in a list shows the cells before its reason. Open the row to read the details.
Each shard can run mainworthy gate after its own report. The last shard's gate gives the commit's verdict.
A retry of a shard keeps the shard's index. Every shard of a job must give the same number of shards.
A report that gives another number is refused. Each environment of a commit waits for its own shards.
Without --shard, Mainworthy cannot tell that more reports are coming, and the gate reads what it has.
In GitHub Actions, the shard's matrix values supply both numbers.
strategy:
matrix:
shard: [1, 2, 3, 4, 5, 6]
steps:
- run: npx playwright test --shard=${{ matrix.shard }}/6 --reporter=junit > results.xml
- run: |
mainworthy report results.xml --job tests --shard ${{ matrix.shard }}/6
mainworthy gate
A failure question waits for every shard too. Its question closes, or its answer ends, only when the commit's shards have all reported and every report of the commit has been applied. See decide.
Report when the tests ran #
A report can say when its runner started and ended its tests. A change run then shows a reported test span beside its test time: from the earliest start to the latest end of the reports its gate counts. These times are what the report says, by the runner's clock. Mainworthy still dates every report and result by its own clock when it receives them, and the span changes no verdict.
mainworthy report reads the span from these formats, and from no others:
| Format | Where the span comes from |
|---|---|
| Playwright JSON | stats.startTime and stats.duration |
| Jest and Vitest JSON | The run's startTime or its first file's startTime, through the last file's endTime. Every file must give both times. |
| JUnit XML | Each outermost testsuite with tests must give both timestamp and time. The timestamp must include a time zone, such as 2026-10-26T09:00:00Z or +02:00. |
For the span, Mainworthy reads only the outermost JUnit suites because nested suites run inside their parents.
Surefire and jest-junit write timestamps without a time zone. If a timestamp has no zone or Mainworthy cannot
read the times, the command warns once and uploads the results without a span. pytest-json-report and TRX reports have no span yet.
Jest and Vitest reports warn about a file whose end precedes its start even when another file omits timing,
in either file order. The results stay intact, and the report has no span.
When one command uploads several files, the report has a span only when every file has one.
Through the API, report takes the span as span: { "startedAt": 1792040850012, "endedAt": 1792040852285 }, in
milliseconds since 1970, with endedAt no earlier than startedAt. If you send the same results with different times, Mainworthy treats them as a new report.
A change run shows the span only when every report its gate counts named one, and when no declared shard and no
accepted report is still to arrive. Otherwise it shows the test time alone. mainworthy find --in results returns the
span as reportedSpan, or null. Read it with these limits:
- It covers the reported test runs only, not checkout, builds or jobs that never reported.
- Shards on machines whose clocks disagree move it.
- When a retry reruns some tests and the first attempt's other results still count, the span runs from the first attempt's start to the retry's end, and so includes the wait between them.
For the entire build duration, open the CI build page named in the report.
Give a pipeline its own token #
- As an instance admin, run
mainworthy token new --ci github-actions --project scratch. - Store the returned secret in your CI secret store. Mainworthy shows the secret once.
- Set
MAINWORTHY_URLto the server address. - Set
MAINWORTHY_TOKENto the secret. - Set
MAINWORTHY_PROJECTto the project key.
An instance admin holds admin on every project. A new pipeline token gets record, which lets it report
results and attachments, say that a change ended or a deployment happened, and check the gate. You can also
grant read to let the pipeline see cases, results, questions, and the gate. Those two capabilities are the full set available to a pipeline. Answering questions, editing cases, planning
runs, and administering the instance require a person or agent with the relevant capability.
See access for token scope and revocation.
The CLI can choose the project when the token can access exactly one project.
Add GitHub Actions reporting #
Before adding this step, put mainworthy on the job's path. The preceding test
step must write results.xml even when tests fail.
To add reporting to the job, follow these steps.
- Configure the URL and project as repository variables.
- Store the pipeline token as a repository secret.
- Add the following step after the test step.
- name: Report results and read the gate
if: always()
env:
MAINWORTHY_URL: ${{ vars.MAINWORTHY_URL }}
MAINWORTHY_PROJECT: ${{ vars.MAINWORTHY_PROJECT }}
MAINWORTHY_TOKEN: ${{ secrets.MAINWORTHY_TOKEN }}
run: |
mainworthy report results.xml
mainworthy gate
Keep missing reports and failed runner setup as CI failures. A gate cannot prove
that a job ran when the job sent no evidence. For a planned run, require named jobs
as described in runs.
The gate command's exit code makes this workflow step pass or fail.
An operator can also publish a GitHub commit status
that updates after a later decision. It does not change this workflow step's recorded exit code.
Say when a pull request ends #
Mainworthy does not watch your code host, so it does not know that a pull request was merged or closed. Until Mainworthy receives that information, unexplained failures on that pull request stay in the queue. Add the following workflow to report when the pull request ends. The workflow needs the same variables and pipeline token as the reporting step. It needs no checkout.
on:
pull_request:
types: [closed, reopened]
jobs:
tell:
runs-on: ubuntu-latest
steps:
- env:
MAINWORTHY_URL: ${{ vars.MAINWORTHY_URL }}
MAINWORTHY_PROJECT: ${{ vars.MAINWORTHY_PROJECT }}
MAINWORTHY_TOKEN: ${{ secrets.MAINWORTHY_TOKEN }}
PULL: ${{ github.event.pull_request.number }}
STATE: ${{ github.event.action == 'reopened' && 'open' || (github.event.pull_request.merged && 'merged' || 'closed') }}
HEAD_COMMIT: ${{ github.event.pull_request.head.sha }}
MERGED_COMMIT: ${{ github.event.pull_request.merge_commit_sha }}
BASE_BRANCH: ${{ github.event.pull_request.base.ref }}
run: |
payload=$(jq -nc --arg change "pr:$PULL" --arg state "$STATE" --arg head "$HEAD_COMMIT" --arg commit "$MERGED_COMMIT" --arg branch "$BASE_BRANCH" '
{change: $change, state: $state, head: $head} +
(if $state == "merged" and $commit != "" and (["main", "master", "trunk"] | index($branch)) != null
then {landing: {commit: $commit, branch: $branch}} else {} end)')
curl -fsS -X POST "$MAINWORTHY_URL/api/p/$MAINWORTHY_PROJECT/change" \
-H "authorization: Bearer $MAINWORTHY_TOKEN" -H 'content-type: application/json' \
-d "$payload"
With mainworthy on the job's path, the step is mainworthy change --change "pr:$PULL" --state "$STATE".
To include the landed commit, use change --json with the same payload as the workflow.
The workflow sends the pull request's head, GitHub's merged hash and the base branch.
The head is the commit whose gate the change shows. The merged hash is the landing:
Mainworthy places it on trunk and evaluates its failures there. A rebase or squash
merge writes a new commit, so the landing has a gate of its own, which Changes shows
beside the head's. A fast-forward lands the head itself.
The call is answered not_found for a pull request that never sent a report.
Changes and the gate says what ending a change does.
Attach screenshots and small files #
To attach files to a planned run's result, follow these steps.
- Paste a screenshot into Result note or choose Attach a file.
- Record the outcome. Keep the page open until Mainworthy records the result.
The files belong to that slot's next result. Files selected while an earlier result is saving are kept for the next result. Each saved result shows raster images inline and offers a download for every file. The case's timeline shows the same attachments.
A report through the API can include attachments on each result. Each entry has
name and canonical base64 data, plus an optional step id in at:
{"target":{"session":"screenshots"},"results":[{"test":{"key":"checkout"},"outcome":"fail","attachments":[{"name":"details.txt","data":"ZXhwZWN0ZWQgcmVhZHk="}]}]}
attach appends a file to a result you recorded. Send
{"result":123,"attachment":{"name":"details.txt","data":"ZXhwZWN0ZWQgcmVhZHk="},"cmd":"attachment-123"}.
Use a new cmd for a different file and reuse it for a retry. attachment with
{"result":123} lists metadata. To read one file's base64 data, add "id":456.
Use these two operations through the CLI or API. MCP tool discovery leaves attachment inputs out of the
report schema to keep the tool list small. You can still include attachments in an MCP report.
Each file can be up to 4 MiB. A report may include at most 100 files and 16 MiB of decoded data. One result may hold at most 20 files and 16 MiB, including files appended later. These limits bound upload memory and disk growth for each result while allowing screenshots and small diagnostics. Large recordings belong in an external artifact store. File names cannot contain paths, control characters, or bidirectional text overrides and isolates. The API refuses the whole request if an attachment is invalid or exceeds a limit. Large reports can briefly delay other requests while the server validates and stores their contents.
For JUnit XML, the CLI reads [[ATTACHMENT|path/to/file]] on its own line in a
testcase's system-out or system-err, as described by the
JUnit Attachments plugin.
It also reads testcase properties named attachment or attachment.1,
attachment.2, and so on when their value names a file. The XML parser itself
never opens a path. Permit local file reads explicitly:
mainworthy report reports/results.xml --attachments reports
The CLI reads files only within the permitted directory. For relative paths,
the CLI tries that directory first, then the XML file's directory. Absolute paths must still be inside the
permitted directory. Keep only intended evidence in that directory. Without
--attachments, file markers are ignored and stderr says so once. The results
still upload, including reports from Playwright's JUnit reporter that always names
its videos and traces.
With the flag, a missing, hidden, outside-root, non-file, unreadable, changed,
invalid-name or over-limit file is skipped. Each skipped file gets one stderr
line with its path and reason. An unavailable attachment directory skips the
named files too. Skipped files consume no limit, and every parsed result still
uploads. Links within the directory keep the name used in the report.
The CLI checks for directory replacements as it opens each file. If a link appears during the read, it cannot
redirect the read outside the permitted directory. If something replaces or removes the working directory,
the CLI stops with an error and uploads nothing.
The CLI receipt includes a skipped-attachments count, skippedAttachments in
JSON. This count describes files skipped locally on this command. It is not
part of the server's stored receipt. The CLI does not read embedded attachment
bodies from JUnit or attachments from native reports.
To send attachments, you need record. To retrieve them, you need read on the result's project. Only the original producer can append files through attach.
PNG, JPEG, GIF and WebP signatures select inline image types. Everything else,
including HTML and SVG, downloads as binary data. The UI never inserts a file's
contents as HTML or uses its name as a path.
Attachments are retained evidence and may themselves contain personal data. If you forget a person in Mainworthy, their files, file names, and typed notes stay in the record. Avoid personal information in screenshots and diagnostics. There is no attachment deletion or retention control yet. See your data for storage and backups and privacy for erasure requests.
Quarantine an unreliable test #
Quarantine excuses failures of one automated test across its project. The failures stay in the history and the run's failing-test list. The gate counts them as excused and shows the number, even if another failure blocks the gate. The gate still needs passing results where required and waits for missing evidence and jobs.
Quarantine covers results reported after its entry decision and before its exit, in the server's order. It leaves earlier results unchanged. Ending quarantine preserves the verdicts of results reported while it stood. A covered failure is excused even if an independent defect answer applies to it. Ending quarantine leaves that answer and the earlier result's coverage in force.
- In a failure question, open Quarantined tests. Alternatively, open the list below the detector settings in Settings, Policy.
- Enter the test ref, reason, and exit rule.
- Choose Propose quarantine.
- Review the proposal in the queue.
- Enter a reason.
- If the policy lets you answer the question as a person, accept the proposal.
Every preset requires a person with authority under the policy to decide. Agents can propose quarantine and leave advice. A detector suggestion leaves the test's quarantine unchanged. The failure that prompted the proposal still counts. After a person accepts the proposal, run the job again to report results under quarantine. To propose an end, fill Reason to end quarantine. Then choose the test's end button. Entry and expiry times appear in your browser's local time, including an expiry entered in the form.
Choose one of the following exit rules.
- A person's decision, recorded through a proposal to end quarantine.
- An expiry date. The first result reported at or after that instant counts normally. Earlier results stay excused.
- One to 100 consecutive passing trunk commits whose first result for that test arrived after entry. Retrying a commit first reported before entry cannot count. Every combination of producer, job, and environment reported for that test on a commit must pass. Retries count once per commit. Failures, errors, skips and blocked results break the streak. Agent reports and change commits cannot satisfy it. After the streak succeeds, another failing commit does not restart quarantine, including a later failure on a commit in the qualifying streak. The result that completes the count ends quarantine. Later results count normally, even within the same report.
A correction replaces the earlier observation in its commit's evidence and can change that commit's verdict. Its quarantine coverage depends on when the server receives the correction. Before a pass count is reached, corrections can change the streak. After the exit, they cannot reopen quarantine or change another result's coverage. Planned runs use the same coverage, even if created later.
For the API and command line, read the test with get. Use the last quarantine's
decision as base, or null before the first quarantine. A changed base refuses
an older proposal. Send the quarantine edit by itself:
mainworthy propose --json '{"edits":[{"op":"quarantine","test":"T-1","base":null,"exit":{"kind":"passes","count":3}}],"reason":"Retry outcomes disagree on unchanged code"}'
mainworthy find --json '{"in":"tests","state":"quarantined"}'
mainworthy get T-1 --json
The quarantine edit is available through HTTP, the CLI, and the web UI. MCP
discovery omits the edit. The list returns each test's reason, person, entry time,
decision, and exit rule.
get retains the last entry after it ends. Set exit to null to propose ending
quarantine, or use {"kind":"person"} or {"kind":"expiry","at":1800000000000}
for the other rules. The expiry is UTC milliseconds. A new quarantine can begin
with a new decision after an earlier one ends.
Quarantine entries, recorded result coverage, and pass-count exits travel in archives. This schema requires archives exported with this build. Imported expiry rules use the destination server's clock. Earlier covered results keep their coverage there too.
Keep the work at each step #
Send steps in a JSON report through HTTP, CLI, or MCP. Each entry records a
step's outcome, optional durationMs, and optional actions. Each action has
text, an optional outcome, and optional durationMs. Times are non-negative whole milliseconds. Zero means you measured zero. Leave out the time if you did not
record it.
Action times need not sum to the step's time.
$ mainworthy report --json '{"target":{"session":"checkout-check"},"results":[{"test":{"case":"C-1"},"outcome":"pass","annotation":{"case":"C-1","version":1},"steps":[{"step":"a1","outcome":"pass","durationMs":120,"actions":[{"text":"Open the cart","outcome":"pass","durationMs":120}]},{"step":"b2","outcome":"pass","durationMs":800,"actions":[{"text":"Apply the coupon","durationMs":700},{"text":"Read the discounted total","outcome":"pass","durationMs":100}]}]}]}'
$ mainworthy get C-1 --json
Use the stable step id from the case version you tested. For a step from a fragment, use the ID for that occurrence, such as a1.b2.
For a planned run, read the slot to get the steps in its pinned case version. For runner steps, you can use
short text labels. Mainworthy records those labels without checking whether they identify case steps. The
result keeps the recorded case version as its basis after a case edit.
A trail may cover only part of a case or repeat a step. Its order is the order
sent, and it does not change the result's overall outcome.
A step's optional attachment is a zero-based index into that result's own
attachments array in the same report. Send an image there as
{"name":"cart.png","data":"<canonical base64>"}. Only image attachments can be
step screenshots. A step's screenshot opens from its row on the web.
Later attach calls append files and do not change those indexes. MCP accepts inline attachments even though the compact tool list omits their schema. The HTTP operation
reference describes the attachment fields.
get and HTTP replies return the trail with the recorded result, including the
original action order and omitted fields. Test latest results, counted change
results, and planned-run slots show it on the web. Each step and any
recorded action outcome appears in words. Longer steps have a stronger background
tint relative to the longest step in that result. Missing and zero times have no
tint. The first fail or error in a present trail supplies atStep and takes
precedence over failure.at. An empty trail has no failed step. Without a trail,
failure.at remains the failure location.
Mainworthy refuses a report before accepting it if it exceeds a step trail limit. The reply names the limit it hit.
- 100 steps per result
- 100 actions per step
- 160 characters per step ID or label
- 2,000 characters per action
- 65,536 UTF-8 bytes of serialized trail JSON per result
- 1,048,576 bytes of trails per report
Text lengths count UTF-16 units. Attachment limits apply separately. Split a report to meet the report-wide limit, or shorten the observations to meet a result limit.
Playwright JSON carries recorded test.step data when the runner writes it.
The adapter keeps the final attempt's top-level steps and lists nested steps as
actions, with their path, outcome, and rounded milliseconds. The adapter marks a step with an error as fail and a completed step without an error as pass. Earlier retry steps do not
become the final result's trail. The JUnit, Jest, Vitest, pytest, and TRX adapters
do not currently carry case-step observations and do not invent trails.