Learn about writing unit tests by following the CORRECT acronym.

We'll cover the following


We got a whiff of the CORRECT acronym earlier in this course, which can help us think about the boundary conditions and consider the following for our unit tests:

  • Conformance: Does the value conform to an expected format?
  • Ordering: Is the set of values ordered or unordered as appropriate?
  • Range: Is the value within the reasonable minimum and maximum values?
  • Reference: Does the code reference anything external that isn’t under the direct control of the code itself?
  • Existence: Does the value exist (is it non-null, nonzero, present in a set, and so on)?
  • Cardinality: Are there exactly enough values?
  • Time (absolute and relative): Is everything happening in order? At the right time? In time?

Get hands-on with 1200+ tech skills courses.