RequestTailor Preview (22 November 2026): requests as files in Git, no account, offline – on the Mac, in the browser and in the pipeline. What’s inside → +43 664 1964199Contact →

Scripts, tests and runner

RequestTailor runs scripts in a sandbox: before the request, after the response and as tests. Assertions check status, headers and body without a line of JavaScript. The runner sends a folder or the whole collection in order, also several times and with a data file – and rt run does the same in the pipeline, with the same results.

Edition
Free
Where
Scripts and Assertions tabs of the request; Run in the header
Engine
QuickJS as WebAssembly, sandboxed
Limits
5 s per phase, 64 MiB of memory (default)
Pipeline
rt run, exit code 4 on failure

Three phases: pre-request, post-response, tests

The Scripts tab of a request has three fields. Each is optional; the number on the tab shows how many are filled.

Scripts tab of a GET request Health with three fields: PRE-REQUEST sets the variable requestedAt, POST-RESPONSE is empty, TESTS checks that the status is 200
A request with a pre-request script and one test. Sending is Mod+Enter as always.
  1. Pre-request runs before sending. It may change the request (URL, headers, body) and set variables; what it sets goes into the runtime layer and applies to this request already.
  2. Post-response runs after the response, for example to keep a token from the body for the next requests.
  3. Tests runs last. Every test("…", () => …) appears with its name and result in the response’s Tests tab.

Scripts also exist at folder and collection level. They run in this order: collection, folders from the outside in, request. All scripts of one phase share one scope; each phase starts fresh.

// Pre-request: a timestamp as a variable
rt.vars.set("requestedAt", new Date().toISOString());

// Post-response: keep a token for the session
rt.vars.set("token", rt.response.json().access_token);

// Tests
test("status is 200", () => {
  expect(rt.response.status).to.equal(200);
});

The API is called rt: rt.request, rt.response, rt.vars, rt.info, rt.sendRequest, rt.sleep and rt.runner, plus test, expect (the common chai words) and console. The complete types are in crates/rt-script/api.d.ts in the core repository.

Trust: scripts run only when you allow it

A collection from someone else’s repository can contain scripts. That is why RequestTailor asks once per collection and device. Above the interface, “This collection contains scripts. Run them?” appears with Trust and run scripts and Not now.

  • Until you trust it, requests are sent without scripts; the report then carries a warning note.
  • Not now hides the question for this collection until the next start.
  • Assertions always run: they are not JavaScript but are evaluated in the core.

Variables from scripts

rt.vars.set(name, value, layer) writes into one layer: runtime (default), environment, collection or global. It writes in memory only: in the app for the session of the selected environment, in the runner and in rt run for the run. A script never writes files – the files in the repository stay the truth.

Values are strings. Numbers, booleans and objects are stored as JSON; in the same phase the script reads the value back with its type, later as text. The Session variables button shows and clears the variables of the session.

Assertions without JavaScript

The Assertions tab checks the response declaratively: Expression, Operator, Value. Expressions are for example res.status, res.headers.name, res.responseTime or a path into the body such as res.body.items[0].id.

GroupOperators
Comparisoneq, neq, gt, gte, lt, lte, between
Lists and textin, notIn, contains, notContains, length, matches, notMatches, startsWith, endsWith
Without a valueisEmpty, isNotEmpty, isNull, isUndefined, isDefined, isTruthy, isFalsy, isJson, isNumber, isString, isBoolean, isArray

The operators are Bruno’s, in Bruno’s order, so Bruno assertions run unchanged. Under Variables from the response you also create variables from the response, again without a script.

Postman, Bruno and Insomnia scripts

Imported scripts stay as they are. bru.*, req, res, pm.*, postman.* and insomnia.* run as shims on the rt API. On top come built-in modules for require: crypto-js (hashes, HMAC, PBKDF2, no ciphers), lodash (about 130 functions), moment (no time zones), uuid (v4), chai, tv4, ajv, atob/btoa.

What is missing fails with a clear error instead of a meaningless TypeError, and the import’s loss report names every unsupported API with the request it is in. The main differences:

  • No Node.js: no fs, path, Buffer, process or fetch.
  • bru.setEnvVar(…, { persist: true }) and Postman’s environment writes do not change files.
  • setTimeout and bru.sleep run on rt.sleep and count against the time limit.
  • Bruno’s gRPC and WebSocket scripts (bru.grpc, onMessage) do not run.

