Skip to main content

Why Unit Test?

Unit testing offers a number of benefits including:

  • Providing verification that a code module is correct. This is the principal motivation for unit testing.

  • Providing automatic regression testing. Unit tests should be re-run after changes to a code module to ensure that code module is still correct. That is, unit tests should be used to ensure that changes have not broken a code module. Ideally, the unit tests for all code modules should be run after a change to any one module.

  • Providing documentation. Frequently, the unit tests of a code module are delivered together with the code module. Examining the unit tests provides a great deal of information about how a code module functions.

FeedbackOpens in a new tab