Unit Testing

Learn what unit testing is and how to perform it.

We'll cover the following

Unit tests

Previously, we learned how the versioning control tool is used throughout the development process. Now, let’s look at what we do when the code is written, as well as how we can make sure that it’s working before we push it to the central repository. It’s now time for unit testing!

Testing our code is essential so that we can verify that it does what it should. We’ll also use tests to make sure that any changes we make to the code haven’t 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’ll 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’ll try to isolate one single function (or another small unit of code) and run our tests on just that unit.

Get hands-on with 1200+ tech skills courses.