Skip to content

Report Parallel Tests

When tests run in parallel, each process can send its own report, and one build turns into many runs. Pick one of three strategies to collect everything into a single run report.

Diagram: Pick a strategy - one machine → @testomatio/reporter run; shards on several machines → shared run; multi-stage pipeline → create and close the run yourself

Strategy Works when How it joins the reports
Shared run Tests are spread across jobs, containers, or machines Every process reports to the run with the same title
@testomatio/reporter run All processes start on one machine The reporter creates one run and hands its ID to every process
Create and close the run yourself A pipeline with separate stages You open the run, run tests, then close it

Every process reports into the run that has the same title.

Diagram: Shared run for parallel processes

Pick a title that is unique for this build, and turn on the shared run with TESTOMATIO_SHARED_RUN=1:

TESTOMATIO_SHARED_RUN=1 TESTOMATIO_TITLE="UniqTitleForThisBuild" <actual run command>

On CI, the pipeline or workflow ID makes a good title:

TESTOMATIO_TITLE="Pipeline $CI_PIPELINE_ID" TESTOMATIO_SHARED_RUN=1 <actual run command>

A Git commit works too:

TESTOMATIO_TITLE="Commit $GIT_COMMIT" TESTOMATIO_SHARED_RUN=1 <actual run command>

Check your CI documentation for a variable that stays the same across all jobs of one build. A bit more context in TESTOMATIO_TITLE makes the run easier to find later.

Start your tests through the reporter:

npx @testomatio/reporter run "<actual run command>"

The reporter creates an empty run and passes its ID to every process it starts, so all of them report to one run.

Diagram: Reporter run for parallel processes

You open the run, run the tests, and close the run when everything is done. In a multi-stage pipeline, this maps onto your stages: start the run in stage 1, run tests in parallel in stage 2, and close the run in stage 3.

Diagram: Create and close the run

  1. Create a run with @testomatio/reporter start, and save its ID in RUN_ID:

    RUN_ID=$(TESTOMATIO=xxx npx @testomatio/reporter start --format id)
  2. Run your tests with the run ID and the TESTOMATIO_PROCEED variable, so the run stays open:

    TESTOMATIO=xxx TESTOMATIO_RUN=$RUN_ID TESTOMATIO_PROCEED=1 <actual-run-command>
  3. Close the run with @testomatio/reporter finish once all tests finish:

    TESTOMATIO=xxx TESTOMATIO_RUN=$RUN_ID npx @testomatio/reporter finish

--format id prints only the run ID, so RUN_ID gets a clean value. Pass RUN_ID to every stage of your pipeline. Without the ID, the tests report to a new run, and the run from step 1 stays open.

All results now land in one run report, however many processes sent them.