Scenarios
An API scenario is a reusable test for one API behavior. It describes the request steps to run, the data to capture, the assertions to check, and whether the scenario is still a draft or ready for scheduled runs.How a scenario is structured
Each scenario is stored on the project with the steps, captures, and assertions needed to test one behavior. Here is an abbreviated shape:typeisapi,ui, ormixed. This page coversapi.statusisdraftoractive. The scheduler only runsactive.steps[]are ordered. Each step has anaction, atarget, optionalauth, optionalbody, optionalcapturesfor chaining, andexpectations(the assertions).tagsfilter scenarios at run time (smoke,checkout,auth).priorityiscritical,high,medium, orlow.
Lifecycle: draft to active
Every scenario starts asdraft. Qodex can recommend and generate tests, but humans decide when a test is ready for automation.
| Status | Who can run it | Used for |
|---|---|---|
draft | You, manually | Review, edit, promote |
active | Scheduler, webhooks, CI, you | Regression runs |
draft if the underlying endpoint changes and you need a quiet window to update.
The draft default is deliberate. Generated scenarios are recommendations, not releases. Scheduled suites only execute scenarios you have explicitly promoted.
Authoring from chat
In a chat, describe the behavior:staging environment. The verdict (pass, fail, error) attaches to the scenario row immediately so you can triage right away.
Prompts that work well:
- Name a behavior, not a step list. “Test the refund flow” beats “POST /refunds then GET /orders/123”.
- Reference your terms: module names (
auth,users,billing), HTTP codes (401,403,422), and edge cases (missing email,expired token). - Constrain auth explicitly when it matters: “as admin”, “without a token”, “as a viewer trying to write”.
Authoring manually
Skip the agent when you already know exactly what request and assertions you want.- Open Scenarios in the sidebar.
- Click New scenario.
- Pick the endpoint from the catalog, or type a URL directly.
- Fill in params, headers, body, auth on the step.
- Add captures if a later step needs a value from this one.
- Add expectations: status codes, JSONPath checks, response-body shape.
- Save.
Combining AI and manual edits
You can edit any agent-generated scenario by hand: change the body, add a header, swap auth, or tighten an assertion. The next time you ask the agent to extend the scenario, it reads the current shape and edits on top instead of regenerating from scratch. Common pattern: let the agent scaffold the structure, including steps, captures, and basic expectations. Then hand-edit the values and assertions that depend on your business rules.Auto-verification
API scenarios run against the target environment the moment you save them. The verdict attaches to the row immediately. See Auto-verification on save for what is checked and what is not.On the roadmap
Related
Chaining and postscripts
Reference earlier-step outputs in later steps.
Test rules in plain English
Assertions written in English, executed as JavaScript.
Request data generation
How Qodex fills params, headers, and bodies.
Auto-verification on save
The verdict that attaches the moment you save.