Run End-to-End Tests from Your Terminal with Kane CLI
Author and Run Tests Right from the Terminal in Natural Language, with an Evidence-Backed Pass or Fail from a Real Browser.
npm install -g @testmuai/kane-cli
- TestMu AI (Formerly LambdaTest)
- /
- Blog
- /
- How to Use Claude Code for Testing With Kane CLI
Claude Code writes features quickly, but it cannot tell on its own whether the login, cart, or form it just built works for a user. That check usually falls to you: open the app, click through the flow, and report back.
This guide shows how to use Claude Code for testing by giving it Kane CLI, the TestMu AI command-line agent that drives a real Chrome browser and returns a machine-readable pass or fail. Claude Code calls it after a change, reads the verdict, and fixes the code when a check fails.
TL;DR
To use Claude Code for testing, install Kane CLI with npm, add its skill with one npx command, and ask Claude Code to verify a flow in plain English. Claude Code runs kane-cli run with the --agent flag, reads the final run_end line, and on a failure fixes the code and reruns the check.
- Agent mode: The --agent flag switches Kane CLI output to NDJSON, one JSON event per line, and the closing run_end event carries the status, summary, extracted values, and duration Claude Code needs to decide its next step.
- Exit codes: Kane CLI exits 0 on a pass, 1 when the objective ran but did not pass, 2 on an auth, setup, or infrastructure error, and 3 on a timeout, so a script or CI job can gate on the result.
- claude --chrome: Claude Code's built-in Chrome integration drives your own signed-in browser in a visible window, which suits interactive debugging more than repeatable pass or fail checks inside a pipeline.
- Skill install: Running npx @testmuai/kane-cli-skill installs the Kane CLI skill for Claude Code, Codex CLI, and Gemini CLI, so the agent knows when to call Kane CLI and how to read its output.
Kane CLI needs Node.js 18 or later and Google Chrome, and it signs in to your TestMu AI account so each run keeps a step-by-step record you can review later.
Claude Code Testing Without a Browser Verifier
Claude Code reads your repo, follows its patterns, and runs unit tests, linters, and type checks in the terminal. Those checks prove the code compiles and the functions return what they should. They do not prove the rendered page works: that the session cookie is set after login, that the Add to Cart button is clickable, or that the success message appears. The case for a verifier separate from the agent that wrote the code is made in AI code verification.
Closing that gap takes two things the agent lacks by default: a real browser it can drive, and a verdict it can parse without guessing. Kane CLI supplies both, which is the idea behind Claude Code app testing on TestMu AI. For a wider look at browser options for the agent, see this guide to Claude Code browser automation.
Note: Give Claude Code a real browser and a pass or fail it can read. Start free with TestMu AI
claude --chrome vs Kane CLI Agent Mode
Claude Code already has a browser option. The Claude Code Chrome docs describe claude --chrome, which connects to the Claude in Chrome extension (version 1.0.36 or later), opens tabs in your own browser with its login state, and pauses at login pages and CAPTCHAs for you to handle. It needs a direct Anthropic plan: Pro, Max, Team, or Enterprise.
Kane CLI solves a different problem: a check that returns the same kind of verdict every time, so a script, a hook, or a CI job can act on it. If your agent drives the browser through Playwright MCP instead, our Kane CLI vs Playwright MCP comparison shows what each one hands back to the agent.
| Aspect | claude --chrome | Kane CLI agent mode |
|---|---|---|
| Browser | Your Chrome or Edge through the extension, in a visible window | Chrome launched by Kane CLI, headed or with --headless |
| Result | Claude describes what it saw in the chat | NDJSON events ending in run_end with status, summary, and extracted values |
| Signal for scripts | None beyond the conversation | Exit codes 0 (pass), 1 (fail), 2 (error), 3 (timeout) |
| Logins | Reuses your signed-in session; pauses for you at login or CAPTCHA | Credentials passed as variables, with secrets marked secret |
| Best fit | Exploring and debugging a page while you watch | Repeatable checks that gate a commit or a pipeline |
The two work side by side. Use --chrome to inspect console errors on a page you are debugging, and Kane CLI when Claude Code has to prove a flow passes before it moves on. Other coding agents handle this differently, as the comparison of AI code assistants for testing shows.
How to Set Up Kane CLI in Claude Code
Kane CLI drives a real Chrome instance through the Chrome DevTools Protocol and limits itself to actions a real user could take, so a pass means the flow worked on the rendered page. Setup takes four steps.
- Install Kane CLI - run the npm install below. It needs Node.js 18 or later and Google Chrome.
- Sign in - run
kane-cli login, thenkane-cli whoamito confirm the account. - Add the skill - run
npx @testmuai/kane-cli-skill. Per the Kane CLI README on GitHub, this installs the skill for Claude Code, Codex CLI, and Gemini CLI in one command. - Ask in plain English - for example, "verify the signup form on localhost:3000 rejects an invalid email". The skill tells Claude Code to call Kane CLI with
--agentand read the result.
npm install -g @testmuai/kane-cli
kane-cli login
kane-cli whoami
npx @testmuai/kane-cli-skillWith the skill in place, Claude Code recognizes browser requests, builds the kane-cli run --agent command, and summarizes the outcome as step counts, duration, extracted values, and assertion results.
A Real Kane CLI Run, Step by Step
To show what Claude Code receives, I ran the same command its skill builds against the Simple Form Demo on the TestMu AI Selenium Playground, using kane-cli 0.8.10 in headless agent mode:
kane-cli run "Go to https://www.testmuai.com/selenium-playground/simple-form-demo/, type 'Kane CLI verified this' into the Enter Message field, click the Get Checked Value button, then verify the Your Message output shows 'Kane CLI verified this'" --agent --headless --timeout 300Kane CLI planned five actions (navigate, type, click, read the output, assert) and streamed one progress line per action. The last line was the run_end event below, trimmed to the fields Claude Code acts on:
{"type":"run_end","status":"passed",
"one_liner":"displayed the entered message on the Simple Form Demo page",
"final_state":{"url":"https://www.testmuai.com/selenium-playground/simple-form-demo/",
"your_message_output":"Kane CLI verified this"},
"reason":"Objective completed","duration":42.2,
"result_code":100,"reason_code":"success.complete","run_id":"run-0"}The run passed in 42.2 seconds and used about 15 credits. The assertion read the output element's text, stripped whitespace, and compared it with an equals check, so the pass rests on what the page rendered rather than on what the code claims. Claude Code only needs status to decide and final_state to report the value it checked.

