Data Driven Testing (DDT) is a proven method in software testing to efficiently execute test cases with different input data. The equivalence class partioning method helps to reduce the test set in a meaningful way without jeopardizing test coverage. In this article, we explain how this technique works and what benefits it offers in Data Driven testing. In addition, the method is combined with boundray value analysis to enable even more precise test case selection.

Basics of the equivalence class method

The equivalence class method is a test case derivation technique that aims to divide the input data of a system into groups or classes in which the values can be considered equivalent. Equivalent means that each value within a class should behave identically in the test case behavior, whereby it is sufficient to test with only one representative of each class.

Example of an equivalence class division

Assume a form accepts numbers between 1 and 100 as valid input:

Input values Classification Expected result
0 Lower limit -1 Defect
1 Lower limit Success
100 Upper limit Success
101 Upper limit +1 Defect

The combination of both methods ensures a more precise test coverage by testing representative values from each equivalence class as well as critical limit values.

Application in Data Driven Testing

Data Driven Testing is based on the idea of executing a large number of test cases with different input values. The equivalence class method helps to optimize the amount of test data.

Advantages of combining DDT with equivalence classes and limit value analysis

  1. Reduction of redundant tests: Instead of testing all possible inputs, only representative values from each equivalence class and critical limits are selected.
  2. Efficient test data management: Test data is more structured and easier to manage.
  3. Higher test coverage with fewer test cases: Critical test cases are covered without performing unnecessary tests.
  4. Increased defect detection: Tests at the edges of a class uncover potential limit value defects.
  5. Automation-friendly: The combination with DDT makes automation simpler and easier to maintain.

Visualization of equivalence classes and boundray value analysis

Equivalence classes as a diagram

A diagram can illustrate the classification of the equivalence classes and the relevant limit values:

  • X-axis: Input values
  • Y-axis: Validity

Diagram for displaying equivalence classes for input values. The X-axis shows the input values from -20 to 120, the Y-axis shows the validity (1 = valid, 0 = invalid). The range from 1 to 100 is marked as valid and highlighted with a blue line. The limit values 1 and 100 are shown with dashed green lines. Invalid ranges below 1 and above 100 are marked with red dashed lines. The legend explains the colors and line types. The title of the diagram is “Equivalence classes for input values (1-100 valid)”.

Test data matrix for Data Driven Testing with boundary value analysis

Test case Input values Expected result
TC1 -10 Defect
TC2 0 Defect
TC3 1 Success
TC4 50  Success
TC5 100  Success
TC6 101 Defect

Example 1: Age check for the registration of an online platform

Suppose an online platform only allows users between the ages of 18 and 65 to register. The software validates the age based on the number entered by the user.

Equivalence class analysis

Input values Equivalence class Validity
0 – 17 Invalid No
18 – 65 Valid Yes
66 and higher Invalid No

Limit value analysis

Here we specifically test the values at the limits of the equivalence classes:

Test case Input values Expected result
TC1 17 Defect (too young)
TC2 18 Success (currently valid)
TC3 30 Success (middle of valid class)
TC4 65 Success (just valid)
TC5 66  Defect (too old)

Explanation of the test strategy

  • By combining the equivalence class method and boundary value analysis, we minimize the test cases while still ensuring maximum defect coverage.
  • Instead of testing all ages between 18 and 65, we choose only representative values.
  • The thresholds 17, 18, 65, 66 are critical as defects in the implementation often occur here.

This example shows how these simple methods help to efficiently test the quality of an application in practice.

The example above shows the simplest partioning into equivalence classes: a class with valid and a class with invalid representatives. The second example combines several data types with several equivalence classes.

Example 2: Flight ticket prices based on age and booking class

A flight booking system calculates the ticket price depending on the age of the passenger and the booking class. The prices and booking conditions are as follows:

  • Children (0-11 years) receive a 50% discount, but may only travel with an adult.
  • Teenagers (12-17 years) pay the full price.
  • Adults (18-64 years) pay the full price.
  • Seniors (65+ years) receive a 20% discount.
  • Normal prices apply in Economy class.
  • In Business Class there is a surcharge of 50% on the base fare.
  • In First Class there is a surcharge of 100% on the base fare.

Equivalence class analysis

Here we divide the possible inputs into equivalence classes for two data types:

Age of the passenger Equivalence class Permitted booking Discount/surcharge
0 – 11 years Kids Only with adult -50%
12 – 17 years Teenagers Yes No discount
18 – 64 years Adults Yes  No discount
65+ years Seniors Yes  -20%

 

Booking class Equivalent class Price rule
Economy Standard Normal price
Business Premium +50%
First Class Luxus +100%

Boundary value analysis

Here we specifically test the boundary values between the equivalence classes:

Test case Age Booking class Expected result
TC1 0 Economy Defect (child without adult)
TC2 1 Economy Defect (child without adult)
TC3 11 Economy Defect (child without adult)
TC4 12 Economy Success (transition child → teenager)
TC5 17 Economy Success (last teenage stage)
TC6 18 Economy Success (transition teenager → adult)
TC7 64 Economy Success (last adult stage)
TC8 65 Economy Success (transition adult → senior with 20% discount)
TC9 80 Economy Success (Senior with 20% discount)
TC10 30 Business Success (50% surcharge)
TC11 40 Frist Class Success (100% surcharge)

Explanation of the test strategy

  • Several equivalence classes for age and booking class.
  • Boundary value analysis checks whether the system processes the transition between age groups correctly.
  • Special case: Children must travel with an adult, therefore TC1-TC3 are invalid.
  • Discount and surcharge calculations are checked.

Conclusion

Combining the equivalence class method with boundary analysis is a valuable technique in Data Driven Testing to select test cases and increase test efficiency. While equivalence classes sensibly reduce the amount of test data, boundary value analysis ensures that critical edge cases are not overlooked. This systematic selection of test data can ensure the quality of the software and minimize the testing effort at the same time