Valid Equivalence Partition testing in a game of snooker
I've read a number of papers and books on equivalence partitioning but can't seem to get my head around this one part.
My question is: Are these valid equivalence partitions?
Let say I have a program that adds together the points each player gets in a game of snooker and each game is part of a match. When a game has completed the winner is announced and when the match has completed (after 3 games) the match winner is announced.
Would partitions that depend on a series of inputs be valid? Such as:
Player 1 wins the game
player 2 wins the match
The answer is no.
Equivalence partitioning is used for input or output values of a software component, so that you can derive test cases using representative values of the partitions.
If you want to test a function which determines the winner of a game after it has ended, and there are two input parameters
pointsPlayer2, the domains of these parametes would be
maxValueis the maximum number of points in a game, you have to use the concrete maximum value for snooker for this placeholder.
You have do divide the domain in ranges from which you expect the software component to behave equal for each value in these ranges.
The following "valid" partitions can be used:
pointsPlayer1 < pointsPlayer2
pointsPlayer1 > pointsPlayer2
Partition 1 is used for the test cases where player 2 wins Partition 2 is used for the test cases where player 1 wins
You have to consider an additional condition for deriving your test cases:
pointsPlayer1 + pointsPlayer2
"Valid" partitions are used to test the "good" cases (valid parameter values). The "bad" cases, i.e. invalid parameter values, should also be tested. "Invalid" partitions are used for this. "Invalid" partitions would be for example:
pointsPlayer1 < 0
pointsPlayer1 > maxValue
pointsPlayer1 + pointsPlayer2 > maxValue
and so on.