Your code is supposed to function in a certain way. You expect that, whenever used, when you input certain bits of data to it, you’ll get a certain, expected, output.
Tests are extra code that you write alongside your code. You use this extra code to exercise, and test, your actual code, i.e. the code you really care about. So you could also say that tests are meta code: code whose sole purpose is to test other code.
That sounds more complicated than it actually is.
We’ll expore the basic concepts of testing by writing very simple tests first. Later we’ll look at libraries and services that make writing such tests more easy and effective.