Run tests in your pipeline

The command-line runner, the results your CI tool reads, and ready-made examples.

One test, any pipeline

gtr-cli, the command-line runner, runs a test exactly like the Run Test button: same checks, same report, same history.It adds what a pipeline needs: an exit code, result files your CI tool understands, and every piece of evidence of a failure in one folder.

Your pipeline

and any tool that runs a command

.github/workflows/gui-tests.yml
jobs:  gui-tests:    runs-on: [self-hosted, windows]    steps:      - run: gtr-cli run tests --format github --junit results.xml

Running 12 tests on the screen of the build agent...

PASSED 12 of 12 tests · exit code 0

  • Exit code0 when every test passed, 1 when one failed: the build goes green or red.
  • JUnit, JSON, MarkdownResults your pipeline shows as test results, with every step named.
  • Every failure's evidenceExpected and actual pictures, the screen, the report and the video in one folder.

Prepare the build machine

A GUI test replays on a real screen, so the machine that runs it needs one.

NeedsWhy
Windows with GUI Test Studio installedThe installer puts gtr-cli on the PATH.
A signed-in, unlocked desktop sessionThe test clicks and types on the live screen.Run the build agent as a normal program in that session, not as a background service.
The tests' screen resolution and scalingElements are compared at the size they were recorded.
The app under testInstalled, or started by the test itself with a Run App step.
A seat of your planThe agent signs in once, with a machine key from your account page.

Create the key on your account page, under Machine keys, then run this once on the agent, as the Windows account the pipeline uses:

Command
gtr-cli login --key GTS-XXXX-XXXX-XXXX-XXXX

gtr-cli whoami says whether the agent is signed in and until when.Without a sign-in, a run does not start: it prints a line starting with COULD NOT RUN and ends with exit code 3.

Build agents: machine keys

Your first command

In a terminal on the build machine, run every test of a folder:

Command
gtr-cli run tests --countdown 0 --junit results\junit.xml --artifacts results\artifacts

--countdown 0 starts at once (nobody is at the screen), --junit writes the results file your CI tool reads, and --artifacts gathers videos, reports and failure pictures into one folder.

Is this machine ready?Checks every test without running it
gtr-cli check tests

What your pipeline gets back

Exit codeMeaning
0Every test passed.The build goes green.
1At least one test failed.
2The command was wrong: an unknown option, a missing file.
3A test could not run, for instance because the screen differs from the recording.
4A run was aborted.
FileFor
JUnit (--junit)The test results tab of GitLab, Jenkins, Azure DevOps, TeamCity and GitHub
Markdown summary (--summary)A merge request comment or the build summary page
JSON (--json)Your own dashboards and scripts
Artifacts folder (--artifacts)The video, the Confidence Report and the failure pictures of every test
Bug reports (--bug-report pdf)A filled-in bug report for every failed test

The runs also land in each test's results folder, so the History of GUI Test Runner-Recorder shows pipeline runs beside your own.

Ready-made examples

.github/workflows/gui-tests.yml
jobs:
  gui-tests:
    runs-on: [self-hosted, windows]
    steps:
      - uses: actions/checkout@v4
      - run: gtr-cli run tests --countdown 0 --format github --junit results\junit.xml --summary results\summary.md --artifacts results\artifacts
      - uses: actions/upload-artifact@v4
        if: always()
        with:
          name: gui-test-results
          path: results

Build a command without typing it

In either app, Command Line & CI/CD (in GUI Test Studio's File menu, in GUI Test Runner-Recorder's Test menu) builds the command for you: tick the options you want, copy the result, or copy the ready-made snippet for your CI tool with your real paths.Its Reference tab explains every option.

Options you will use

