Unit testing

Unit tests can be considered the foundation of software testing in that unit tests test individual blocks of code, such as a function or a class/object. With a unit test, you are testing the functionality of functions and/or classes on their own. Because of this fact, unit tests typically stub out or mock out any external dependencies so that that the test can focus entirely on the function and/or class in question.

Unit tests are fundamental to testing a system in terms of correctness of behavior of individual components. The fact that unit tests are limited in this respect means that it is easier to isolate where defects have occurred at. Unit tests are often used to test code branches and how a function may handle different ...

Get Hands-On Continuous Integration and Delivery now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.