Running tests with a TR Test Agent

Running tests with a TR Test Agent

Install the agent on your machine or CI runner, run an approved test on an environment and read the step-by-step results.

Engineering Intelligence Open in TR-AI6 min
  1. 1
    Retired
    Remote TR Test Agents were retired on 19 November 2026: tests run in Test Studio Desktop on your computer. The steps below describe how agents worked, for runs made with them.
  2. 2
    Prepare the machine
    Install Node 18 or later. In a folder, run npm i playwright and npx playwright install chromium (add firefox or webkit if you want those browsers). Google Chrome and Microsoft Edge use the browsers already installed.
  3. 3
    Add the agent
    Test Studio → Runs → TR Test Agents → Add agent (Test Studio managers). Copy the token and key straight away: they are shown once.
  4. 4
    Start it
    Download tr-test-agent.mjs from the same panel and run TR_TEST_AGENT_TOKEN=… TR_TEST_AGENT_KEY=… node tr-test-agent.mjs. Add TR_BROWSERS=chromium,firefox to offer more browsers and TR_CONCURRENCY=2 to run two tests at once. It shows as online within a minute.
  5. 5
    Give it the secrets
    Test data marked as a secret is never sent to the agent. Set it on that machine as TR_<NAME>, for example TR_PASSWORD. Uploads need TR_UPLOAD_DIR, a folder of test files.
  6. 6
    Run a test
    Open an approved test case, choose the environment, browser, agent and retries, and press Run. Only approved versions run, and a production environment must be authorised first.
  7. 7
    Read the result
    The run shows every step as passed, failed, skipped (manual) or not run, with timings, the error and a screenshot of the failing step, plus console errors and failed requests.
Tips & tricks
  • The agent checks each job’s signature and expiry, and refuses anything else. It only lets the page open the environment’s allowed hosts.
  • A failing check isn’t retried; an agent error (the browser couldn’t start, the agent went offline) is retried up to the run’s retry limit.
  • Use TR_ONCE=1 in CI: the agent finishes its current work and exits.
  • Cancel a queued or running run from its page; the agent stops before the next step.