Why Unit Testing
You are unit testing when you (a programmer) write test code to verify units of code. A unit is a small bit of code that exhibits some useful behavior in your system. A unit doesn’t usually represent complete end-to-end behavior; it usually supports some small facet of functionality.
The unit tests you write will manipulate your units—small bits of code—directly. As such, you’ll code them in Java. You’ll run these tests through JUnit, a tool that marks your tests as passing or failing.
Here are a few whens and whys for writing/running unit tests:
-
You finished coding a feature and want to ensure it works as expected.
-
You want to document a change so that you and others later understand the choices you coded into the system. ...
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