Docs/Scenarios

Scenarios

Scenarios let you group mocks together and apply per-mock overrides — perfect for testing complete user flows or switching between different application states.

Scenarios walkthrough

What is a Scenario?

A scenario is a named collection of mock references with optional overrides. When a scenario is active, Mock Studio applies the scenario-specific settings on top of the base mock definitions.

For example, a "Checkout Error" scenario might override:

  • The payment endpoint to return a 402 status
  • The cart endpoint to still return a 200 with items
  • Add a 2-second delay to the payment endpoint

Creating a Scenario

Manual Creation

  1. Open a project's detail page
  2. Click "New Scenario"
  3. Enter a name and optional description
  4. Add mocks to the scenario from the available list

From Network Capture (Pro)

  1. Go to the Network tab
  2. Select multiple captured requests using checkboxes
  3. Click "Create Scenario"
  4. Optionally let AI generate a name and description
  5. All selected requests become mocks linked to the new scenario

Editing a Scenario

Open a scenario to configure per-mock overrides:

Per-Mock Settings

For each mock in the scenario, you can override:

  • Response Body — Custom response for this scenario
  • Status Code — Different HTTP status (e.g., 200 → 500)
  • Delay — Artificial latency in milliseconds
  • Enable/Disable — Toggle individual mocks within the scenario
  • Variant Selection — Pick which variant to use

Adding Mocks

  1. Click "Add Mock" in the scenario editor
  2. Search through available mocks in the project
  3. Click to add them to the scenario

Removing Mocks

Click the trash icon next to any mock to remove it from the scenario.

Activating Scenarios

In the project details page, you can set the active scenario. When a scenario is active:

  1. Mock Studio checks if the intercepted request matches any mock in the active scenario
  2. If it matches, the scenario overrides are applied
  3. If the mock isn't in the scenario, the base mock response is used

Use Cases

  • Happy path vs Error path — Switch between success and failure states
  • Different user roles — Admin view vs Regular user
  • Performance testing — Add delays to simulate slow servers
  • Demo environments — Pre-configured data states for demos
  • E2E test fixtures — Reproducible mock states for automated tests