Automated testing basics
Up until now, testing our application has been a process of launching it, running it through a few basic procedures, and verifying that it did what we expected it to do. This approach works acceptably on a very small script, but, as our application grows, it becomes an increasingly time-consuming and error-prone process to verify the application's behavior. Using automated testing, we can consistently verify our application logic within seconds.
There are several forms of automated testing, but the two most common are unit testing and integration testing. Unit tests work with discrete pieces of code in isolation, allowing us to quickly verify the behavior of specific sections. Integration tests verify the interactions of multiple units of code. We'll be writing both kinds of tests to verify the behavior of our application.
A simple unit test
At its most basic, a unit test is just a short program that runs a unit of code under different conditions and compares its output...