1

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

1 Answer 1

1

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.

Example:

If you want to test a function which determines the winner of a game after it has ended, and there are two input parameters pointsPlayer1 and pointsPlayer2, the domains of these parametes would be

0 <= pointsPlayer1 <= maxValue and 0 <= pointsPlayer2 <= maxValue

maxValue is 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:

  1. pointsPlayer1 < pointsPlayer2
  2. 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 <= maxValue

"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:

  1. pointsPlayer1 < 0
  2. pointsPlayer1 > maxValue
  3. pointsPlayer1 + pointsPlayer2 > maxValue

and so on.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.