Skip to main content

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 generate is built around a simple loop: generate → refine → save → run. Each command is one turn that exits when done; you move between turns with the request id. This page walks the loop end to end. For the feature overview and option reference, see Generating test cases with AI.

1. Generate

Start with a plain-language description of what you want covered:
kane-cli generates scenarios and cases and prints the result, ending with a request id and the exact commands to refine or save it:
Keep the request id, every later command uses it. Bound the size with limits when you want a tighter or broader set:
Add --memory to reuse relevant existing cases and avoid duplicating coverage you already have.

2. Refine

Refinement is a plain-language conversation. Each refine is a fresh command with --refine --req <id>:
Each refine returns the updated result. Repeat until the set looks right.

When generation asks a question

Sometimes a turn ends by asking you something instead of finishing, for example, “Which environment should these target, staging or production?” This is a normal outcome, not a failure (the command exits 0). Answer it by refining with your answer:
(Driving this from a script or agent? Add --agent (or rely on it being auto-on when stdin is not a TTY) and read the answer-needed signal from the NDJSON, then re-invoke the same way.)

3. Save

When you are happy with the set, save it. --save writes the functional cases as _test.md files:
By default this writes under <cwd>/.testmuai/tests:
Choose a different location with --out, and name the suite with --name:
Only functional cases are written: non-functional cases (Security, Performance, …) are part of the generated result but are not saved as runnable tests. See Saving is functional-only.

4. Run

The saved files are ordinary _test.md tests. Run any of them with testmd:
From here, everything in the testmd docs applies: replay from cache, edit steps, compose with @import, and commit the output to git.

Automating it (agents / CI)

Pass --agent (auto-on when stdin is not a TTY) to get structured NDJSON on stdout instead of the human display, so a script or coding agent can drive the loop:
Each command prints one JSON object per line; the final line is the terminal event carrying the request id, the status, and the refine/save commands to run next.

Exit codes

Invalid flag combinations exit 2 with a message explaining the fix, for example using --refine without --req, passing a description with --save, using --out without --save, or --req without --refine or --save.

Next steps