agile3
Agile + AI

AI in Testing

Using AI to write and run tests, and the new question it raises: who checks that the tests are right?

2 min read · Practitioner

In 30 seconds

  • AI can draft unit, integration and end-to-end tests quickly.
  • Tests written from the code can bake bugs in.
  • Humans own what should be tested and why.

Good uses

  • Drafting unit tests for existing code
  • Generating test data and edge cases
  • Turning acceptance criteria into test skeletons
  • Exploratory testing ideas and charters

Who tests the tests?

If AI writes code and then tests from that code, the tests confirm what the code does, not what it should do. Write tests from the spec or acceptance criteria, ideally before the code, as in TDD and ATDD. Mutation testing can show whether tests actually catch faults.

How testers' work changes

Testers shift further toward test strategy, risk analysis, exploratory testing and reviewing AI-generated tests. For AI features themselves, see eval-driven development.

Myth vs reality

Myth · AI-generated tests mean full coverage.
Reality · Coverage isn't correctness.
Myth · Testers are no longer needed.
Reality · Their judgment matters more.
Myth · AI tests are unbiased.
Reality · They inherit the code's and prompt's assumptions.

FAQ

What's mutation testing?

Introducing small faults to check that tests catch them.

Should AI write tests first or code first?

Tests from the spec first are safer.

Can AI do exploratory testing?

It can suggest ideas; humans still explore best.