Featured project | AI & LLM

AI-Assisted Test Automation (Claude)

All Java: a demo app in the repository, the Anthropic Java SDK with typed structured outputs, repair rounds fed by the gate, an approve step that marks AI-written tests, and AI failure triage into product bug, test bug, environment or flaky. Answers are recorded, so CI replays them without an API key; until the first live run, CI runs the pipeline on hand-written sample answers that every report labels as samples.

CI passed on labelled, hand-written sample answers; no live model result is claimed.

On this page
  1. Problem and purpose
  2. Architecture
  3. Technology and tools
  4. Engineering decisions and approach
  5. Problem, decision and result
  6. Test scope and execution approach
  7. Results with dated evidence
  8. Evidence explorer
  9. Representative failure evidence
  10. Local setup and execution
  11. Workflow and reports
  12. Known limitations

Problem and purpose

Shows how to use a large language model in test automation without letting it lower the bar. Generating a plausible test is fast; the expensive failure is a test that passes and checks the wrong thing. So the project is mostly guardrails: automatic gates before review, a review file built for a five-minute check, an explicit approval recorded in the code, and evidence-based failure triage.

Architecture

test-cases/TC-*.md ──► Claude draft ──► gate: rules ─► javac ─► 3 runs ──► review.md ──► approve ──► src/test (@AiDrafted)
                         ▲                                    │
                         └──── findings, up to 2 repair rounds ◄┘

failed UI run ──► evidence per failure ──► Claude triage ──► triage.md (verdict, quoted evidence, draft ticket)

Technology and tools

AreaTools
LanguageJava 21, Maven wrapper
AIAnthropic Java SDK 2.73, Claude Opus 5.5: structured outputs into Java records, prompt caching, effort per task, refusal fallback
TestsPlaywright for Java 1.63 + TestNG 7.12, page objects, failure evidence (DOM, screenshot, console, trace)
System under testLeaveDesk: a leave-request app in the repository (JDK HttpServer + plain JavaScript UI) with a switchable planted bug
CIGitHub Actions: unit and tooling tests, UI tests on Chromium, Firefox and WebKit, AI replay and triage jobs without an API key

Engineering decisions and approach

  • One class talks to Claude: typed answers, recording and replay, cost logging and refusal handling in one place
  • Answers are recorded and keyed on model, prompt, test case and framework code, so CI replays them deterministically and a changed prompt shows up as a missing recording
  • The gate runs cheapest first and stops at the first failure: text rules, in-process compilation, three TestNG runs against a fresh app
  • Gate rules explain themselves ("found Thread.sleep on line 18"), because the same message goes back to Claude in a repair round
  • The model may only use page objects; if a step needs a missing method it reports it instead of using a selector
  • No auto-merge and no self-healing: approval names the reviewer, and failures go to triage with the evidence

Problem, decision and result

Problem

Generated tests need validation and accountable review before they can become trusted checks.

Decision

Gate drafts through rules, compilation and repeated execution, then require a named human reviewer. Label hand-written samples separately from live model outputs.

Observed result

CI passed on labelled, hand-written sample answers; no live model result is claimed.

Evidence checked 2026-11-16 | CI run #39 (hand-written sample answers)

Scope: Sample and replay evidence does not establish live Claude generation quality or triage accuracy.

Test scope and execution approach

Project-specific checks and execution details documented in the repository:

  • Generator: test case and framework code in, a draft with coverage per expected result, assumptions and missing page methods out
  • Quality gate: framework and safety rules, javac against the test classpath, three runs each with its own evidence folder
  • Approve step: only gate-passed drafts, rules re-checked after reviewer edits, @AiDrafted(model, reviewedBy, reviewedOn) added
  • Failure triage: error, console, DOM, screenshot, test case and test code in; verdict, confidence, quoted evidence and a draft bug ticket out
  • 52 tests that need no API key: app rules and API, every gate rule rejecting a crafted bad draft, real gate runs, replay, sample mode, approve marking and its refusal of sample drafts
  • Sample mode: hand-written answers in Claude's answer shape run the real gate, repair loop and triage report without a key; every report says the answer is not from Claude, and samples can never be approved
  • Design notes and 82 interview questions on AI-assisted testing, linked to the code (Markdown + PDF)

Results with dated evidence

Recorded CI replay

CI run #39 (hand-written sample answers)

CI passed on labelled, hand-written sample answers; no live model result is claimed.

Evidence checked: | Open dated evidence

Evidence explorer

Static screenshots are labelled as images; dated workflow links identify the execution evidence and its check date.

Test report screenshot. The pipeline: drafts go through the gate to a person; failed runs go to AI triage. Results of the first live generation run will be added here. Static image; capture date is not recorded in the portfolio data.
Pipeline diagram of the AI-assisted test automation project

Test report screenshot. The pipeline: drafts go through the gate to a person; failed runs go to AI triage. Results of the first live generation run will be added here. Static image; capture date is not recorded in the portfolio data.

Static material from the public repository. The linked verification record was checked 2026-11-16; that date is not a screenshot capture date.

Dated workflow record

Evidence checked 2026-11-16. Open CI run #39 (hand-written sample answers)

Representative failure evidence

CI replay cases include planted rule violations, data leaks and incorrect facts to exercise failure detection.

Local setup and execution

mvnw.cmd test                       :: app + tooling tests, no key needed
mvnw.cmd test -Dsuite=ui            :: UI tests
ai generate TC-103                  :: Claude drafts, the gate checks (needs ANTHROPIC_API_KEY)
ai approve TC-103 Your Name         :: move a passed draft into src/test

Workflow and reports

View workflow definition.

Known limitations

  • The rule stage is text matching, a filter and not a sandbox; the human review is the control
  • One small demo app; triage looks at one failure at a time
  • CI replays hand-written sample answers; no live model output or model-quality score is claimed.

Back to Projects