Writing Good Tests

Purpose of Tests


  • demostrate that a feature works
  • prevent regressions

Scope of a Test Suite

TODO (focused on a single library module, or more narrow)

Scope of a Test Case

TODO (focused on a particular function; you may have multiple cases for the same function)

Comments in a Test Case

TODO (have a top-level comment for each test case that explains why it’s there)

Using Application Code to Verify Application Code

TODO (test calls an app function; should you use another app function as part of verifying that it worked?)