Docs Test Case Steps

Test Case Steps — Low-Code Flow

Mockarty test cases are built from steps. A step is one click in your test:
“open the login page”, “POST /auth”, “verify the welcome email arrives”.
This page is the practical guide to building steps the low-code way — pointing
and clicking instead of writing code — so a non-developer can author an
end-to-end test that calls real APIs, chains values from one call to the next,
debugs itself step by step, and lights up green or red on every run.

About URLs in examples: all examples use localhost:5770 as the default
Mockarty address. If your instance runs on a remote server, replace
localhost:5770 with its actual address (e.g. https://mockarty.company.com).
See Tips & Useful Features for details.

Related pages: Test Case Management ·
Case Run View ·
Test Plans ·
Test Plan Run View ·
Override Surfaces ·
Secrets Storage ·
JsonPath Guide

To run a case inside a Test Plan and watch it expand inline alongside
other plan items (load, fuzz, chaos, contract, nested plans), see the
Test Plan Run View guide. For how
{{plan.X}} values flow between plan-level overrides and case-step
extracts, see Override Surfaces.

The case tree and an open saved case update when teammates save changes. Unsaved edits remain local; queued updates resume after saving or discarding them. Expanded folders and the tree scroll position are preserved. If reading an update fails, the current tree stays visible. A later update or finishing work in the editor attempts to read it again.

Changes typed while a save is in progress remain unsaved local edits. A save conflict keeps those edits and their draft; choose to discard them before loading the server version. Switching from editing to viewing waits for a successful save.

1. What a step is — manual or automatic

Every step in a test case is either manual or automated. The step header
carries a three-segment switch — Manual, API, UI — where API and
UI are the two automated kinds.

Kind Use when What runs at execution time
Manual A tester needs to look at the screen and decide pass/fail — UI inspection, visual diff, real-device checks, on-call escalation drills. Nothing automatic. The runner pauses, the run view asks for your verdict, and you record it.
API The check is an HTTP call (or a chain of calls) whose response decides pass/fail. The runner sends the linked API Tester request, evaluates the assertions, and records the result without a human.
UI The check drives a browser through a saved recording or inline actions. The browser runner replays the actions and records the result.

You can mix both in the same case. A common pattern is automatic for
plumbing, manual for the user-visible result
: log in via API, fetch a user
profile via API, then ask a human “open the email client and confirm the
welcome message landed”.

To switch a step, click Manual, API or UI in the step header. The
facet chips below the header change to the inputs that kind needs.

[Step row with mode switch — screenshot pending]

2. Linking an API Tester request to a step

For automatic steps, the work happens inside the API Tester — Mockarty’s
HTTP / gRPC / GraphQL client. You build and save a request there, then link
it from the step. The runner re-fetches the linked request on every run, so
edits in API Tester apply to existing cases instantly — no copy-paste, no
snapshot drift.

To link a request:

  1. Open the test case in the builder (/ui/test-cases).
  2. Pick API in the step header.
  3. Inside the step body, click Pick endpoint.
  4. A tree picker opens, showing your saved API Tester requests grouped by
    collection. Type to filter by name, method, or path. Pick the one you want.
  5. The step shows a Linked endpoint row with the request name (for
    example Login); it follows the request name in API Tester — rename it
    there and the row updates.

[Linking an API Tester request to a step — screenshot pending]

To unlink, open the Endpoint facet and click the unlink (X) button. The
row returns to (none — pick a request).

What a linked request brings with it

When the case runs the linked step, Mockarty pulls the request definition
fresh from API Tester (method, URL, headers, body, expectations) and fires it
through the same engine that powers API Tester itself. The response is
captured against the step run so the runtime flow view
can show you exactly what came back.

3. Binding an environment to a step

API Tester organises hosts, base paths, tokens and per-team values into
environments (think “staging”, “production”, “regional-eu”). A step can
pick its own environment so the same logical test can target different
deployments without rewriting requests.

A step’s environment binding has three layers:

  1. Environment — one named environment from API Tester. Provides every
    {{env.X}} placeholder its variables.
  2. Overrides — a per-step list of key/value pairs that take precedence
    over the environment for this step only. Useful for “use staging for the
    whole case, but for this one step talk to staging-eu”.
  3. Secrets — pointers into the Secrets Storage
    with a per-step alias. The secret value is fetched and substituted at
    execution time; it is never written into the case definition.

To set the environment on a step:

  1. Open the Environment facet of an API or UI step.
  2. Search for an environment by name and pick it. Use Clear to drop the
    binding; a step that uses {{env.…}} without a bound environment fails at
    run time.
  3. Click Add override to add key = value rows. Each row provides one
    {{override.<key>}} value for this step.
  4. Click Add secret to bind a secret. The secret picker lists the stores
    and entries the current user can read in this space. Choose the source
    secret and an alias — the alias is the name you use in the step
    ({{secret.<alias>}}), so you can reference {{secret.API_TOKEN}}
    regardless of whether the underlying secret is named prod_api_token or
    staging_api_token.

Realistic example: staging-eu login that uses a prod secret

A login step that uses the staging environment, targets the European region
through a step override, and pulls its API token from the production secrets
store:

Layer Value
Environment Staging (provides host=https://api.staging.example.com, tenant=acme)
Override host = https://api.staging-eu.example.com
Secret source prod_api_token, alias API_TOKEN

The linked API Tester request URL is:

{{override.host}}/v1/auth

with header Authorization: Bearer {{secret.API_TOKEN}}. At execution time the
runner resolves the URL to https://api.staging-eu.example.com/v1/auth and
substitutes the token from the production secret store. The secret value is
masked in the run view and never stored in the history.

4. Variable references inside a step

Anywhere a step accepts text — URL, header value, body, JSON path,
expectation — you can drop in a placeholder of the form {{namespace.key}}.
There are four namespaces:

Namespace Source Filled when
{{plan.X}} Values harvested by earlier steps in the same run (see §5). At the moment the earlier step’s extract rule fires.
{{override.X}} (implicit) The step’s per-step overrides list. When the step’s bindings are resolved at run start.
{{env.X}} The bound environment’s variables. When the step’s bindings are resolved at run start.
{{secret.X}} The Secrets Storage entry bound to the alias X. At the moment the request is built — never persisted.

Each token reads its own namespace

A placeholder resolves only against the namespace written in it: {{env.host}}
reads the environment, {{override.host}} reads the step overrides,
{{secret.host}} reads a secret alias, and {{plan.host}} reads a value an
earlier step extracted. There is no cross-namespace fallback — {{env.host}}
does not look at overrides.

When the same key is used in more than one of these layers, the
Environment facet shows a Conflicts row naming the layers and which of
them the run will use (override, then environment, then secret). If that is not
what you want, rename one of the keys — for example, call the override host_eu
and reference {{override.host_eu}}.

5. Extracting data from one step for the next

A login step returns a token; the next step needs that token. Extracts
are the rules that copy values out of one step’s response and put them into
the run’s plan context ({{plan.X}}) so the next step can use them.

Open the step’s Extractions facet to add a rule. There are four kinds:

Kind What it pulls Example
JSONPath A value from the JSON response body. $.access_token
Regex A capture group from a header, the raw header block, or the body. Bearer\s+(?P<t>[A-Za-z0-9._-]+) against header.authorization
Header A single response header. X-Request-Id
Status The HTTP status code as an integer. (no input — just pick this kind)

Each rule has a To field — the name under plan. that downstream steps
will use to read the value back. So a JSONPath rule with From $.access_token
and To plan.token means “after this step passes, {{plan.token}}
contains the response body’s access token”.

For regex rules, the Source dropdown picks what to run the pattern
against:

  • body (default) — the raw response body.
  • header. — one header’s value (e.g. header.authorization).
  • header_raw — every response header concatenated as Name: value lines.

The named capture group t (or, if you don’t name it, capture group 1)
becomes the harvested value.

Realistic chain: login → fetch profile

Step Method Extract Next step uses
1. Login POST /auth JSONPath $.access_token → plan.token —
2. Fetch profile GET /me with Authorization: Bearer {{plan.token}} JSONPath $.id → plan.userId —
3. Audit log query GET /audit?user={{plan.userId}} — —

When step 1 passes, plan.token is written. Step 2 starts with that value
already substituted into the Authorization header. Step 2 in turn writes
plan.userId, and step 3 uses it in the query string.

Test on last response

The extract editor has a Run once button (it sends the step’s request and
shows the response) and a Test on last response button. After you’ve run
the step at least once in a debug run (see §8), this button replays your
extract rule against the cached response without touching the server, so
you can iterate on the JSONPath / regex without re-firing the API. The
button shows the resolved value next to the rule, or an error message if
the path doesn’t match.

If the cached response is on the server only — for example you ran the case
on a different machine — the button falls back to a tiny server-side
preview call that does the same evaluation and returns the value.

5a. Asserting on the response — structured pass/fail checks

Extracts harvest values for the next step; assertions decide whether
this step passed at all. A step that calls POST /auth and gets back
503 Service Unavailable is technically a “completed request” — without
an assertion, the dispatcher accepts it as a PASS and dutifully writes a
poisoned token into plan.token. Adding status == 200 to the step’s
assertions list closes that hole: the step fails closed, the harvester
is skipped, and downstream steps never see the bad data.

Open the step’s Assertions section to add a check. There are six kinds:

Kind What it checks Operators
status The HTTP status code = ≠ > ≥ < ≤
header A response header by name (case-insensitive) = ≠ contains not_contain regex_match exists not_exists
jsonpath A JSONPath leaf in the response body All of the above plus > ≥ < ≤ when the leaf is numeric
body_contains The raw body as a string contains not_contain regex_match
duration_ms The step’s wall-clock in milliseconds = ≠ > ≥ < ≤
body_size The response body byte count = ≠ > ≥ < ≤

Each assertion has:

  • Kind — picks what to check against.
  • Source — required for header (header name) and jsonpath (a path
    like $.user.id). The other four kinds don’t use it.
  • Operator — comparison op. Numeric ops work on numeric leaves; the
    string ops compare as strings; regex_match compiles Expected as a
    regular expression and tests the actual value against it.
  • Expected — the value to compare to. For regex_match it’s the
    pattern; for exists/not_exists it’s ignored.
  • Note — optional human-readable note shown next to the failure in
    the runtime view, so a teammate reviewing a failed run sees why the
    assertion was important, not just that it failed.

When to use which

You want to check that… Use
The API responded with a success code status = 200 (or >= 200 + < 300)
A specific user came back in the body jsonpath $.user.email = ${env.email}
The token shape looks like a JWT jsonpath $.token regex_match ^eyJ[A-Za-z0-9._-]+$
The trace id header was set header X-Request-Id exists
The response did NOT echo a debug payload body_contains not_contain DEBUG_TRACE
The endpoint stayed under the SLA budget duration_ms < 500
The body wasn’t suspiciously empty body_size > 0

Test on last response

The assertions editor mirrors the Extracts editor: a Test on last
response
button lets you paste a sample payload (or pick up the one
cached from a previous debug run) and runs every assertion in-browser.
Each row shows pass or the rendered failure message — useful when you’re
authoring a regex or refining a JSONPath.

What happens at runtime

Assertions run after the executor returns and before the
harvester writes into the plan context. The flow per step is:

  1. Executor sends the request, captures the response.
  2. Assertions evaluate against the response. ANY failure → step fails
    closed, with a multi-line error listing every failure.
  3. Harvest runs only when the step passes — so a failed assertion
    never produces a plan.X value.

The runtime view surfaces the failures inline: each step that failed on
assertions gets a red “Assertions” chip in its card header and an
“Assertions” section in the detail panel listing every failed check with
the kind, op, expected, actual, and your optional Note.

6. Step dependencies

By default, steps run in order: step 2 only starts after step 1 has
ended. That works for most cases but means a slow step blocks faster ones
even when there’s no real data dependency between them.

The Dependencies facet — a searchable list of every other step in the
case, each toggled by a chip — lets you make this explicit. The runner treats
dependsOn as the only real ordering constraint:

  • When you add a brand-new step, its dependsOn is pre-filled with the step
    immediately above (so the sequential default is preserved).
  • Closing a cycle (A → B → A) is refused by the picker, which names the steps
    involved and blocks saving until one dependency is removed.
  • Remove the dependency to let the step run as soon as the case starts —
    in parallel with its siblings.
  • Add multiple dependencies to fan in: “this step needs both Login and
    Seed data to finish first”.
  • Branch from one step into many: “after Login is done, fetch profile,
    fetch orders, fetch settings — all three in parallel”.

The step header shows a small link badge with the dependency count; hover it
to see the upstream steps. The Dependencies facet also lists which steps
depend on this one.

When a dependency ends in failed or cancelled, every downstream
step is marked skipped with the reason dependency failed: <step name>.
The runtime view colours these chips grey so it’s obvious which branch was
abandoned.

When to fan out

  • Independent setup work — seeding fixture data, warming caches,
    pre-creating test users — runs in parallel and shortens overall case
    time.
  • Independent assertions — three different endpoints all need to
    succeed after a deployment — run in parallel for the same reason.

When to keep things linear

  • Token-chain — step N needs {{plan.X}} written by step N-1. Keep the
    default dependsOn: [previous] and the runner serialises automatically.
  • Stateful operations — “create order” must finish before “cancel
    order”. Express the order with dependsOn.

Insert a reusable block

In the case editor, choose Insert shared step, search the library, and select
one block. Search covers the entire library; Load more shows the next page.
Choose how this case should use the block:

Choice What is saved in the case
Insert reference, Follow latest version checked A reusable reference. Future runs use the block’s current instructions.
Insert reference, Follow latest version unchecked A reference to the exact saved version selected when you insert it. Later edits to the block do not change this reference.
Insert copy All captured instructions become editable case steps, with their automation settings and dependencies. They no longer follow edits to the shared block.

If the selected version follows nested blocks without fixing their versions,
Mockarty explains this in the picker. Choose Insert saved copy there to keep
the complete content already captured for the selection. No replacement happens
without your choice. A missing or inaccessible nested block leaves the picker
open with an error so you can correct it and retry.

Promote to shared step also preserves an instruction’s automation settings.
After promotion, the case contains a reusable reference and keeps its dependencies
on other steps in the case.
Copies include authored test data and comments in the step description. If text
exceeds inline case limits, choose a reference or shorten it before copying;
Mockarty leaves the picker open instead of silently truncating the copy.
Copied text keeps its original HTML, Markdown, or plain-text display, including test data and comments. After you edit a copied text field, it uses the regular Markdown editor.
Copies also capture the shared block’s current attachments. Save the case to
create its own attachment records and update embedded image links and expected
file selections. Later editing or deleting a source file does not change a
saved copy. Expected files appear under the instructions that use them; other
files appear under the block’s first copied instruction. The total counts each
copy separately when several instructions use the same expected file.
If a source file changes before you save, insert the copy again. A failed
file copy or storage limit leaves the previous case version in place.
One copy operation supports up to 100 files per block and 200 files or 200 MiB
in total; ordinary file size and storage limits still apply.
When calling the promote API directly, extraTree must be a JSON object;
a malformed value returns 400.

To read one saved version through the API, use either optional filter on the
existing history endpoint:

GET /api/v1/namespaces/{namespace}/tcm/shared-steps/{id}/versions?versionNum=3
GET /api/v1/namespaces/{namespace}/tcm/shared-steps/{id}/versions?versionId={versionUUID}

Use one filter at a time. The response keeps its items array and contains one
matching snapshot, or an empty array when that version does not belong to the
selected block. A malformed filter returns 400; an unavailable block in the
selected namespace returns 404. Omitting both filters still returns its history.

Reusable shared blocks during a run

When a case starts, Mockarty captures the shared block’s instructions, executor
types, automation settings, environment bindings, assertions, Extract rules and
continue-on-fail policy for that run. Nested blocks expand into ordered steps. Editing a
shared block afterward affects future runs; the running case and its report keep
their captured instructions. An unavailable block stops run creation rather than
silently skipping its steps.

Shared blocks execute as ordered sequences. If a block declares an explicit
dependsOn graph, launch stops before creating the run: insert an independent
copy into the case to retain its dependencies. The shared executor does not
silently replace that graph with sequential execution.

7. Watching a run live

Click Run on a case, or run a Test Plan item that
references the case, and its run view opens.

Every step is a card in a tree. Expand a card to see, inline:

  • the request that was fired (URL, headers, body — fully resolved, with
    secrets masked);
  • the response (status, headers, body, duration);
  • the env summary chip — which environment, how many overrides, how
    many secrets were active;
  • every value the extract rules harvested (e.g. plan.token = "ey…").

A small chip on each step card carries the live status — Pending,
Queued, Running, Awaiting your action, Passed, Failed,
Skipped, Blocked, Cancelled, Broken or Paused. A step gated
on a dependency shows a Waiting on section naming the steps it waits for.

The run view updates as the run progresses — there is no need to refresh. The
full reference is on the Case Run View page.

8. Sequential debug

A debug run runs the case the same way as a normal run except it pauses
after every step. You inspect what just happened, decide what to do next,
and click Continue to move on.

To start a debug run:

  1. Open the case and click Run.
  2. In the Choose execution mode window, tick Sequential debug (pause after
    every step)
    .
  3. The first step starts, finishes, and the run view shows the Sequential
    debug
    bar with three buttons:
Button What it does
Continue Releases the pause for one step, then pauses again.
Continue & end Disables the pauses and runs the rest of the case to the end.
Stop Cancels the run. Already-completed steps keep their results; the run ends as Cancelled.

Debug runs are the same kind of run as normal runs — they show up in the
case’s history, count against retention quotas, and feed the same Allure
report when bundled into a Test Plan. The only difference is the per-step
pause.

9. Common pitfalls

The runner is opinionated about half-finished configuration. When a step
can’t run, the runtime view marks it red and the error chip in the step
header is the verbatim message — copy it back here to find the fix.

An unresolved {{plan.X}} placeholder

The step’s text contains {{plan.X}} but no earlier step wrote a value under
that name, so the step fails before the request is sent.

Fix: open the upstream step (the one that should produce X), add an
extract rule with To plan.X. If you renamed it, fix the downstream
references too — the conflict badge in the step row catches most of them.

A secret alias is not bound

The step references {{secret.<alias>}} but no secret is bound to that alias
on the step.

Fix: open the step’s environment binding, click Add secret, pick
the source secret from the picker, and set the alias to <alias>. If the
secret picker is empty, you don’t have read access to any secret in this
namespace — ask a namespace admin to grant it, or use the
Secrets Storage page to create one.

A dependency cycle blocks saving

You set dependsOn on two or more steps such that following the arrows brings
you back where you started (A → B → A).

Fix: the Dependencies facet shows a red banner naming the cycle. Remove one
of the back-edges; saving is blocked until the cycle is gone.

The same key is used in several layers

The Environment facet lists the key under Conflicts when it exists in
more than one of the step’s layers. Remember that each placeholder reads only
its own namespace, so the conflict only matters when you reference more than
one of them.

Fix: rename one key (host_eu) or delete the layer you do not need.

The bound environment is gone

The environment was deleted or moved to another space after the step was
authored. The step fails when it resolves its bindings.

Fix: open the Environment facet and pick an environment again. If it
really was deleted, recreate it in API Tester or pick another one with the same
variable names.


Continue on failure

By default, when ANY step in a test case fails, the runner cascades the
failure: every remaining step is skipped and the case ends with status
Failed. That matches how a smoke test usually behaves — the first
broken thing tells you the whole flow is broken.

But not every step is load-bearing. Maybe step 3 is “post a metric to
the analytics endpoint” — useful to record, not worth aborting the
release flow for. The Continue on failure toggle in the step’s body marks
the step as non-blocking; the header then shows a Non-blocking badge
instead of Blocking:

  • A Fail on a non-blocking step records the failure (counts toward
    the failed-step counter, lights the step row red in the runtime view)
    but the runner activates the next pending step normally.
  • The case ends with the dedicated status Passed (with soft failures)
    when every other step passed. That’s amber — distinct from green
    Passed and from red Failed so dashboards and CI gates can
    decide how strict they want to be.
  • If a later blocking step fails (or the user leaves the resolve
    window’s Continue on fail unchecked), the case still ends Failed and
    remaining steps cascade-skip — hard failures dominate amber.

Per-attempt override (manual resolve modal)

The step’s authoring flag is the default, but the user can override it for a
single resolution. In the resolve window the Continue on fail checkbox next
to Fail is pre-populated from the step’s authoring flag:

  • Leave it as-is to honour the case author’s intent.
  • Check it (when authoring says blocking) to continue the case despite
    this one failure — useful when you know the failure is environmental
    and not worth re-running.
  • Uncheck it (when authoring says non-blocking) to force the cascade —
    useful when you spot a deeper problem and want to stop the line.

The override is recorded against the attempt row alongside the
attachments and note, so the audit trail shows who explicitly continued
or stopped a case beyond what the author had configured.

When to use it

  • Use it on: telemetry posts, optional cleanup steps, “nice to
    have” assertions, follow-up calls that don’t gate the core flow.
  • Don’t use it on: authentication, the primary action under test,
    setup that downstream steps depend on (the case keeps going but
    downstream steps will fail too — and at that point you’ve lost the
    signal a hard fail would have given you).

Audit trail

The audit log captures every step resolution:

  • Step resolved — logged on every resolve, regardless of outcome.
  • Fail continued — logged specifically when the user explicitly picked “continue” on a failing step. This makes it clear when the cascade was suppressed by a human choice versus the step’s authoring default.

Admins can review this trail in Admin → Audit.


Next: read Case Run View for the
full reference on the live execution view, and
Test Case Management for the broader case / folder /
version model.

Creating a manual case through MCP

Use tcm_cases_create with the case fields at the top level:

{
  "name": "Check the sign-in screen",
  "description": "Check the visible result after sign-in.",
  "steps": [
    {"action": "Open the sign-in screen", "expectedResult": "The form is visible", "executorType": "manual"}
  ]
}

Omitting executorType when creating a plain step also creates a manual step. Specify request explicitly for an API step and supply its executor configuration. Existing calls that place case fields in a body object are accepted too; explicit top-level fields take precedence, including empty values. Select the namespace through the outer tool arguments, not inside body. A non-object body is rejected. Check the returned steps and currentVersion, or read the saved case with tcm_cases_get, before starting a run.

Plain checklist steps added through add_test_case_steps, including calls with body: {"steps": [...]}, also default to manual; explicit modes or existing executor configuration retain their original behavior. Use tcm_cases_step_update with executorType: "manual" to repair an existing manual step.

The same object body envelope is accepted by tcm_folders_create, tcm_folders_update, tcm_cases_update and tcm_cases_step_update. Keep the namespace and all route identifiers (id, caseId, stepUid) in the outer tool arguments. Explicit outer fields win, including empty strings, empty lists and zero sort order; omitted metadata fields remain unchanged.

For tcm_case_runs_pause and tcm_case_runs_cancel, the optional reason is forwarded to the existing lifecycle endpoint as an escaped query value, so the operation keeps the supplied reason. The testplan_pause_run alias preserves the same reason and lifecycle behavior.