Variables Overview & Resolution Order
RouteCase features a multi-tiered variable system supporting environment variables, chained response values, and dynamic test data generators.
Variable Syntax
Section titled “Variable Syntax”RouteCase uses curly brace syntax:
- Double Curly Braces
{{VARIABLE}}: Replaced by RouteCase’s variable expansion engine (environment variables, captured values, or dynamic generators). - Single Curly Braces
{id}: Used exclusively in endpointpathtemplates to define path parameter placeholders (substituted fromparams: { "id": "val" }).
Resolution Order & Precedence
Section titled “Resolution Order & Precedence”When evaluating a {{...}} variable expression, RouteCase resolves values in strict order:
Priority 1
Captured Runtime Variables (
Highest Precedence
capture)
Priority 2
Workspace Environment Files (
Precedence 2
.rcase.env, .rcase.env.json)
Priority 3
VS Code Workspace Settings (
Precedence 3
routecase.env)
Priority 4
Dynamic Built-in Generators (
Fallback Precedence
{{$uuid}}, {{$isoDate}}, {{$randomEmail}})
- Captured Variables (
capture): If an earlier test case extracted a token namedauthToken,{{authToken}}will take top priority. - Environment Files (
.rcase.env/.rcase.env.json): Workspace environment files are evaluated next. - VS Code Settings (
routecase.env): Configuration defined in workspace settings. - Dynamic Generators (
{{$...}}): Variables beginning with a dollar sign$are evaluated by the built-in generator engine.
Where Variables Can Be Used
Section titled “Where Variables Can Be Used”Variables can be placed in any of the following fields:
- Root
baseUrl - Root, endpoint, and case
headers - Path template
params - URL
queryparameters - Request
body(inside string values, object keys, or nested arrays)
