Testing our code is essential so that we can verify that it does what it should. We will also use tests to make sure that any changes we make to the code have not made things that previously worked stop working or behave in an undesired way.
Several kinds of testing can be done on our code, and the first type of test we will look at is called a unit test. The unit part indicates that the test will be done on a separate unit of our code. This is typically at a function level. This means that we will try to isolate one single function (or another small unit of code) and run our tests on just that unit.
These tests are typically written by the developer of the code unit to be tested and are often automated. This means that as soon as a block of code is ready to be committed to the version control system, it must first pass the unit test written for it.
Since the unit test only tests a single code unit, they are typically rather trivial. To test our