Skip to content

Chapter 9 of 206 min readBy Deepak GuptaPublished

Claude Code for QA Engineers

QA gains more from Claude Code than almost any other role, because the tedious majority of QA work is exactly what an agent does well. Reading code to derive cases, writing boilerplate test code, updating tests after refactors, and generating test data all shrink from hours to minutes. What remains is the judgment that makes QA valuable.

The mindset shift

Your role moves from writing tests to designing and reviewing them. You define what must be true, which risks matter, and what a good test looks like. Claude produces the volume. You decide what ships.

Test case generation from code

Point Claude at a module and ask for cases by category:

Read src/auth/ and generate test cases for login, logout, password reset, session timeout, and concurrent sessions. For each area cover the happy path, invalid input, boundary values, expired or revoked tokens, and rate limiting. Output a table: ID, area, preconditions, steps, expected result, priority.

Two habits improve results sharply:

  • Review in batches. Ask for five to ten cases, correct them, then continue. Claude calibrates to your feedback within the session.
  • Show your house style. Point it at a few existing high-quality cases and say "match this level of detail and phrasing."

Test case generation from specs

When code does not exist yet, generate from requirements, user stories, or API specs. This is often more valuable, because it surfaces ambiguities before development starts. Ask explicitly: "List any requirements that are ambiguous or contradictory, and the question you would ask the product owner about each."

Connecting test management

With an MCP server for your test management tool, generated cases land directly in the right suite with tags and priorities. TestCollab documents this workflow end to end. Without one, ask Claude to output CSV in your tool's import format.

Writing automated tests

Rules that keep AI-written tests honest:

  1. Test behavior, not implementation. Assert on outputs and observable effects. Tests coupled to internal names break on every refactor.
  2. Separate writer and implementer. Tests written by a fresh session against the spec catch more than tests written by the session that wrote the code.
  3. Check that tests can fail. Ask Claude to break the code deliberately and confirm the test catches it. A test that never fails is decoration.
  4. Measure beyond line coverage. Mutation testing shows whether tests detect changes, not just whether lines execute.

On that last point, Bas Dijkstra's experiment is instructive. Claude generated an API test suite in minutes with high line and mutation coverage, but analysis found several tests that killed no unique mutants. Generated suites need pruning as much as writing.

End-to-end tests that survive change

With a Playwright MCP server, Claude can drive a real browser, inspect the page, and write E2E tests from what it observes. Insist on resilient locators: roles, labels, and test IDs instead of CSS paths. Ask for the page object pattern if your suite uses it, and point Claude at an existing page object as the template.

Write steps as user intent. "Submit the signup form with a valid email" survives redesigns. "Click div.form > button:nth-child(3)" does not.

Exploratory testing

This use surprises people. Describe what to probe and let Claude drive the browser:

Explore the onboarding flow. Try empty fields, very long names, emoji and right-to-left text, pasted whitespace, back-button navigation mid-flow, and a double-click on submit. Report anything that errors, hangs, or looks wrong, with screenshots and steps to reproduce.

You steer, Claude executes, and you get a structured report. It does not replace a tester's instinct. It gives that instinct far more reach per hour.

Risk-based test planning from diffs

Before a release, ask Claude to read the diff between the last release tag and the current branch:

List every module changed, what depends on each, and the user-facing flows affected. Rank them by risk using our high-risk areas in CLAUDE.md. Propose a focused regression plan.

Document your high-risk areas, such as payments, authentication, data export, and permissions, in CLAUDE.md so this ranking reflects your product, not a generic guess.

A multi-agent QA pipeline

OpenObserve published a detailed account of a "Council of Sub Agents" for E2E testing: eight specialized Claude Code agents, each defined as a markdown command, covering analysis, planning, test writing, auditing, and diagnosing failures. They report that feature analysis dropped from 45 to 60 minutes to 5 to 10 minutes, flaky tests fell by 85 percent, and coverage grew from about 380 to over 700 tests (source). The pipeline also caught a real production bug while writing tests.

Two lessons transfer to any team. Each agent has one job and written guardrails. And humans still review the output, especially for top-priority tests.

Flaky test triage

Give Claude the failure history and logs for a flaky test and ask it to classify the likely cause: timing, shared state, test order, environment, or a real intermittent bug. Then ask for the minimal change that removes the nondeterminism, such as waiting on a condition instead of a timeout.

What stays human

  • Test strategy and the definition of quality for your product
  • Deciding which risks are acceptable for a release
  • Intuition about how real users misuse software
  • Domain-heavy cases such as financial calculations and compliance rules
  • The release decision itself
Warning

Pitfall: Measuring success by test count. Seven hundred weak tests are worse than two hundred strong ones, because they slow CI and train the team to ignore failures.

Tip

What to do this week

  • Generate ten cases for one module in batches of three, correcting as you go.
  • Ask Claude to break the code and confirm your tests catch it.
  • Add your product's high-risk areas to CLAUDE.md and run one diff-based risk plan.

Key takeaways

  • QA moves from writing tests to designing and reviewing them.
  • Generate cases in small batches and correct as you go.
  • Check that tests can fail, and measure beyond line coverage.
  • Strategy, risk acceptance, and the release decision stay human.