Test with mock execution

The built-in mock invoker lets you test workflow behavior with deterministic output before using a real provider.

3 sections9 steps

1. Choose mock execution

Use mock to test orchestration

New crewplane init projects use mock by default. Use it to check installation, workflow shape, imports and templates, artifact layout, or failure and resume behavior. Mock output demonstrates orchestration, not model quality.

Execution choices

These are different ways to exercise the same workflow.

Mock Deterministic output; no provider CLI
Provider Configured CLI performs the assigned work

Select the mock invoker

Set the integration and its options in .crewplane/config.yml. Validation, dry-run, and execution can all use this configuration.

.crewplane/config.yml
settings:  integrations:    invoker:      implementation: "mock"      options:        output_mode: "lorem"        seed: 42        delay_seconds: 0.25        observation_delay_seconds: 5

Mock invocation

A mock run still exercises Crewplane orchestration.

Hover or focus a node to preview its explanation; click to keep it.Tap a node to select its explanation.

  • Workflow → Mock invoker
  • Mock invoker → Artifacts
Keep the authored workflow

The same workflow structure and prompts go through Crewplane’s normal checks and orchestration with the mock invoker. This lets you exercise dependencies and result handling before choosing a provider CLI.

Supply predictable replies

The mock invoker supplies deterministic content according to its configured output mode. It starts no provider CLI, so the resulting text demonstrates the workflow’s plumbing rather than a model’s judgment.

Inspect a real run

A mock crewplane run writes normal run artifacts and results. You can inspect those files and exercise skip or resume behavior; validation and dry-run do not create equivalent run artifacts.

Distinguish checks from a mock run

crewplane run with mock is a real Crewplane run: it writes normal artifacts and exercises skip, resume, and result handling. It prints Mock invoker active: no provider CLI commands will be started.

Validation checks the workflow; dry-run prints a plan without run artifacts. Neither starts workflow tasks.

Terminal
crewplane validatecrewplane run --dry-runcrewplane run
Commands; the last command writes run artifacts.

Three operations

Only the mock run executes the workflow tasks.

Validate Checks workflow and configuration
Dry-run Prints plan without run artifacts
Mock run Executes orchestration and saves results

Keep authored reasoning metadata

Mock accepts valid reasoning tokens for any configured provider kind, including foreach child workflows, and ignores them during invocation. It skips executable discovery, availability probes, and native reasoning conflict checks.

Normal checks still cover workflow syntax, provider references, graph, templates, workspace policy, foreach bounds, and mock options. Remove CLI-only invoker options when switching integrations.

Reasoning metadata

Dry-run and invocation events show the request, not an applied mock setting.

Hover or focus a node to preview its explanation; click to keep it.Tap a node to select its explanation.

  • Workflow → Compiled record
  • Compiled record → Mock
Retain the request

A workflow can keep its provider reasoning value when the invoker is changed to mock. This allows the same authored request to remain visible while testing orchestration without the provider.

Record the authored value

Crewplane preserves the value as requested_reasoning in compiled provider records and invocation events. It also participates in workflow identity, so changing it changes the signature used for skip and resume.

Mock does not apply reasoning

Mock accepts valid reasoning tokens but ignores them during invocation. The saved field shows what the workflow requested; it does not indicate that mock performed provider reasoning.

2. Choose output and fixtures

Choose an output mode

lorem generates deterministic output and deterministic findings for non-reviewers with findings: true. echo returns the rendered prompt for non-reviewers. file reads fixtures and requires output_dir.

Mock output modes

Select the mode for the behavior you want to inspect.

lorem Generated deterministic content
echo Rendered prompt for non-reviewers
file Fixture files in output_dir

Place fixtures from specific to general

File mode searches from the most specific candidate to the least specific. Review-loop paths may include an audit round, task or role, and round; ordinary node and global defaults provide fallbacks.

The list below shows common review-loop candidates in search order.

Fixture paths
<output_dir>/<node_id>/review-audit-round-<audit_round>/<task_id>_round<round>.md<output_dir>/<node_id>/review-audit-round-<audit_round>/<role>-round-<round>.md<output_dir>/<node_id>/review-audit-round-<audit_round>/<task_id>.md<output_dir>/<node_id>/review-audit-round-<audit_round>/<role>.md<output_dir>/<node_id>/review-audit-round-<audit_round>/default-<role>.md<output_dir>/<node_id>/<task_id>_round<round>.md<output_dir>/<node_id>/<role>-round-<round>.md<output_dir>/<node_id>/<task_id>.md<output_dir>/<node_id>/<role>.md<output_dir>/<node_id>.md<output_dir>/default-<role>.md<output_dir>/default.md
Fixture lookup order.

Fixture lookup

The first matching fixture supplies the mock output.

Audit round Task, role and defaults
Node Task, role or node file
Global Role default, then default.md

Add fixture mutations

A fixture may have a sibling .mutations.json sidecar. mutations write under the invocation output directory; workspace_mutations write under its working directory after workspace validation.

fixture.mutations.json
{  "required_prompt_contains": ["Implement the change"],  "workspace_mutations": [    {"path": "src/example.py", "content": "print('mocked')\n"}  ]}

Fixture and sidecar

This sidecar modifies a file in the invocation working directory.

Hover or focus a node to preview its explanation; click to keep it.Tap a node to select its explanation.

  • Fixture → Sidecar
  • Sidecar → Working directory
Choose fixture output

File mode finds a fixture using the invocation’s node, task, role, and review coordinates. The selected file supplies predictable output, allowing a test to target a particular invocation.

Describe the simulated writes

A sibling .mutations.json file can require prompt text and declare mutations. This keeps the expected prompt and simulated file changes alongside the fixture that supplies the reply.

Apply workspace mutations

After workspace validation, workspace_mutations write relative to the invocation’s working directory. Ordinary mutations instead write under its output directory, so the two target different locations.

Fail when fixtures are missing

Set strict_file_mode: true to fail on a missing fixture instead of falling back to generated mock output.

Mock options
output_mode: "file"output_dir: "fixtures"strict_file_mode: true

Missing fixture

Strict mode makes fixture gaps visible.

Default Falls back to generated output
Strict file mode Fails when fixture is missing

3. Simulate failures

Target an invocation for failure

Use fail_when to simulate a failure. Selectors can use node_id, task_id, provider, role, audit_round_num, and round_num.

.crewplane/config.yml
settings:  integrations:    invoker:      implementation: "mock"      options:        fail_when:          - node_id: implement            provider: codex

Failure simulation

This example targets the codex invocation of implement.

Hover or focus a node to preview its explanation; click to keep it.Tap a node to select its explanation.

  • Selector → Mock failure
  • Mock failure → Next run
Match an invocation

A fail_when entry identifies the invocation to fail using fields such as node, provider, role, or review round. Choose coordinates that isolate the failure you want to exercise.

Simulate the failure

When an invocation matches the selector, mock fails it instead of returning its normal output. The surrounding workflow then follows its failure handling, producing a repeatable case for inspection.

Test recovery on another run

A later run can exercise resume when its workflow and settings match eligible saved history. Inspect which verified work Crewplane reuses and which unfinished work starts again; a matching failure selector can fail an invocation again.