Software Testing by Equivalence Partitioning

Equivalence Partitioning is a Blackbox Testing Technique. It makes use of the fact that the inputs and outputs of a component under test can be partitioned into classes. Values in the same class will be treated in the same way. So, the result of testing any value from a partition is considered to be representative of the whole partition.

For example, suppose an application collects some data about a traveller using the dialog box shown in the diagram. When the OK button is pressed the component calculates a fare from the current location using the input values.

The Discount Table

Age
Discount
0-4 years
100%
5-15 years
50%
16-64 years
0%
64 years and older
25%

There is a standard fare to each destination. Our travel service offers discounts to travellers based on their age. For example, children under 5 travel free and those over 65 get a 25% discount.


There are possibly an infinite number of age values that could be input, it is impractical to test them all.

We can use equivalence partitioning to test the processing of data. We need to partition the possible age values into classes where all members should be treated in the same way. Using the Discount Table, we can see four partitions of valid ages and create two partitions of invalid ages:

  • 0, 1, 2, 3, 4.

  • 5, 6, 7, …15.

  • 16, 17, 18, …64.

  • 65, 66, 67, …120.

  • Ages greater than 120 years.

  • Ages containing non-numeric characters,

Equivalence partitioning requires us to choose one value from each partition. Where possible, a middle value is chosen. So we would test the processing of ages 2, 10, 40, 108, 555 and ‘one’. To complete equivalence partition testing we need only perform six tests.

The Fare Table

Destination
Fare
Manchester
£42.30
Liverpool
£42.30
Warrington
£42.30
Glasgow
£61.80
Edinburgh
£61.80
Cardiff
£31.10
Swansea
£31.10
Newport
£31.10
 
 

Another feature of our application is that fares are regional; fares to the same region are all the same.

The destination field can be partitioned into the same regions:

  • Manchester, Liverpool, Warrington.

  • Glasgow, Edinburgh.

  • Cardiff, Swansea, Newport.

To complete equivalence partition testing on the destination input field we choose one town from each region. For example: Liverpool, Glasgow and Cardiff.

The component handles all values in the name in the same way; it prints the name on any tickets that are issued. As all values are treated the same, it is not possible to separate the name field values for equivalence partitioning.

More by this Author


Comments

No comments yet.

    Sign in or sign up and post using a HubPages Network account.

    0 of 8192 characters used
    Post Comment

    No HTML is allowed in comments, but URLs will be hyperlinked. Comments are not for promoting your articles or other sites.


    Click to Rate This Article
    working