Skip to main content

Suite Variables

The [variables] section in a suite file injects key-value pairs into the runtime variable scope for every request in that suite. This is the primary mechanism for parameterizing a suite without modifying any individual request file.

Defining Suite Variables​

[suite]
name = "Staging Run"
ordered = true

requests = [
"auth/login.toml",
"users/get_profile.toml",
]

[variables]
base_url = "https://staging.api.example.com"
api_version = "v2"
target_user = "42"

All requests in the suite can use {{base_url}}, {{api_version}}, and {{target_user}} without those variables being declared anywhere else.

Priority in the Resolution Chain​

Suite variables are merged into the runtime variable map before execution begins. Their priority in the variable resolution chain is:

PrioritySource
1 (Highest)Vault Secrets ({{vault.secret}})
2CLI -V overrides
3Request [variables]
4Suite [variables] ← this section
5Explicit -e custom env file
6Hierarchical Directory *.env.toml files (nearest dir > workspace.env.toml)
7 (Lowest)Collection [variables] (*.config.toml, collection.toml)

This ensures that while a suite can provide sane defaults for a regression run, you can always quickly override a specific value at runtime using -V without modifying any files.

Values Are Always Strings​

All variable values must be TOML strings:

[variables]
timeout = "30" # ✅ string
page_size = "10" # ✅ string
debug = "false" # ✅ string
retries = 3 # ❌ integer — will cause a parse error

Variable Interpolation​

Suite variables can reference other variables, including those from workspace.env.toml:

# workspace.env.toml
base_url = "https://api.example.com"
# targeted.suite.toml
[variables]
users_url = "{{base_url}}/users"
posts_url = "{{base_url}}/posts"

Rumour resolves these with multi-pass expansion (up to 3 passes).

Nested Suite Variable Merging​

When a suite references nested suites, each nested suite's [variables] are merged in expansion order. Later nested suites override earlier ones for the same key:

# parent.suite.toml
[suite]
requests = [
"suite_a.suite.toml", # provides: env = "staging"
"suite_b.suite.toml", # provides: env = "production" → wins
]

Example​

A suite that targets specific resource IDs without modifying the request files.

First, initialize a workspace (skip this step if you already created it in a previous tutorial) and scaffold a new suite_variables collection:

# Skip the init step if you already created the workspace in the previous tutorial
rumour init suite_examples
cd suite_examples

# Scaffold the new collection
rumour new suite_variables -y

File Layout​

suite_examples/
├── workspace.env.toml
└── suite_variables/
├── targeted.suite.toml
└── requests/
├── get_post.toml
└── get_user.toml

workspace.env.toml​

base_url = "http://localhost:4000/api/v2"

suite_variables/targeted.suite.toml​

[suite]
name = "Targeted Run"
ordered = true

requests = [
"requests/get_post.toml",
"requests/get_user.toml",
]

[variables]
target_post_id = "2"
target_user_id = "3"

suite_variables/requests/get_post.toml​

name = "get_post_with_suite_var"

[request]
method = "GET"
url = "{{base_url}}/users/{{target_post_id}}"

[assert]
status = 200

suite_variables/requests/get_user.toml​

name = "get_user_with_suite_var"

[request]
method = "GET"
url = "{{base_url}}/users/{{target_user_id}}"

[assert]
status = 200

Run​

$ rumour run ./suite_variables/targeted.suite.toml -v

Output​

$ rumour run ./suite_variables/targeted.suite.toml -v

GET http://localhost:4000/api/v2/users/2
URL: http://localhost:4000/api/v2/users/2
✓ SUCCESS: ./suite_variables/requests/get_post.toml (10ms)
GET http://localhost:4000/api/v2/users/3
URL: http://localhost:4000/api/v2/users/3
✓ SUCCESS: ./suite_variables/requests/get_user.toml (9ms)

╭──────────────────────────────────────────────────────────────────────────╮
│ RUMOUR EXECUTION REPORT │
├──────────────────────────────────────────────────────────────────────────┤
│ Total Requests: 2 │
│ Successful: 2 │
│ Failed: 0 │
│ Skipped: 0 │
│ Success Rate: 100.0% │
│ Total Time: 20ms │
╰──────────────────────────────────────────────────────────────────────────╯

✓ Successful Requests:
- ./suite_variables/requests/get_post.toml [200] [10ms]
- ./suite_variables/requests/get_user.toml [200] [9ms]

Actionable Recommendations:
→ Run with --json to export this report for your CI/CD pipeline.

target_post_id = "2" and target_user_id = "3" are injected from the suite — the request files themselves have no knowledge of which IDs to use. To run against different IDs, only the suite file needs to change.

Parameterized CI/CD Runs​

Use CLI -V overrides to further parameterize a suite at runtime without modifying any file:

# Override a suite variable from the command line
rumour run ./targeted.suite.toml -V target_post_id=5 -V target_user_id=7

This lets a single suite file serve multiple CI environments by passing different values at invocation time.