Skip to lesson
  1. Learn
  2. See
  3. Try
  4. Make

Write one test that can fail

What this lesson is about

A test that always passes proves nothing. Write one that goes red when the code is wrong, and prove it.

You wrote a test for the GST line in a shop's billing program, and it passed at once. What now?

Why this matters

A test that always passes is decoration. It costs the same to write and it catches nothing. The only proof that a test works is watching it fail on code you broke on purpose.

Lesson 5 of 10 on Coding for evaluation worknextFind the input that breaks itPart 2 ends in a work sample you can send

Read the primary or official source: Python documentation · unittest