Test Boundary Conditions
As you're writing tests for the normal conditions, it might be good to codify
your assumptions about how the objects handle the edge cases, which are often called FencePost or OffByOne (Obi-Wan) errors.
General Boundary Conditions:
-
Uninitialised -- (Language/compiler dependent: 0, NULL or random value.) How does the code behave when it gets a null value instead of a real object? Does it segfault? Throw an exception? Return an object after the NullObject pattern?
Collection Boundary Conditions:
-
Collections include arrays, linked-lists, SQL ResultSets, the "Game" class in the ObjectMentorBowlingGame. Here are five specific conditions to test when developing such a class:
-
Empty
-
Minimum
-
Maximum
-
Minimum - 1 -- invalid index just below the expected range of values
-
Maximum + 1 -- invalid index just above the expected range of values
CategoryTesting