Testing Strategies

Black-Box Testing

  • tests with no knowledge of internal workings
  • typically tests features according to specification
  • sample techniques (detail on p. 276):
    • equivalence partitioning
    • boundary value analysis
    • testing with pre/postconditions
    • model-based testing

White-Box Testing

  • uses knowledge about the code
  • sample techniques (detail on p. 277):
    • code coverage-based testing
    • path testing
    • mutation testing
    • dynamic symbolic execution

Black-Box vs. White-Box Testing

Fuzzing

  • black-box when generating test inputs from specification
  • white-box when generating test inputs from source code

Neither strategy is superior, each has advantages and disadvantages.

Gray-Box Testing

  • Example 1
    • design tests according to the code of multiple modules (white box)
    • conduct tests through the exposed interfaces (black box)
  • Example 2
    • create and run tests according to pre/postcondition of a module (black box)
    • measure the code coverage (white box)
    • if code coverage doesn't meet goal, we can generate more tests from the code to exercise the uncovered statements or paths (white box)