Bitpath

Boss lesson · Unit 02

What kind of test

Unit, integration, end-to-end: spend your tests wisely

13 exercisesabout 3 min

What you practise

  • Unit, integration and end-to-end
  • Speed, confidence and brittleness of each
  • Flaky tests and their causes
  • What coverage does and doesn't tell you

Try a question from this lesson

Pick one

A checkout has a price calculator, an orders database and a web page. A typo breaks the rounding in the calculator. Which test finds it fastest and points straight at it?

The idea

Concept cards are short on purpose. In the app they appear between questions, after you have met the idea.

Concept

The test pyramid

Unit tests check one function alone: milliseconds each, and a failure names the culprit.

Integration tests check that parts work together, for example your code with a real database.

End-to-end tests drive the whole app like a user: the most realistic, the slowest, and the likeliest to break for unrelated reasons. Write many of the first kind and few of the last.

        /  e2e  \         few, slow
      / integration \     some
    /   unit  tests   \   many, fast

11 more exercises in the app

  • 3× type the answer
  • 1× match the pairs
  • 1× fill the blanks
  • 4× multiple choice
  • 1× true or false
  • 1× order the lines

Bitpath is an iOS app in development. Join the waitlist and you get one email when it is ready to try.

One email when Bitpath is ready to try. Nothing else. Privacy