Say you're the QA engineer on a checkout feature, and one end-to-end test keeps failing. You have three tabs open: the acceptance criteria, the PR diff and an AI chat. The feature is small, but the states keep multiplying. New customer, returning customer, expired coupon, partial refund, slow payment provider, phone-sized screen. Whether AI can write a test isn't in doubt anymore. What you want to know is whether it can help you think through the risk without acting like it knows the product better than the people building it.
Testing is partly a search problem
A good tester hunts for the paths the happy demo never shows. That's a search, and search is where AI is handy. Give it a short requirement and it'll ask the dull, useful questions: what if the field is empty, duplicated, too long, stale, unauthorized or edited twice? It can list negative flows, data combinations, accessibility checks and API contract examples faster than you can type the headings.
Plenty of bugs survive because nobody had time to write down the boring variations. A first draft of scenarios for a login flow, a billing rule or an import screen is a real help, even when half of it is noise. You still decide which items matter, which are duplicates and which could never happen. The AI doesn't need to be right here. It needs to give you more starting points than your own brain will at the end of a long day.
It also takes the edge off the blank page. Show it a component contract, an API schema or a few existing tests, and it'll propose unit tests, Playwright flows, fixtures and assertions in the same style. That works best in a codebase with clear patterns, because the model copies whatever it sees nearby, good habits and bad ones alike.
The trap: tests that lock in today's bug
Every test has two parts: the steps, and the oracle that decides whether the result is right. AI is good at steps. The oracle is where it slips. Michael Konstantinou, Renzo Degiovanni and Mike Papadakis studied LLM-generated oracles in 2024 and found that LLM-based test generation "mainly capture[s] the actual program behavior" (Can we find bugs using LLM-generated oracles?). In plain words: point a model at buggy code and ask for tests, and it'll often write tests that confirm the bug.
That's the nasty kind of green. Some other ways a polished-looking generated test can mislead you:
- It checks implementation details (which private method got called) instead of what the user sees.
- It mocks the exact thing that should have been integrated, so the test only proves the mock works.
- It builds data that can't exist in production, like an order with no customer.
- It asserts so little that it would pass no matter what the code did.
For the wider habit of treating any AI answer as a claim to check, see How Much Testing Does an AI Answer Need?. This post stays on the test code itself.
What Meta's numbers say
Meta has published two useful data points. In 2024, its TestGen-LLM tool tried to improve existing Kotlin test classes for Instagram Reels and Stories. Of the generated test cases, 75% built correctly, 57% passed reliably and 25% increased coverage. In test-a-thons on Instagram and Facebook, engineers accepted 73% of its recommendations for production (Alshahwan et al., FSE 2024).
Look at how that funnel works. Engineers only got tests that survived a filter: a test reached a person after it built, passed several times in a row and added coverage. The high acceptance rate comes after the filters, which is the lesson.
In 2025 Meta described a second system, ACH, that starts from the other end. It first creates a small number of realistic faults (mutants) that the current tests miss, then asks an LLM to write tests that catch them. Engineers accepted 73% of its tests in Messenger and WhatsApp test-a-thons and judged 36% of them relevant to privacy (Mutation-Guided LLM-based Test Generation at Meta). A test written to kill a known fault has a built-in answer to "would this ever fail?"
Both systems put a mechanical check between the model and the engineer: does it build, is it stable, does it add coverage, does it catch a known fault. You can copy that on a small team with your CI and a few minutes of deliberately breaking the code.
A workflow: risk list first, test code second
Before you ask for any test code, ask for a risk inventory. Give the AI the story, the acceptance criteria and the diff, then ask it to list:
- user flows and the states between them,
- boundary values and permission cases,
- data integrity risks (double charges, orphaned records),
- what you'd want to see in logs or metrics if it broke.
Then go through the list with the team and mark each item: already covered, test by hand, automate, or not relevant. Only the "automate" items go back to the AI as a request for code. The conversation stays on quality, and syntax comes later.
Tooling has started to follow the same order. As of November 2026, Playwright's docs describe three test agents: a planner that explores the app and writes a Markdown test plan, a generator that turns the plan into test files, and a healer that reruns failing tests and patches them. The healer can also mark a test as skipped when it believes the feature itself is broken (Playwright Test Agents). Read that plan before the generator runs, and treat every skip as a question for a person.
Context decides most of the quality. "Write tests for checkout" gets you generic output. The business rule, user roles, past incidents, a real API response and your test conventions get you something you might keep. It feels a lot like briefing a careful new teammate.
Use AI to review tests too
Generation is half the job. Paste a test, generated or hand-written, and ask: which behavior does this protect? What does it miss? Would it fail for the right reason? This catches brittle assertions and over-mocking, and it's a solid way for junior engineers to learn why one test gives confidence while another only pads the line count.
Then do the cheap version of what ACH does. Break the code on purpose: flip a condition, drop a line, return the wrong status. If the new test still passes, it isn't protecting anything yet.
Keep production data out of the prompt
Customer names, access tokens, private logs and regulated data need the same care they needed before AI. Don't paste them into a chat to "get realistic fixtures." Use synthetic data, anonymized samples or a model your company has approved for that data. A testing assistant shouldn't become a new leak in your quality process.
Try this week
- On your next story, ask AI for a risk inventory before any test code, and sort it with the team.
- Pick one AI-generated test that's already merged. Break the code it covers on purpose and see whether it fails.
- For every generated test in a PR, write one line in the description: which user risk it protects.
- Write down your test conventions and a real API response once, and reuse them as context in every prompt.
Next time AI offers you twenty tests, take a minute before accepting them all. Ask which one would have caught your last production bug. If none would, you've got a long green list, and that's a good moment to go back to the risk inventory.