Writing Tests
Test files are TOML files with a .test.toml extension. Each file has a name and a list of steps.
Basic structure
Section titled âBasic structureâname = "Login flow"
[[steps]]instruction = "Navigate to /login and verify the page loads"
[[steps]]instruction = "Enter valid credentials and submit the form"
[[steps]]instruction = "Verify you are redirected to the dashboard"The name field identifies the test in console output and reports. Each [[steps]] entry is one step sent to the AI agent.
Writing good instructions
Section titled âWriting good instructionsâEach step should describe what to verify, not how. The agent figures out the implementation.
Good:
[[steps]]instruction = "Make a GET request to /api/items and verify it returns a JSON array with 3 items"Too vague:
[[steps]]instruction = "Check the API"Too prescriptive:
[[steps]]instruction = "Run curl -s http://localhost:3000/api/items | jq length and check it equals 3"Tips:
- Be specific about expected values (â3 itemsâ, âstatus 200â, âcontains âWelcomeââ)
- One assertion per step keeps results clear
- Steps run in order within a single agent session â state carries forward
The result contract
Section titled âThe result contractâEvery step must produce exactly one result. The agent emits a marker at the end of its work:
RESULT OKRESULT WARN: Items returned but order was unexpectedRESULT ERROR: Expected 3 items but got 0- OK â the step passed
- WARN â something was off but not a hard failure
- ERROR â the step failed
Bugatti parses the last RESULT marker in the agentâs output. If no marker is found (or the step times out), itâs treated as a protocol error and the step fails.
Agent logging
Section titled âAgent loggingâThe agent can emit structured log lines during execution:
BUGATTI_LOG Created test user with id=42BUGATTI_LOG Screenshot saved to /tmp/login-page.pngThese appear in the console output and are captured in the run artifacts, separate from the full transcript.
Per-step timeout
Section titled âPer-step timeoutâOverride the default timeout for a specific step:
[[steps]]instruction = "Run the full migration suite"step_timeout_secs = 600The default is set in bugatti.config.toml (or 300 seconds if not configured).
Whatâs in a step
Section titled âWhatâs in a stepâEach step must have exactly one of:
| Field | Purpose |
|---|---|
instruction | Plain-English instruction sent to the agent |
include_path | Path to another test file to inline (see Includes) |
include_glob | Glob pattern to inline multiple test files (see Includes) |
Optional fields on any step:
| Field | Purpose |
|---|---|
step_timeout_secs | Per-step timeout override (seconds) |
skip | If true, step is skipped (see Skipping) |
checkpoint | Checkpoint name (see Checkpoints) |