Best Practices

None of the suggestions below are enforced by Atrahasis — they are habits that keep scripts readable, reliable, and safe to come back to after a few weeks away from them.

Pick the Right Store for the Data

at.environment persists to disk. Anything you set there is written into the active environment file and survives restarts. That is great for base URLs and long-lived config, but it is wrong for temporary data:

  • Step-to-step handoff (an ID created in step 1 that step 3 needs to delete) → at.flow.set, not at.environment.set.
  • Values that only matter for a single run → at.flow.
  • Secrets and base URLs that should be shared across runs → at.environment.

Pre-Script Writes Are Immediately Visible in Post-Script

Setting a variable with at.environment.setin a pre-script does not wait for disk persistence to be visible to the matching post-script — Atrahasis carries pre-script changes forward as pending overrides. This makes the pre-script the natural place to compute a value once and use it in both the request and the post-script that follows.

Budget the 1000-Character Log Cap

Every script has a shared 1000-character budget for all console output. Spamming console.logwith full request bodies will hit the cap and drop the important messages later in the script. In practice:

  • Log short identifiers, not full payloads — console.log("user:", data.id) instead of console.log(data).
  • Save console.warn and console.error for genuinely unusual outcomes — the prefixes stand out in the output strip.

If a Load Test Step Script Needs fetch, Move It to Lifecycle

Load test step scripts cannot call fetchor use await — those are step-engine limits. If a step script is secretly trying to make an outbound call, the cleanest fix is almost never to hack around the limit; it is to move the outbound call to Before All (to prepare data before the run) or After All (to ship results after the run).

Remember await on at.export.pdf()

Two of the three export methods are synchronous — json() and html(). The third, pdf(), returns a Promise<Uint8Array> and must be awaited. Forgetting the awaitsends a Promise object to your endpoint instead of the actual PDF bytes, which is surprisingly easy to miss at first glance.

Use After All as a CI/CD Hook

After All is the natural place to integrate a run with the rest of your tooling. A few patterns worth stealing:

  • Slack / Teams / Discord notification: a single fetch to the webhook with a short summary and a link to the HTML report.
  • Artifact upload: post the PDF or JSON from at.export straight to your artifact storage (S3, GCS, Azure Blob) as part of the run.
  • OpenTelemetry ingestion: the JSON export is already in OTel format — post it to any OTLP collector to land your Atrahasis runs inside your existing observability stack.