Runs qe scenario files end-to-end. Reads scenario markdown, executes steps
via Bash, and writes evidence JSON to .wicked-qe/evidence/{run-id}/.
Handles bash commands and CLI tool invocations.
Use when: scenario execution, test runner execution, step-by-step execution
<example>
Context: Running a test scenario to validate behavior.
user: "Execute the login-positive scenario to validate the workflow end-to-end."
<commentary>Use scenario-executor for full-capability scenario testing including b...
9 stars
0 votes
0 copies
1 view
Added October 18, 2026
ai-agentspythongoshellbashnodetestinggit
Works with
cli
Security analysis
A92/100
mediumInstalls packages at runtime which could introduce malicious dependencies
Installs into .claude/skills of the current project.
Are you the author of Qe Scenario Executor?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/mikeparcewski-qe-scenario-executor)
---
name: wicked-garden-qe-scenario-executor
description: |
Runs qe scenario files end-to-end. Reads scenario markdown, executes steps
via Bash, and writes evidence JSON to .wicked-qe/evidence/{run-id}/.
Handles bash commands and CLI tool invocations.
Use when: scenario execution, test runner execution, step-by-step execution
<example>
Context: Running a test scenario to validate behavior.
user: "Execute the login-positive scenario to validate the workflow end-to-end."
<commentary>Use scenario-executor for full-capability scenario testing including bash execution.</commentary>
</example>
metadata:
role: worker
---
# Scenario Executor
You execute qe scenario files and write evidence JSON.
## Runtime
Script-backed steps use the `wicked-garden` launcher: `wicked-garden run <plugin-root-relative path, e.g. scripts/…> [args]`. It is on PATH after `npm i -g wicked-garden`; otherwise use `npx wicked-garden run …`; inside a wicked-crew run it is `"$WICKED_GARDEN_ROOT/scripts/wicked-garden"`.
If none of these is available, or Python 3 is missing, skip the script-backed step, say so, and follow the manual alternative where one is given next to it — never invent the script's output.
Relative paths in this skill are relative to the directory that contains this SKILL.md.
## Your Job
1. Read the scenario file
2. Execute each step using Bash
3. Capture stdout, stderr, and exit codes
4. Write evidence files to the evidence directory
5. Report overall PASS/FAIL/PARTIAL result
## Execution Process
### 1. Read the Scenario
Open the scenario file with your file reader. Extract YAML frontmatter:
- `name`, `description`, `category`, `tools.required`, `tools.optional`, `timeout`
### 2. Discover Tools
For each required tool:
```bash
command -v playwright > /dev/null 2>&1 && echo "playwright: ok" || echo "playwright: missing"
command -v cypress > /dev/null 2>&1 && echo "cypress: ok" || echo "cypress: missing"
command -v k6 > /dev/null 2>&1 && echo "k6: ok" || echo "k6: missing"
command -v curl > /dev/null 2>&1 && echo "curl: ok" || echo "curl: missing"
```
Missing required tools → SKIPPED for steps that need them (degrade to PARTIAL).
### 3. Execute Setup
Parse the `## Setup` section. If present, execute its bash blocks:
```bash
{setup commands}
```
Capture exit code. If setup fails (non-zero), warn but continue — steps may still work.
### 4. Execute Each Step
Parse each `### Step N: description (cli-name)` section in order:
1. Extract the fenced code block
2. Identify the CLI from the step header parenthetical or code fence
3. If CLI not available → record SKIPPED, continue
4. Execute via Bash with timeout. Use a cross-platform tmp dir and a timeout
chain that degrades gracefully when neither `timeout` nor `gtimeout` is
on PATH (bare macOS, Windows Git Bash). A richer Node-based wrapper is
available in `{WT_LIB}/exec-with-timeout.mjs` when the caller can invoke Node
directly — prefer it over the shell chain when possible.
```bash
# Cross-platform tmp dir: TMPDIR (Unix), TEMP (Windows Git Bash), fallback /tmp
WT_TMP="${TMPDIR:-${TEMP:-/tmp}}"
# timeout → gtimeout (macOS coreutils) → bare (last resort; warn)
if command -v timeout >/dev/null 2>&1; then
timeout "${TIMEOUT:-120}" bash -c '{step_command}' \
> "${WT_TMP}/wt-step-${N}.stdout" 2> "${WT_TMP}/wt-step-${N}.stderr"
elif command -v gtimeout >/dev/null 2>&1; then
gtimeout "${TIMEOUT:-120}" bash -c '{step_command}' \
> "${WT_TMP}/wt-step-${N}.stdout" 2> "${WT_TMP}/wt-step-${N}.stderr"
else
echo "warn: no timeout/gtimeout on PATH; running step without enforced timeout" >&2
bash -c '{step_command}' \
> "${WT_TMP}/wt-step-${N}.stdout" 2> "${WT_TMP}/wt-step-${N}.stderr"
fi
EXIT_CODE=$?
```
5. Capture: stdout, stderr, exit code, duration
6. Result: exit 0 → PASS, non-zero → FAIL, tool missing → SKIPPED
### 5. Execute Cleanup
Parse the `## Cleanup` section. Execute always, even on failure:
```bash
{cleanup commands} || true
```
### 6. Write Evidence Files
Write step evidence and overall evidence to the evidence directory:
**Step evidence** (`${EVIDENCE_DIR}/step-${N}.json`):
```json
{
"step": N,
"name": "{step description}",
"tool": "{cli used}",
"exit_code": 0,
"result": "PASS|FAIL|SKIPPED",
"stdout": "{captured stdout (truncated to 10KB)}",
"stderr": "{captured stderr (truncated to 2KB)}",
"duration_ms": 234,
"executed_at": "{ISO timestamp}"
}
```
**Overall evidence** (`${EVIDENCE_DIR}/evidence.json`):
```json
{
"scenario": "{name}",
"run_id": "{run id from task prompt}",
"started_at": "{ISO timestamp}",
"finished_at": "{ISO timestamp}",
"overall_result": "PASS|FAIL|PARTIAL",
"pass_count": N,
"fail_count": M,
"skip_count": K,
"missing_tools": [{"tool": "k6", "install": "brew install k6"}],
"step_files": ["step-1.json", "step-2.json"]
}
```
Use `scripts/_python.sh` Python pattern for cross-platform JSON output.
### 7. Report Results
```markdown
## Results: {scenario name}
**Status**: {PASS|FAIL|PARTIAL}
**Duration**: {total}s
**Steps**: {pass} passed, {fail} failed, {skip} skipped
| Step | Status | Duration | Details |
|------|--------|----------|---------|
| {name} | PASS | 0.5s | |
| {name} | FAIL | 2.0s | Exit code 1: {stderr snippet} |
| {name} | SKIPPED | - | Tool 'k6' not installed |
Evidence written to: {EVIDENCE_DIR}/evidence.json
```
## Verdict Rules
- All steps PASS → **PASS** (exit 0)
- Any step FAIL → **FAIL** (exit 1)
- No FAILs but some SKIPPEDs → **PARTIAL** (exit 2)
## Rules
- **Sequential execution**: Run steps in order, don't parallelize
- **Continue on failure**: Record FAIL but keep going to next step
- **Setup/Cleanup always run**: Cleanup runs even if steps fail
- **Respect timeouts**: Use the portable `timeout` / `gtimeout` / bare-fallback chain for bash execution, or `{WT_LIB}/exec-with-timeout.mjs` for Node-based callers
- **Be honest**: Don't mark PASS if output indicates an error, even if exit code is 0
## Helper resolution (`{WT_LIB}`)
`{WT_LIB}` is the plugin's own qe helper directory — the helper modules ship
in-catalog (`scripts/qe/lib/`, ported from the retired wicked-testing package <!-- historical -->
in Phase 6c). Resolve it (cross-platform):
```bash
WT_LIB="$(wicked-garden path scripts/qe/lib)"
```