The complete list with a status per API is in crates/rt-script/SHIM-COVERAGE.md in the core repository.

The runner

The runner sends every request of a folder or the collection in order: folders and requests by their order (seq), then by name, folders depth first. Variables that scripts set apply to the following requests of the run.

Runner window Run folder: users with 3 iterations, delay 0, Stop at the first failure, environment Local and Data file; six green rows Create user and List users with status 200, below them the tests of the selected step
A run over the folder users with three iterations: all six requests green, the selected step with its tests below.
  1. Click Run in the header (the whole collection) or a folder’s run button; in the command palette (Mod+K) the entry is Run collection.
  2. Set Iterations, Delay (ms) and Stop at the first failure if needed. The environment is the one selected at the top.
  3. For data-driven runs, choose a CSV file (header row, then one row per iteration) or a JSON file (an array of objects) with Data file…. Each row becomes variables of its iteration.
  4. Start the run. Each row shows method, name, status, time and passed tests; clicking a row shows its request and test results below.

Scripts steer the run with rt.runner.skip() (skip this request) and rt.runner.setNext(name) (continue with another request; null ends the run).

In the pipeline: rt run

rt run uses the same core, the same scripts, plugins and auth as the apps. What is green in the app is green in the pipeline.

rt run api/users -e Staging --var token=$API_TOKEN
rt run . --data users.csv --reporter junit=reports/junit.xml --reporter json=reports/run.json
OptionMeaning
--data FILECSV or JSON; each row is one iteration
--iterations NRun the requests N times
--delay MSPause between requests
--bailStop at the first failure
--reporter NAME[=FILE]text, json or junit, repeatable
--no-scriptsWithout scripts; assertions still run
--no-promptAn OAuth 2.0 flow that needs a person fails instead of waiting

Exit code 4 means a request, a test or an assertion failed. 0 means everything passed – an HTTP 500 without a test counts as passed. Secrets come in as variables of the CI job through --var, never into the collection. There is an action for GitHub and a Docker image for GitLab and others; examples are in rt command line.

See also

Sources on this page

The superscript numbers in the text point here. Tap one to see the source right where it is used; all sources of this website are listed on one page.

  1. 1

    Script sandbox: QuickJS in WebAssembly ↑Product · RequestTailor core repository, crates/rt-script (api.d.ts, README) · checked on 2026-11-22

  2. 2

    Shims for bru.*, pm.* and insomnia ↑Product · RequestTailor core repository, crates/rt-script/SHIM-COVERAGE.md · checked on 2026-11-22

  3. 3

    Runner, rt run, JUnit and JSON, exit code 4 ↑Product · RequestTailor core repository, crates/rt-core (runner, assert), crates/rt-cli/README.md (Exit codes) · checked on 2026-11-22

Frequently asked

Short answers.

Can I write tests without knowing JavaScript?
Yes. The Assertions tab checks status, headers, response time and values in the body with operators such as eq, contains or isJson. Assertions also run in collections whose scripts you do not trust, and in rt run with --no-scripts.
Do Postman tests with pm.test and pm.expect run?
Yes, through shims on RequestTailor’s script API. What is not supported fails with a clear message, and the import’s loss report names it beforehand. The coverage per API is in SHIM-COVERAGE.md in the core repository.
Can scripts read files or access the network?
No. Scripts have no file access and no network except rt.sendRequest, which sends through the same transport as the request. They do not write variables into files either.
What does JUnit show in CI?
One test suite per request, one test case per test and per assertion. A request that got no response at all appears as an error; a request without tests as a passing test case, so every request is listed.

Your question isn’t here? Talk to me: +43 664 1964199 office@clouddna.at Get in touch

Contact

Requests in the repo instead of an account? Talk to us.

Free is free and stays free. For an early copy, for Enterprise, for the OData plugin on your SAP system or for a wish for Pro and Team: write to me. I reply within one working day, personally.

Martin KochManaging Director, CloudDNAI read every request myself and reply personally.