Skip to content
Swarmetry

Build scenarios

Scenarios

Import, record, edit visually or as code, keep versions.

A scenario describes what a virtual user does. Its source of truth is a structured document (the Scenario IR); the test script is compiled from it. You can also write a free script in JavaScript (then Swarmetry stores your code as is).

Scenarios

Create a scenario

Way When
Import a file you already have HAR 1.2, OpenAPI 2/3/3.1, Postman v2.1, cURL, JMeter .jmx or a JavaScript test script
Record you want to capture a real browsing session
Visual editor build or refine flows with a canvas
Free script you prefer code

Import

Scenarios > Import a file: upload the file or paste its content. The format is detected. Warnings tell you what was approximated (each with its location). Credentials found in the file become secret references. A JMeter file or a test script also brings its load profile as a test configuration named imported.

Import

Record with the browser

Recordings > New recording (Editor role). Choose the start URL (it must be one of the sites to test), a mode, a maximum duration and an idle timeout.

  • Browser mode opens a disposable browser inside the page: browse as a user. Stop the recording when done.
  • Proxy mode gives you a proxy address, user and password and a certificate authority to install in your own browser or tool; only HTTP/1.1 traffic is captured, WebSocket upgrades only as a handshake.

Site behind a firewall. The recording browser (and the proxy) reaches your site from the platform's own host, not from a load generator. The New recording dialog and the recording screen list the addresses to allow on your firewall or allow-list; if none are listed, ask the platform's support. Allow them before recording, or the start page does not load. The validation replay runs on the built-in load generator instead: its confirmation lists the addresses it comes from.

Recording

Let the assistant drive. In browser mode the assistant (and MCP clients, the CLI and the API) can drive the browser for you: "record the journey Shop on https://shop.example.com/login as alice with the secret ALICE_PASSWORD, add a product to the cart, then stop". It reads the page as text, then clicks, types, presses keys, selects options, scrolls and goes back; everything it does is captured exactly like your own actions, so the recording becomes the same scenario. Passwords are typed from a project secret that you name: the assistant never sees the value, and a secret only goes into a password or credential field. A banner above the browser shows when an automation drives it; Take back control stops its actions at once (you keep the browser), Let the automation drive allows them again. Page content is treated as untrusted: while it drives a browser the assistant can only use the browser and recording tools. A long journey can take more steps than one answer of the assistant allows: it then stops and says so; ask it to continue.

Assistant driving

After the end, open Review and generate: Swarmetry analyses the capture, filters noise (static files, third parties, beacons), groups pages, keeps think times, and proposes correlations (a CSRF token or id read from one response and reused later) with a confidence. Review the rules, mark entered data as variables or dataset columns, keep or discard suggested checks, optionally store the recorded password as a secret, then Generate the scenario as an HTTP flow or a browser flow. A validation replay (one virtual user, one iteration) compares the replay with the recording and highlights correlations that failed. Export HAR is available too.

Review

Visual editor

Open a scenario, then Workflow. Drag steps from the palette (HTTP, GraphQL, gRPC, WebSocket, SSE, browser, condition, loop, pause, check, set variable, script, sub-flow, rendezvous, group) or use the + on any edge. Select a node to edit it in the side panel: request, extractions, checks. Type {{ for completion of variables, dataset columns, environment variables and secrets. Undo/redo, copy/paste, multi-selection and keyboard shortcuts are available (help menu).

Debugging: Run this node or Run the flow executes one flow once with one virtual user and shows each step's request, response, extracted variables and check results, with secrets masked.

The toolbar counts the problems of the scenario (errors, warnings, notes); many come with a one-click fix — see Problems and quick fixes.

To log in once per virtual user, keep values between iterations or generate test data (random values, dates, counters, signatures with a secret), see Sessions and test data.

Workflow editor

Code view

The Script page shows the compiled test script (read-only for structured scenarios, following the node you select in the editor) with completion of the scripting API. For a free script the same editor is where you write your code. Free scripts are statically checked before a run (forbidden modules, remote imports, undeclared hosts).

User-Agent of a free script. A free script sends the platform's User-Agent (for example Swarmetry (+https://swarmetry.io)) unless its own options set one. To keep another value, set userAgent in the script's options; "" sends no User-Agent header:

export const options = { userAgent: 'MyCompany-LoadTest/1.0' };

When the options are built in a way the platform cannot read in advance (by a function, for example), it reads them by starting the script once before the run. If that fails, the run keeps the test engine's own User-Agent and its logs say so: set userAgent in the options to choose one. A User-Agent header set on a request still wins for that request.

Script

Versions

Every save creates an immutable version. The scenario page lists them with author (a person, or the assistant acting for a person). You can compare two versions (structure and compiled script), restore one (it becomes a new version) and duplicate the scenario with its test configurations. If someone saved before you, you are offered a merge or a reload. Runs always record the exact version they ran.

Diff