Build scenarios
Extensions and policies
Reach databases and queues with the actions of an extension, try a request again, stop the whole test on a failed check, scale the pauses, what a rendezvous does.
This page explains how to reach systems other than web sites (a database, a message queue…) without writing code, and how to tell a test what to do when something fails: try a request again, stop the whole test, or change the pauses of the virtual users.
Extensions: databases, queues and other systems
Some tests need more than web requests: count the orders in a database, publish a message on a queue. Swarmetry reaches them through extensions, built into a runner image of your organization (the package of programs that generates the load, with the extensions you need).
What the administrator prepares (once)
An organization administrator opens Organization admin → Extensions:
- Each registered extension has a card. Under Modules it provides, the administrator enters the module names scripts import (as the extension documents them), and saves them. Runner images built with the extension are checked against these names.
- Add an action describes something people can do with the extension, as a form: a key, a title and a description in English and in French, the parameters people fill in (text, number, yes or no, secret, text with variables, JSON, or a list of values), whether the action returns a value, and the code that runs it.
- An action that receives a secret (a password, a token) must return nothing: what it returns could reveal the secret. The form says so before saving.
Only administrators write this code, on this page: the assistant never creates nor changes it. The code is checked like any custom code before every test.

Choose the runner image of a test configuration
In the test configuration editor, the Runner image list (in the options) chooses the image with the extensions the scenario uses; The default runner has none. The image must be built (ready) before a test starts: otherwise the test is refused with a clear message.
- For now, a test with a runner image of your organization runs on the built-in load generator only: a test from countries is refused with a clear message (choose the built-in location, or remove the runner image).
- A test that opens a real browser needs a runner image built with the browser option.
- A script that imports an extension module — a scenario or a script written by hand — runs only on a runner image that provides it: on the default runner it is refused before the test.
- Run this node and the debug runs of the workflow editor use the runner image of the test configuration chosen in the Extensions category when the scenario uses extension actions or extension modules.
Add an action to a scenario
In the workflow editor, open the Extensions category of the palette and choose a test configuration: the actions of its runner image appear with their titles. Click one to add it after the selected step. Its panel is a form:
- each parameter has its own input; a wrong value is said in plain words (a number expected, a value outside the list, a required parameter);
- a secret parameter only takes a secret:
{{secret:NAME}}or a secret variable; other parameters never take one; - Keep the result in the variable stores the value the action returns, for the next steps and for the checks;
- checks on variables and When a check fails work as for a request.

Imports of custom code
Developers who write custom code can import modules without changing the script by hand: in the panel of a custom
code step, Imports adds a module (a built-in module or one of the image) under a name of your choice. Names the
script already uses (such as http or check) are refused.
Synthetic checks
Checks run on images without extensions: a scenario with extension actions, or importing an extension module, cannot be used as a check.
Try a request again (Retry)
A request may fail now and then for reasons outside the test (a short outage, a busy server). The Retry section of an HTTP or GraphQL request sends it again:
- Attempts in total: 2 to 10 (3 when you turn it on), the first try included: 3 attempts are the first try and up to 2 retries;
- Wait before the next attempt: 1 s by default, the same each time or twice as long each time (up to the Longest wait, 30 s by default). The panel shows the waits, for example 1 s, 2 s, 4 s;
- When: no response (network error), a response status of the list (502, 503 and 504 by default), and, if you want, when a check of the step fails.
Every attempt is a real request: it counts in the results, including the failed ones. The extractions and the checks read the last attempt. Requests that may create something twice (POST, PATCH) are not sent again unless you tick Also retry requests that may not be safe to send twice; a note and a problem in the list say so.
Stop the whole test
When a check fails offers Stop the whole test on requests, gRPC calls, check steps and extension actions. When a check of that step fails, the test stops for every virtual user, on every load generator; the end of the test still runs. The page of the run then says Stopped because the checks of step … failed. With a retry that also retries failed checks (When), the step stops the test only once its attempts are used up.
Think time
Pauses stand for the time real users spend reading or typing. The Think time section of the test configuration keeps them as designed, scales them (every pause multiplied by a factor from 0.01 to 100: 0.5 halves them) or removes them (none). The start dialog can change it for one test only. Scheduled tests use the think time of their test configuration; when the assistant shortens the pauses of a scheduled test, it asks you first, as for more virtual users.
Without pauses, each virtual user sends its requests back to back: the load per user grows a lot. A problem reminds you of it when the test uses a number of virtual users rather than a number of requests per second.
Rendezvous
A rendezvous step makes the virtual users wait until the clock reaches the next multiple of its window (every 10 s: :00, :10, :20…), so the virtual users that arrive in the same window leave together, on every load generator. It does not wait for a number of users. Pauses do not change it.
Ask the assistant
The assistant knows worked examples of extension actions, retries, stopping the test on a failed check and think time. It uses the actions your administrator defined and never writes extension code. Ask it, for example: “make 3 attempts on the product list when the gateway fails (the first try and up to 2 retries)” or “stop the whole test when the login fails”.