Unit testing
The purpose of the unit test is to confirm the correctness of a specific piece of code independent of its dependencies. Here, the phrase specific piece of code can imply different things, and is based on how your application code is structured.
Typically, a specific piece of code can be a class that follows a single responsibility principle, or can be a component. The most important factor of the unit test is that we only test the code inside the class, and not the dependencies that the said class has. This means that if a class is dependent on another class for some data, some web service response, we stub those out and just test the logic of the class.
This approach allows us to confirm the behavior of the class in isolation, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access