# Do AI-generated tests catch bugs? We planted some to see

Source: https://testwatch.dev/blog/ai-written-e2e-tests-injected-bugs
Updated: 2026-11-13

Most of the bugs we planted show no error on the page, and many say it worked and store nothing. What a generated test has to check to fail on them, which changes it has to survive, and the one trial that passed on a broken app.

By [Vasyl Harastei](https://testwatch.dev/about). 13 November 2026. 7-minute read.

Ask whether AI-generated tests catch bugs and you get opinions. The only way to answer it for a given test is to break the app it tests and watch the run. So that is what our eval does: it plants 21 different bugs in two fixture apps, and every test TestWatch writes runs against each bug planted in its flow.

This post is about those bugs. What a user would see on the page for each one, which of them a test catches only by checking the outcome, and what the run on 18 October 2026 found: 84 runs of a generated test against a copy of its app with one bug switched on, and every one of them failed, as it should. The one trial that got through wasn’t one of those runs, and it is the most useful result here. Every case and every trial is on [How we measure TestWatch](https://testwatch.dev/eval).

## How a bug gets planted

Each eval case is one request in plain English, the way someone on your team would write it, for a small app we built: a shop and a support desk. For each case we listed the bugs the flow must catch, between one and three per case, and the fixture app can switch any of them on. TestWatch gets the request and the app’s address. It is told nothing about the bugs.

When a test comes out, the judge runs it, with no AI involved:

- **The working app**: The test must pass, and the app’s own backend must record the outcome, such as an order created with two items. A test that passes while no order exists fails here, whatever the screen showed.
- **One bug at a time**: The same test runs against a copy of the app with one planted bug switched on. It must fail on every one. A test that passes with a bug on is a false green: the test passed when it should have failed. This is why you review each test and every fix.
- **Harmless changes**: It runs against changes that break nothing, and must still pass. A test that fails here is brittle: the test caught the bugs but broke on a harmless change, or passed only sometimes.
- **Clean runs**: Three runs on the working app in all, to catch a test that passes only sometimes.

A correct test is one that passed every check. In the run on 18 October 2026, 22 cases had bugs planted. They shipped 64 tests over 66 trials, and 64 of those tests were correct.

## The bugs, by what the page shows

A bug is easy to catch when the page shows an error. Most real ones don’t. So we grouped the 21 bugs by what a user would see after the action. On 18 of them, nothing on the page says anything went wrong.

| The bug | Flows | Tests | Failed on it |
| --- | --- | --- | --- |
| **A confirmation that isn’t true The page says it worked (a message, a toast). The backend stored nothing, or not all of it.** |  |  |  |
| adding to the cart says it worked, but the cart stays empty | 4 | 11 | Caught all 11 |
| the photo upload says it worked, but the photo never changes | 2 | 6 | Caught all 6 |
| the reset says the password was updated, but it never changes | 1 | 3 | Caught all 3 |
| the email confirmation link says it worked, but the account stays unconfirmed | 1 | 3 | Caught all 3 |
| saving settings shows a confirmation, but the change is not stored | 1 | 3 | Caught all 3 |
| saving a ticket shows "Saved", but nothing is stored | 1 | 3 | Caught all 3 |
| the CSV import reports success but drops the last row | 1 | 3 | Caught all 3 |
| closing a ticket reloads the list, but the ticket stays open | 1 | 3 | Caught all 3 |
| the new-ticket dialog closes, but no ticket is created | 2 | 6 | Caught all 6 |
| **Nothing happens, and no error The click goes through. The page stays as it was, or moves on without doing the work.** |  |  |  |
| removing an item from the cart leaves it there | 1 | 3 | Caught all 3 |
| logging out leaves the session signed in | 1 | 3 | Caught all 3 |
| the status filter is ignored and every ticket is listed | 1 | 3 | Caught all 3 |
| **The right page, with a wrong value The flow completes. One number, row or role in the result is wrong.** |  |  |  |
| the order total is 1.00 more than the sum of the items | 2 | 6 | Caught all 6 |
| the orders CSV export leaves out the newest order | 1 | 3 | Caught all 3 |
| the open-ticket count also counts closed tickets | 1 | 3 | Caught all 3 |
| an invited teammate is always stored with the Viewer role | 1 | 3 | Caught all 3 |
| **Accepted when it should be refused Input the app must reject goes through without a word.** |  |  |  |
| an empty shipping form is accepted | 1 | 2 | Caught all 2 |
| any password works for a known email | 1 | 3 | Caught all 3 |
| **A visible error The page shows an error or refuses the action. The one kind a user notices at once.** |  |  |  |
| placing the order shows an error page and no order is created | 3 | 8 | Caught all 8 |
| valid sign-ins are rejected | 1 | 3 | Caught all 3 |
| the emailed sign-in code is refused | 1 | 3 | Caught all 3 |

Flows: the cases the bug is planted in. Tests: the tests those cases shipped. Failed on it: the correct tests among them; each ran against a copy of the app with that one bug and failed, and passed every other check. A false-green test passed on a broken copy; a brittle test is left out, since its bug runs are skipped when it fails on the working app. 22 cases, measured 18 October 2026 with prompt gen-v26. Every case and every trial is on [How we measure TestWatch](https://testwatch.dev/eval).

The first group is the one to worry about. Nine bugs show a confirmation and store nothing, or not all of it: the cart says it worked, the settings page shows a confirmation, the import reports success. A test that checks for that confirmation passes on every one of them, and the test did what it was asked. It just wasn’t asked for enough.

A test that checks only that the next page loaded passes on all 18 bugs without a visible error. The 3 that do show one are the bugs most tests catch by accident, because the confirmation the test looks for never appears.

## The line that catches it

The eval’s “Checkout with two items” case plants three bugs: adding to the cart says it worked, but the cart stays empty (a confirmation that isn’t true), placing the order shows an error page and no order is created (a visible error), and the order total is 1.00 more than the sum of the items (the right page, with a wrong value). Here is the last step of a real test TestWatch wrote for a different checkout request, “Checkout with 2FA sign-in”, on the open-source demo shop rather than the fixture app:

```
await test.step('Verify order confirmation and total', async () => {
  await expect(page.getByText('Thanks! Your order has been placed.')).toBeVisible();
  await expect(page.getByTestId('order-total')).toHaveText('$21.00');
});
```

Line 38 is a presence check. It catches the error page: the thanks message never appears. Line 39 checks a value. It catches the wrong total, and an error page too, as long as no total is shown on it. When the demo shop’s total was wrong, that line failed the run:

```
Expected: "$21.00"
Received: "$16.00"
```

Without line 39, the same test passes on the broken shop. Without line 38, it still catches both, for the same reason. The presence check is the one a reader finds reassuring and the value check is the one that does the work. The check is exact because the request was: “Check the order confirmation says the order was placed and the total is $21.00 (the $16.00 notebook plus $5.00 shipping).”

That is why TestWatch’s instructions to the agent say that each outcome the request asks for becomes one assertion, inside the step it verifies, and that “a goto, waitForURL or waitFor is not a check”. Reaching the confirmation page is a wait, not a result. The eval adds a check no test can fake: the fixture app records what happened in its backend, and a test that passes without the order being created counts as a false green even when the screen looked right.

One rule pulls the other way. The same instructions say a value that changes on every run, an order number, a date or a price, is checked by its shape, or the test fails tomorrow. When the request fixes the value, as “verify the total equals the sum of the two added product prices” does, a shape check isn’t enough, and the instructions don’t say so. A separate goal check reads the finished test against the request and lists each outcome no assertion verifies; it is an AI judgement, and it can let one through. The one miss in this run sits on that line.

## The harmless changes

Catching bugs is half of it. Each of the same 64 correct tests also ran against the harmless changes planted in its own case. Across the cases there are five: a promo banner added above the page, every class name and id changed, navigation links and products shown in a different order, a maintenance notice added above the page, and navigation links and ticket rows shown in a different order. That is 120 runs, and every one passed.

“Every class name and id changed” is the one that matters. A test built on CSS selectors breaks on it; one built on roles, labels and test ids doesn’t. The fixture apps also vary their labels, prices and class names with a seed, so a test can’t lean on a selector it has seen before.

## The one that got through

Two cases are different: the app is already broken while the test is being written (placing the order shows an error page and the order total is 1.00 too high). No correct test exists there. The right outcome is to stop and flag the bug, and 3 of 6 trials did.

One shipped a test that passed on the broken app, the run’s only false green. In “Check the order total while it is wrong”, trial 2: shipped a test that passed on the broken app (let the wrong total through). The test checked that the total looked like a price and never that it equalled the sum: the shape rule, applied where the request fixed the value. The line-by-line is in [why AI-written tests pass when they shouldn’t](https://testwatch.dev/blog/ai-written-tests-always-pass). Two more trials ran out of steps before deciding, which counts as a failed generation.

The run’s other failures were “Empty shipping form is rejected” (trial 1: the AI provider was at capacity, so the generation stopped with no test) and “Buy something (one-line request)” (trial 1: hit the step limit before finishing). A failed generation costs a retry. A false green ships. That is why we count them separately and read the second number first.

## Reading the numbers

94% of the 87 trials ended well, which with this many trials means a 95% interval of 87–98%. The two apps don’t weigh the same: we tuned the prompt mostly on Shop, which had 63 of the 72 trials in earlier runs, and it scored 58 of 63. Desk, used far less while tuning, scored 24 of 24.

We also wrote the bugs. The agent never sees them, but we chose bugs we expected a good test to catch, and the apps that shaped the prompt are the apps the bugs live in. Our earliest runs, recounted with today’s rules (September 2026), had 4% false greens and 7% brittle tests over 58 trials. This run has 1% and 0%. Prompts and checks changed in between, so that is a direction, not a cause.

How the generator writes, runs and checks a test before it ships is on the [AI Playwright test generator](https://testwatch.dev/playwright-test-generator) page, and the loop around it on [how it works](https://testwatch.dev/how-it-works).

## What this doesn’t prove

The apps are small, and ours. Every planted bug breaks the outcome the request names, so a test that catches it is doing what it was asked; a bug on a page nobody described stays invisible to every test, generated or not. The list has no visual bugs, no slow pages, and nothing a user would only notice a week later. One to three bugs per flow is a sample, not a sweep. The broken-while-writing cases were measured on 6 trials, too few for a rate. And a test that fails on our planted bug would not have to fail on yours: the shop’s wrong total is one switch in a fixture app, and your app’s is wherever it is. The method transfers; the numbers don’t.

## Questions

**Do AI-generated tests catch bugs?**

Only the ones on the path they describe, and only if they check the outcome of that path rather than that a page loaded. The way to know for a given test is to break the outcome on purpose and run it. In our eval, every correct test is one that failed on each bug planted in its flow; the per-case results are on [How we measure TestWatch](https://testwatch.dev/eval).

**What is a planted bug?**

A deliberate fault switched on in a copy of the app, such as a cart that says it worked but stays empty. A test is run against each copy and must fail on it. Testing tools call this mutation testing. The harmless changes are the other half: a banner or a renamed class name that the same test must survive.

**How do I check that my own tests would catch a bug?**

Pick the outcome the test is for, break it on a copy of the app (an order that is never created, a total that is off), and run the test. If it stays green, find the line that should have failed. If there is no such line, the test checks that the flow ran, not that it worked. The same method works on any tool’s output; the scoring is in [How to evaluate AI testing tools](https://testwatch.dev/blog/how-to-evaluate-ai-testing-tools).

## Try it on your own app

Describe a user flow in plain English and TestWatch writes a Playwright test you can read and export. Passing runs make no AI calls.

Free: 5 tests, 500 runs a month, 2 apps and one daily schedule. Unlimited teammates, no card.

## Read next

- [Where AI test generation fails: every miss, explained](https://testwatch.dev/blog/ai-test-generation-failures)
- [Why AI-written tests pass when they shouldn’t](https://testwatch.dev/blog/ai-written-tests-always-pass)
- [How to evaluate AI testing tools: count the false greens](https://testwatch.dev/blog/how-to-evaluate-ai-testing-tools)
- [How we measure TestWatch: every case and every planted bug](https://testwatch.dev/eval)
- [How TestWatch writes, runs and fixes a test](https://testwatch.dev/how-it-works)
