Using Claude Code, Cursor, or another coding agent? Paste this into your prompt to run cross-browser and real-device tests, debug sessions, and wire up CI on the TestMu AI cloud:
kane-cli testmd command family: how to run a test, what the flags do, how replay works, what shows up in the output directory, and what the exit codes mean.
To learn the _test.md file format, see Writing test.md files. To reuse flows across tests, see Composing tests with @import.
Commands
tags: — use kane-cli testrun run.
In a TTY, kane-cli testmd with no subcommand opens an interactive picker that walks the current directory and lets you pick a _test.md to run.
kane-cli testmd run
The main command. Point it at a _test.md file and it runs:
Flag reference
Every flag accepted bykane-cli testmd run:
Most flags have a frontmatter counterpart with the same name (with underscores). Where both are set, the CLI flag wins — except for
variables, which the file owns; see Writing test.md files.
How a run works
A run proceeds in four phases:- Parse — kane-cli reads the
_test.mdfile (and any helper it imports) and validates frontmatter, step bodies, and the@importgraph. Parse errors abort here with exit2; no browser is launched. - Decide replay vs author per step — for each step, kane-cli decides whether to replay a cached recording or author a fresh one. See Replay vs author.
- Execute — kane-cli launches Chrome and works through every step in order. Each step either replays its cached recording or asks the agent to figure it out.
- Finalize — kane-cli writes
Result.md, saves recordings, uploads the run to Test Manager, and (if enabled) generates code export.
Replay vs author
The first time you run a_test.md, every step is authored: the agent works out how to satisfy the objective and a recording is saved next to the test. On every subsequent run, kane-cli tries to replay the saved recording for each step — no agent involved, no LLM cost, much faster.
A step replays if and only if all of the following are true:
- A recording exists for it on disk.
- The step’s objective text has not changed since the recording.
- The step’s
yamlblock has not changed since the recording. - No earlier step in the same file invalidated it (see below).
Edits cascade to the rest of the file
Editing one step does not just re-record that step — it re-records that step and every step after it in the same file. The reason: each step starts where the previous step left off (same browser, same URL, same logged-in state). When you change step 3, the state step 4 expected to find may no longer be there, so it is not safe to replay step 4 from cache. In practice this means: an isolated text fix at the top of a test can re-author the whole file. If you are iterating on a test and want only the last step to re-record, edit that last step.Forcing a fresh recording
Two ways to author everything:--author— bypasses the replay decision for one run. Every step authors.- Delete the output directory —
rm -rf output-<stem>/resets the cache for the next run.
Handling replay failures
A replay can fail if the site changed under you — a button moved, the page is slower than expected, an extra modal appears. Two flags help:--retry— on replay failure, kane-cli restarts the run with a smaller replay window: it authors the failing step and replays fewer earlier steps. This often recovers transient issues without a full re-author.--retry-count <n>— maximum restart attempts. Default3. After this many retries, kane-cli falls back to a full re-author.
Replays don’t need a project or folder
A pure replay of an already-authored test — every step replays from cache — no longer requires a Test Manager project/folder to be configured. There is no interactive picker, no auto-created project, and no setup dead end: the test already knows where it belongs, and the replay runs with that identity. Authoring runs (first runs, edited steps,--author) resolve a project and folder as before.
Run mode
The--mode flag controls how the agent handles authentication walls, blocked pages, and error pages. The same setting can be put in frontmatter as mode: (root-only).
testing(default) — the agent treats those pages as part of the run and continues. Negative-test cases (e.g., “verify the error message is shown”) work because the run does not bail out on the first error page it sees.action— the agent hard-stops on auth, blocked, and error pages so a human can intervene before the run continues.
testing is the right default for automated suites; action is for one-off authoring sessions where you want manual control.
The output directory
A successful run writes everything it needs to replay next time intooutput-<stem>/ next to the test file, where <stem> is the filename without _test.md:
Result.md is the human-readable run report. .internal/ holds the recordings kane-cli replays on the next run. The whole output-<stem>/ directory is safe — and recommended — to commit to git: it makes your tests reproducibly replayable on any teammate’s machine and on CI.
For tests that @import helpers, kane-cli also writes one helper-output-... directory per call site next to the helper file. See Composing tests with @import.
The evidence pack
Besides the output directory, everytestmd run seals an evidence pack — screenshots, per-step console/network logs, and failure records for the whole run — and copies it into <cwd>/.testmuai/evidence/. In a terminal you’re offered to open it in the browser viewer at the end of the run; replayed runs also publish their pack to your project’s execution history in Test Manager. Do not commit .testmuai/evidence/ to git — packs are run artifacts, not test sources.
Result.md
Result.md is generated on every run. It is intended to be read in a browser or editor — drop it into any Markdown viewer.
The file begins with frontmatter:
When an
@import step fails, the badge points at the failing leaf inside the helper, e.g. ✗ failed (via @import ./helpers/login.md — at sub-step 2 → 3, 8s → ./helpers/helper-output-login-checkout-3). The sub-step chain walks from the import down to the actual failing step.
Exit codes
Use these to gate downstream CI steps.
Lock conflicts
Each test in Test Manager has a single-writer lock so two engineers cannot author the same test at the same time. When you run a test and someone else already holds the lock,--on-lock-conflict decides what to do:
The lock is acquired before Chrome launches, so a
fail policy aborts with zero side effects.
Code export
kane-cli testmd run can generate runnable Playwright code from a successful run. Enable it via frontmatter:
output-<stem>/playwright-<lang>-code/. Code export requires a successful Test Manager upload to run, and only meaningful when a project and folder are configured.
For the configurable options (default language, validation toggle, persistent enable from the TUI), see Configuration.
Running in CI
A CI-friendly invocation:--agent— plain NDJSON to stdout, no TUI redraws. Auto-enabled when stdin is not a TTY, but pass it explicitly for clarity.--headless— Chrome runs without a window.--on-lock-conflict wait— block instead of failing if a teammate is editing the same test.--retry— recover transient replay failures automatically.
ask_user prompt, so kane-cli disables it: a step that would otherwise wait for input fails cleanly instead of blocking forever. Write test steps that do not depend on mid-run prompts when running in CI.
Capture exit code in a shell script:
--agent mode. Each line is a JSON object you can parse in a downstream step.
kane-cli testmd list
Walks the current directory and prints every *_test.md file it finds:
kane-cli testmd status <path>
Shows the Test Manager identity of a recorded test: the project, the folder, the testcase ID, and whether the local recordings are in sync with the last upload.
kane-cli testmd delete <path>
Removes the test source and its output-<stem>/ directory:
kane-cli testmd export <path>
Regenerates the code export from existing recordings without re-running the test:
kane-cli testmd sync <path>
Pushes a test’s replay bundle to the cloud: the _test.md itself, every helper it @imports, and the replay-required outputs (Result.md, recordings). The bundle is tied to the test’s last commit.
You rarely need to run this by hand: after every successful authored commit, kane-cli pushes the same bundle automatically. The manual command exists for re-syncing a test whose automatic push failed (for example, a network drop at the end of a run).
Next steps
- Writing test.md files — file format, frontmatter, steps, variables.
- Batch runs with testrun — run many tests as one execution with one evidence pack.
- Evidence packs — what every run captures and how to view it.
- Composition with @import — reusable helpers across tests.
- Configuration — persistent settings: Chrome profile, window size, code export defaults.
- Test Manager integration — what happens during the upload.