Chapter 14
Unit Testing
Unit tests are the basis of a programming strategy that promotes the creation of individual checks for each feature implemented in an application. Unit tests can also be created to verify that a piece of code complies with some particular requirement. For example, if you are creating a method that adds two numbers, a unit test can be written to verify that the response is correct for some particular cases. Although you cannot prove that a piece of code works by just testing for specific values, running unit tests can improve your confidence that the code is indeed returning results that comply with your requirements.
Another use for unit tests and associated tools is in what is called test-driven development (TDD) ...
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