Testing is one way to prevent bugs. Intercept bugs. Raise your awareness. It’s the best way to stop bugs from generate when you edit existing code.

Code with a high number of tests, covering a lot of the functionality, is said to be well tested. With a high coverage of tests.

Testing is also the best way to ensure a program is doing what you want. With a wide range of inputs, you can tell what’s the expected output and the testing suite will make sure this is what is happening. And alert you if not.

Modern programming involves running the suite of tests any time you push your modifications to an existing program, to make sure your changes are not causing any new bug.

Best practices want you to always create the tests for your new code, so that the entire codebase is always well tested.

Testing is also a QA measure. For open source projects, it’s essential to have a good amount of tests, to signal other programmers that you care about quality and the tests are the first thing many people run.

There are various kinds of tests, and all combined they aim to help you produce software that works as expected.

The simplest is called unit testing. Those tests are the most common, and they aim to test a single item in isolation. A function. A class. A package. Having a great suite of tests pass will mean it is guaranteed to work.

Integration testing is a second level, more focused on having your singular items, tested in isolation using unit testing, talk to each other. Or talk to a separate service or the network or the file system or anything external.

End to end testing is another kind of tests, aimed at guaranteeing you that the app is working, flowing correcly from start to finish. Backend, frontend, rendering.. Tools exist to help you do so. For Web applications in particular, Cypress is a solid option.


Go to the next module