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
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.
| Needs | Why |
|---|---|
| Windows with GUI Test Studio installed | The installer puts gtr-cli on the PATH. |
| A signed-in, unlocked desktop session | The 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 scaling | Elements are compared at the size they were recorded. |
| The app under test | Installed, or started by the test itself with a Run App step. |
| A seat of your plan | The 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:
gtr-cli login --key GTS-XXXX-XXXX-XXXX-XXXXgtr-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.
Your first command
In a terminal on the build machine, run every test of a folder:
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.
gtr-cli check testsWhat your pipeline gets back
| Exit code | Meaning |
|---|---|
| 0 | Every test passed.The build goes green. |
| 1 | At least one test failed. |
| 2 | The command was wrong: an unknown option, a missing file. |
| 3 | A test could not run, for instance because the screen differs from the recording. |
| 4 | A run was aborted. |
| File | For |
|---|---|
| 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
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: resultsBuild 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
| Option | What it does |
|---|---|
| --countdown 0 | Start at once.In a terminal, the default countdown gives you time to let go of the mouse. |
| --retries 1 | Run a failed test once more before calling it failed. |
| --fail-fast | Stop after the first failed test. |
| --timeout 600 | Abort a test still running after 10 minutes. |
| --baseline-profile "Dark mode" | Run against one of your baseline profiles. |
| --start-at 12.5 | Start the test at this moment, in seconds. |
| --branch all | For 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 on | Run web tests without a browser window wherever the test allows it. |
| --parallel off | Run a test's browsers and devices one after the other rather than side by side. |
| --screen all | On 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 off | Hide the thin TEST RUNNING banner at the top of the screen during the run. |
| --ai-verification on | Let 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 builtin | Use a model on the build machine itself: nothing to install, and a model that is missing is downloaded once. |
| --ai-minor-differences fail | Make a check the AI finds only minor differences in fail.By default it passes. |
| --ai-wait 600 | The longest one test waits for its AI verdicts, in seconds.By default the tool chooses by itself. |
gtr-cli helpReport 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.
gtr-cli run tests --countdown 0 --jira on-failure --jira-project SCRUM --jira-labels ui-regression| Option | What it does |
|---|---|
| --jira on-failure | Create a Jira issue for every failed test.A test that could not run never becomes one. |
| --jira-project SCRUM | The project the issues go to, by its key. |
| --jira-issue-type Bug | The 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,b | Labels of your own, separated by commas. |
| --jira-repeat new | Always 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:
gtr-cli help web-appsEvery 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.
gtr-cli generate tests --branch missing
gtr-cli run tests --branch all --countdown 0 --junit results\junit.xmlShare 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) | |
|---|---|---|
| Holds | The steps, the checks and the visual reference: the recording, pictures and designs | The steps and the checks only |
| Made for | Creating and editing the test | Running the test |
| Size | Larger: it grows with the recording | Much smaller |
| Opens in | GUI Test Studio and GUI Test Runner-Recorder | GUI 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