How Claude Code Acts on Pass or Fail
The exit code tells Claude Code which kind of next step to take, and the event stream gives it the detail. The schema behind each event is covered in this guide to Kane CLI NDJSON agent mode.
- Exit 0, passed - Claude Code reports the verified values and moves to the next task.
- Exit 1, failed - the objective ran but an assertion did not hold. Claude Code reads the failing step's remark and the run's evidence pack, which holds per-step screenshots and the browser's console and network logs, then fixes the code and reruns.
- Exit 2, error - auth, Chrome, or network trouble. The code is not at fault, so Claude Code should fix the environment, not the feature.
- Exit 3, timeout - the run was cut off. Splitting a long objective into smaller runs usually fixes it.
The skill can also run several browser checks in parallel through sub-agents, and larger efforts can be split across sessions with Claude Code Agent Teams. Because the same command exits non-zero on any failure, it can gate a pipeline too, as in this setup for Kane CLI in GitHub Actions.

Writing Objectives Claude Code Can Verify
The objective string decides whether a run gives a useful verdict. The Kane CLI README and the agent skill it ships recommend these patterns, and they hold up when Claude Code writes the objective for you:
- End with an assertion - close on "verify the cart shows 1 item", not on "click Submit". A run with no assert or verify step has nothing to pass or fail.
- Use "store as" for values - "store the order total as 'total'" puts the value in final_state. Phrases like "read the total" or "tell me the total" are not captured reliably.
- Pass credentials as variables - reference
{{username}}in the objective and supply it with--variables, marking passwords as secret, instead of pasting them into the prompt. - Keep one task per run - split flows longer than about 15 steps into separate runs, which Claude Code can then run in parallel.
Next Step: Add One Check to Your Next Task
Pick the flow you click through by hand most often, such as login or checkout, and ask Claude Code to verify it with Kane CLI after its next change. The Kane CLI documentation covers flags, variables, and saved tests, and Claude app testing on TestMu AI extends the same checks to apps built with Claude. If Claude Code built an app that nobody has documented, Kane CLI Exploration maps its screens, flows and findings from one URL.
Testing from the terminal? Kane CLI by TestMu AI lets SDETs and developers plan, write, run and debug tests from the command line.
Author
Anubhav Singhmaar is an AI Product Manager at TestMu AI driving Kane CLI, the command-line tool that brings browser automation to the terminal, turning natural-language flows into runs in a real Chrome browser that return pass or fail with shareable proof. He owns the roadmap and prioritization and works with engineering to ship developer-facing features. Before TestMu AI, he spent over four years at Sprinklr owning enterprise voice AI across APAC and EMEA. A mechanical engineer turned product manager, he grounds guidance in real QA workflows.
Claude Code Testing FAQs
Did you find this page helpful?
More Related Blogs
TestMu AI forEnterprise
Get access to solutions built on Enterprise
grade security, privacy, & compliance
- Advanced access controls
- Advanced data retention rules
- Advanced Local Testing
- Premium Support options
- Early access to beta features
- Private Slack Channel
- Unlimited Manual Accessibility DevTools Tests





