Context Mapping
Context Mapping connects your scenario data to the variables used in your test flow. Each mapping entry takes a field from the scenario and makes its value available as a {{VARIABLE}} in your steps, request bodies, and assertion rubrics.
How to add a mapping
In Test Builder, go to the Context Mapping tab. Click Add mapping, then:
- Pick the context field you want to map (use the field tree to select nested fields)
- Choose a variable name (e.g.
USER_ID) - Choose the mapping type
- Click Add
The variable is then available as {{USER_ID}} anywhere in the test.
Mapping types
direct
The field value is used as-is. Best for simple scalar values like strings and numbers.
field: id → variable: USER_ID → {{USER_ID}} = "5550000001"
json
The field value is serialized as JSON. Useful for passing a structured object or array as a variable.
field: watch_history → variable: WATCH_HISTORY → {{WATCH_HISTORY}} = "[{\"title\":\"Barbie\",...}]"
summary
The field value is formatted as a human-readable summary. Useful for injecting array data into an LLM rubric where you want readable text rather than raw JSON.
field: friend_activity → variable: FRIEND_ACTIVITY → {{FRIEND_ACTIVITY}} = "Barbie, Oppenheimer, ..."
jmespath
A JMESPath expression is evaluated against the scenario data to extract a specific subset. This is the most powerful option — it lets you filter, pluck, and transform scenario data.
field: watch_history[*].title
→ variable: already_watched
→ {{already_watched}} = "Barbie, Oppenheimer, The Batman"
Common JMESPath patterns:
| Pattern | What it does |
|---|---|
watch_history[*].title | All titles from an array of objects |
friend_activity[?rating==\5`].title` | Titles where rating equals 5 |
watch_history[?days_ago<=\30`].title` | Titles watched in the last 30 days |
friend_activity[?days_ago<=\30` && rating>=`4`].title` | Recent titles with high ratings |
Using mapped variables in rubrics
Once mapped, variables are available in assertion rubrics:
Must not recommend any title from: {{already_watched}}
Prioritize titles from: {{friend_recent_likes}}
This makes your evaluations scenario-specific — the rubric references actual data from each user's scenario rather than generic criteria.