What Scripts Are For
- Mutate backend state: seed test data, create users, reset account balances, enqueue jobs, open/close feature toggles
- Generate credentials: mint a fresh test user, call your auth service for a short-lived token, rotate API keys per run
- Compute dynamic values: unique emails (
test+{{timestamp}}@example.com), hash challenges, signed URLs, HMAC signatures - Call external services: hit your APIs, a third-party sandbox, a CI system, or a notification channel mid-test
- Parse or transform data: pull a value out of a response, decode a JWT, compute a checksum for validation
Creating a Script
- Go to Library > Scripts tab
- Click New script
- Name it, pick a language (Python, JavaScript, TypeScript, or Bash), and write your code
- Save. The script is now available org-wide.
Using a Script in a Test
In the test editor, add a Script step and select a saved script from the dropdown. The script runs in a sandboxed environment when the test hits that step.Saving Output to a Variable
Setvariable_name on the Script step and the script’s stdout is stored in that variable. Reference it in later steps: