O'Reilly logo

SAMS Teach Yourself C++ in 10 Minutes SECOND EDITION by Jesse Liberty

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required