8. Essential Tests

Level: beginner · Reading time: 3 min · Prerequisite: book/poche/07-reading-errors.html · Last review: 2026-05-09

TL;DR (5 lines)

  • Read the core idea first.
  • Understand one concept at a time.
  • Run small examples.
  • Fix errors early.
  • Move to next chapter only when clear.

Frequent mistakes

  • Skipping prerequisites.
  • Reading without trying examples.
  • Fixing too many errors at once.

Prerequisites: book/poche/07-reading-errors.html. See also: book/chapters/18-tests.html.

Goal

Write short tests that secure the basics.

Example

Nominal case + limiting case for each critical procedure.

Why it matters

Testing avoids regressions during refactors.

Quick check

What is the smallest useful test for add(a, b)?

Try this

  1. Add a nominal test.
  2. Add a limit test.
  3. Check the expected result.

If you're stuck

2 well-targeted tests are better than 20 redundant tests.

Mini quiz

  1. What is the main goal of this chapter?
  2. Which concept is most important?
  3. What will you try right now?

See also

Next best action

Apply one idea from this chapter in a tiny example, then continue.