lecture 6 of 80 completed

Where the expected value came from

We gave an AI tool the app's code and no requirement. It wrote a test that agrees with the code, and it said so.

What you'll learn

  • Why a test that copies its expected value from the code cannot find a mistake in that code
  • How to see where an AI-written test took its expected values from
  • What to give an AI tool in place of the code

In lecture 2 we sent an AI tool the code behind a sign-in form and wrote: "I do not have a written requirement." We asked what happens with a wrong password.

The test it wrote expects the error text from the code we pasted. The reply was open about it:

"Since there is no written requirement, the expected behavior is derived from the provided implementation."

The "provided implementation" is the code we pasted. The test passed on the working app. It failed on two copies with planted bugs, so it caught both. By the checks you can run, this is a good test.

full course

Keep reading with the full course

The first 2 lessons of “Review Tests Written by AI” are free. A course plan opens every lesson of this course and its graded practice. It also opens “Work With AI as a QA Engineer”. The same plan includes all lessons for Playwright, Cypress and Selenium.

See course plans →

Read the free lessons first