22 Testing with JUnit
“There’s no reason why you should have a computer at home.”—Ken Olson , President of Digital Equipment Corporation, 1977
In this chapter you’ll learn to write unit tests for Java applications with the JUnit testing framework.
22.1 Software Tests
To gain as much confidence as possible in one’s own codebase, software tests are a good idea. Tests are small programs that run automatically over the codebase without user control and use rules to show that sections of the code behave as specified. Of course, software can’t show the absence of errors, but a test case always shows whether a program meets the requirements of the specification.
Figure 22.1 Test, Test, Test, but Please Have a Plan!
Although software testing ...
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