Writing Test Harnesses
You may recall the implementation of SelfTest(), which created an instance of anAccumulator and tested it. This is called a test harness. You can and should create a test harness for every class you implement.
The test harness can be a program, a part of an object, or an object itself, and often it will have a user interface. Test harnesses fall into several categories:
Comprehensive—like SelfTest(), the test harness runs all the tests and checks the results against what is expected. A comprehensive test harness is especially good for quick regression tests. Some comprehensive test harnesses are driven by internal code, others by external files or databases.
Front-end—the test harness runs all the tests but leaves it to ...
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