Skip to main content

Section C.15 S4: Testing


  • Failures witness bugs.

  • Failures are symptoms no diagnosis; failure and error location often far apart.

  • Use assertions to document specifications as invariants to move failures closer to error.

  • Program defensively, don't just consider the happy path.

  • Introduce tests as states in theory and small programs that set up states in practice.

  • Black-box tests are created based on a specification only but cannot guarantee any coverage of the tested code. Different tests test different “cases” in the specification.

  • White-box tests test existing code and try to reach high coverage but fail to detect missing code.

  • Coverage is measured in different criteria: Branch, path, statement coverage.

Sections Covered.

Section 7.2, Section 7.3