Contexts & Scenarios

Contexts let you test your AI against multiple realistic user personas — each with their own data — without duplicating test suites.

What is a Context?

A Context is a schema: a set of typed fields that describe what a "user" or "situation" looks like for your application. For example, a recommendation engine might have a context with fields like name, age, watch_history, and friend_activity.

What is a Scenario?

A Scenario is one concrete instance of a Context — a specific user with real data. You might have scenarios like "Morgan (action fan)", "Casey (arthouse watcher)", and "Jordan (new user)".

When you run a test suite against a context, Litmus Lab runs it once per active scenario, injecting each scenario's data as variables via Context Mapping.

Creating a Context

  1. In your project, go to Contexts and click New Context
  2. Define your fields — set the name, type, and description for each
  3. Add examples and mark fields as Required as needed
  4. Use Default to pre-fill example values into new scenarios automatically
  5. Use Omit to exclude sensitive fields (like passwords) from LLM evaluations

Field types

TypeUse for
stringText values
numberNumeric values
booleanTrue/false flags
arrayLists (of strings, numbers, or objects)
objectNested structures

For array fields, set the item type. For array of objects or object, add child fields to define the nested schema.

Creating Scenarios

In the Scenarios tab of a context, click Add Scenario. Fill in values for each field. You can also Import JSON to paste in scenario data directly.

Scenarios can be toggled active or inactive per test suite from the Test Cases tab.

Attaching a Context to a Test Suite

In Test Builder, go to the Flow tab and select a Context under Suite Settings. Then go to the Context Mapping tab to define how context fields map to the variables used in your steps and assertions.

The Omit flag

Fields marked Omit are excluded from LLM evaluation prompts (both the schema definition and the scenario data). Use this for passwords, tokens, or any field that shouldn't be sent to an external model. Omitted fields are still available for deterministic checks and variable injection.