OptionWhat it does
--countdown 0Start at once.In a terminal, the default countdown gives you time to let go of the mouse.
--retries 1Run a failed test once more before calling it failed.
--fail-fastStop after the first failed test.
--timeout 600Abort a test still running after 10 minutes.
--baseline-profile "Dark mode"Run against one of your baseline profiles.
--start-at 12.5Start the test at this moment, in seconds.
--branch allFor a web test made for several browsers and devices: run every one, the recorded test included.Name one or several instead to run just those.
--headless onRun web tests without a browser window wherever the test allows it.
--parallel offRun a test's browsers and devices one after the other rather than side by side.
--screen allOn a build machine with several monitors: run on all of them, on the main one, on a monitor's number, on the terminal's screen, or where the test was recorded.By default, the screen the test's Project Settings name: the terminal's screen unless they name one.
--run-banner offHide the thin TEST RUNNING banner at the top of the screen during the run.
--ai-verification onLet AI give the final verdict of failed visual and text checks.The test's verdict and the exit code follow, and what changed is written to the console and the result files.
--ai-provider builtinUse a model on the build machine itself: nothing to install, and a model that is missing is downloaded once.
--ai-minor-differences failMake a check the AI finds only minor differences in fail.By default it passes.
--ai-wait 600The longest one test waits for its AI verdicts, in seconds.By default the tool chooses by itself.
Every option, explained
gtr-cli help

Report failures to Jira

A failed test can become a Jira issue by itself: the steps to reproduce, the expected and found pictures with what changed outlined, the bug report as a PDF and the evidence.The same defect seen again, on another build, browser or device, adds a comment to its open issue instead of a second one.

Command
gtr-cli run tests --countdown 0 --jira on-failure --jira-project SCRUM --jira-labels ui-regression
OptionWhat it does
--jira on-failureCreate a Jira issue for every failed test.A test that could not run never becomes one.
--jira-project SCRUMThe project the issues go to, by its key.
--jira-issue-type BugThe issue type.When the project has none of that name, the closest one is used.
--jira-assignee "James"Who the issue is assigned to: an email or a name of the project's people.
--jira-labels a,bLabels of your own, separated by commas.
--jira-repeat newAlways a new issue, never a comment on the open one.

The connection comes from the environment, so the token never shows in a command line or a build log: JIRA_BASE_URL (your Jira site), JIRA_USER_EMAIL and JIRA_API_TOKEN.In your CI tool, keep the token as a secret or password parameter.On a computer where GUI Test Runner-Recorder is connected to Jira, its stored connection is used instead.

The whole flow, with a real issue and a real build: Connect Jira to the Confidence Report.

Web apps on a build machine

A test recorded on a web app opens its browser by itself, in full-screen kiosk mode, and closes it at the end.On a build machine that asks for the screen size and display scaling of the recording, a signed-in and unlocked desktop, and a run that ends by its own time limit.Open Web App says what happens otherwise and what to do.

The same notes are in the tool itself:

Command
gtr-cli help web-apps

Every browser and device, in the pipeline

A web test made for several browsers and devices runs them all with --branch all, each with its own entry in the JUnit file and its own history.Phones, tablets and the other branches without a window run side by side, so they need no screen of their own.gtr-cli info lists the name of each, and gtr-cli generate makes the ones still missing.See Every browser and device from one recording.

Command
gtr-cli generate tests --branch missing
gtr-cli run tests --branch all --countdown 0 --junit results\junit.xml

Share tests without their recording

A test file holds its recording, which you need for editing but not for running.File, Export as Lightweight Runner Test (.GTR) in GUI Test Studio writes the same test without it: a much smaller file for a build machine or a colleague who only runs tests. gtr-cli and GUI Test Runner-Recorder run .GTR files like any test.

Test (.GTS)Runner test (.GTR)
HoldsThe steps, the checks and the visual reference: the recording, pictures and designsThe steps and the checks only
Made forCreating and editing the testRunning the test
SizeLarger: it grows with the recordingMuch smaller
Opens inGUI Test Studio and GUI Test Runner-RecorderGUI Test Runner-Recorder and gtr-cli

When to use a runner test

Use it wherever a test only runs: a build machine, a tester's computer, a set of tests that has to travel or be kept with your code.A run of a runner test gives the same result and the same report as its test.

Keep the test itself

A runner test cannot be edited: GUI Test Studio does not open it.Keep the .GTS as the original, edit it there, and export again after a change.GUI Test Runner-Recorder can export one too, from its Test menu or the export button on the test's page.

A web test with several browsers and devices

The export asks what to include.Every Browser and Device puts every generated branch in the one file, ready for --branch all.Only the recording, or only the branch you show, makes a runner test of that one alone.A runner test can only be run: new browsers and devices are made from the .GTS.

Keeping tests with your code

Tests are ordinary files: keep them in your repository next to the code they test, and every branch carries the tests that fit it.

Still stuck?Tell us what you were trying to do, and we answer within one working day.Ask our team