A Test Can Pass and Still Miss a Bug

updated December 4, 2026

Your test passes. The feature it was written for can still be broken.

A pass does not mean the app works. It means every check you wrote held. Anything you did not check can be broken, and the test stays green. Teams often find this out after a release, when a user reports a bug in a feature that "has tests".

This page shows how that happens, how to find out whether your own test would catch a bug, and how TestAcademy grades tests with the same idea.

The examples use an invented counter app. There is no counter app to open here. The problem at the end uses a practice app you can open and test.

A test that passes on a broken app

The counter starts at zero. Add one increases it. Clear count returns it to zero. Here is a test for it:

import { test, expect } from '@playwright/test';

test('adds to the count', async ({ page }) => {
  await page.goto('/');
  await page.getByRole('button', { name: 'Add one' }).click();
  await expect(page.getByTestId('count')).toHaveText('1');
});

Line by line:

  • page.goto('/') opens the app. A short path like '/' works because the project sets baseURL in its Playwright config.
  • The click presses Add one.
  • toHaveText('1') checks the count. If the count is not 1, the test fails.

Now a developer breaks Clear count, so it does nothing. Run the test again. It still passes, because it never presses Clear count.

The results say the test passed. Nobody reading them can tell that a button is broken. This is how a bug reaches production with a green build. For setup and syntax, see the Playwright beginner tutorial.

Three ways a pass misses a bug

The test never touches the broken part. That was the case above. Clear count was never pressed.

The test touches it, but checks something weak. Here is a second test:

test('clears the count', async ({ page }) => {
  await page.goto('/');
  await page.getByRole('button', { name: 'Add one' }).click();
  await page.getByRole('button', { name: 'Clear count' }).click();
  await expect(page.getByTestId('count')).toBeVisible();
});

It presses Clear count, then checks that the count is visible. An assertion is the line that checks something. This assertion holds when the count says 0, and also when it still says 1. So the test passes on the broken app. It cannot fail for the bug it was written for.

The test checks the right value, but only in one situation. A test can pass because of timing or order. It passes when the app answers fast and fails when it answers slowly. Or it passes after the test before it, and fails when it runs on its own. A test like this is flaky: it gives different results on the same code. One green run does not show it.

The fix: check the value that changes

test('clears the count', async ({ page }) => {
  await page.goto('/');
  await page.getByRole('button', { name: 'Add one' }).click();
  await page.getByRole('button', { name: 'Clear count' }).click();
  await expect(page.getByTestId('count')).toHaveText('0');
});

The last line now names the exact value Clear count promises. On the working app the count returns to 0, and the test passes. On the broken app it stays at 1, and the test fails. That failure is the test doing its job.

How to find out whether a test would catch a bug

Break the app on purpose, then run the test. If the test still passes, it does not check that behaviour.

This is the idea behind mutation testing. A mutation is a small change to the code, such as a button that no longer does anything. You make the change, run the tests, and see whether any test fails. Mutation testing tools make these changes automatically.

You can try it by hand on your own project. Comment out the line that clears the count. Run the suite. If nothing fails, you have found a missing check. Then put the line back.

How TestAcademy grades a test with this idea

TestAcademy breaks the app for you, with bugs written by hand. There are 60 bugs written by hand. The 42 practice problems in the catalog plant 55 of them. Each problem says which behaviours it breaks.

When you press Verify, your test first runs against the working app. It must pass there. Then it runs against a copy of the app with one planted bug, once for each bug. Your test must fail on every broken copy. If it passes on one, the result names the behaviour it missed.

The same problem is checked in more than one tool. 41 UI problems have a reference solution in Playwright, Cypress and Selenium, and each one is verified against the same broken copies. 1 API problem runs in Playwright and Cypress only, because Selenium has no API client.

Debug problems also check the third way a pass can mislead. Your test runs three times on the working app, then once in its written order and once in reverse order. A test that passes on one run and fails on another is flaky. A test that passes in order and fails in reverse depends on another test.

The ceiling, stated plainly

20 of the 42 problems plant one bug. The most any problem plants is 4. So the strongest result any report can show is "4 of 4 planted bugs caught".

That result means your test caught every bug planted in that problem. It does not mean your test catches every bug the app could have. No report here claims that.

In your own work

In a code review, ask one question of every assertion: which bug would make this line fail? If nobody can name one, the assertion proves nothing. The review card for AI-written tests walks you through the same question. How it works shows the grading steps on one problem.

In the course "Review Tests Written by AI", all eleven tests in one file passed on a shop with a bug added on purpose. Read the free lesson The test passes. That proves little.

Remember this

A pass tells you that your checks held. It does not tell you what you forgot to check. Break the app on purpose to find out.

A test proves a feature only when breaking that feature makes the test fail. The problem "The cart makes four promises" practises checking every promise a cart makes, so that each planted bug fails your test.

Free Playwright task

Test a cart quantity change

The starter test changes a cart quantity twice. Check which quantity the cart keeps.

Use a computer to write and run your test. Choose Run tests to try the working shop. Then choose Verify to see whether your test catches the cart bug.

If it misses the bug, check the quantity after the second change. Choose Verify again. A hint and a worked answer are available in the task.

The cart exercise is free. The other shop tasks need a paid course plan.

Keep reading