Chapter 7Boundary Conditions: The CORRECT Way
Your unit tests can help you prevent shipping some of the defects that often involve boundary conditions—the edges around the happy-path cases where things often go wrong.
In the previous chapter, you got a whiff of the CORRECT acronym, which can help you think about the boundary conditions to consider for your 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 reasonable minimum and maximum values?
-
Reference—Does the code reference anything external that isn’t under direct control of the code itself?
-
Existence—Does the value exist (is it non-null, nonzero, present in a set, and so on)? ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access