May 23, 2023

Equivalence Partitioning

Great job on starting a new lesson! After reading this lesson, click Next 👉 button at bottom right to continue to the next lesson.

Equivalence partitioning is a technique to test software by dividing the input data into groups (called partitions in mathematics) that are expected to have the same behavior. You test one value from each group and test the output. Equivalence partitioning is based on software requirements and technical specifications.

Equivalence Partitioning Examples

  • You test a field that only accepts age between 18 and 60. You divide the input data into three groups: less than 18, between 18 and 60, and more than 60. You test one value from each group and test each output. Only the second test input (between 18 and 60) should be accepted.
  • You test a function that accepts a numeric percentage between 0 and 100. You divide the input data into four groups: a number less than 0, a number between 0 and 100, a number more than 100, and a non-numeric value. You test one value from each group and test each output. Apart from the second test input (a number between 0 and 100), the test inputs should be rejected by the function.
  • You test a website that accepts a username and password to log the user in. You divide the input data into two groups: valid username and password pair, and everything else. You test one value from each group and test the output. The website should only login using the valid username and password pair.
  • You test a calculator app that accepts two numbers and an operator. You divide the input data into four groups: valid numbers and operator, one invalid number, both invalid numbers and invalid operator. You test one value from each group and test each output. Only the first test input (valid numbers and operator) should be accepted; other test inputs should be rejected by the app.

Tips for Equivalence Partitioning

  • Identify the input data groups (partitions), such as range with lower and upper limits, distinct values, or collections.
  • Test each valid and invalid partitions to test if your software handles it correctly.
  • Test the relevant feature of the software that depends on the test inputs.
  • As mentioned in previous lessons, use tools to automate testing tasks, such as generating test inputs, executing tests, and reporting results.

FAQ (interview questions and answers)

  1. What is the purpose of equivalence partitioning?
    The purpose of equivalence partitioning is to reduce the number of test cases by identifying the groups (partitions) of test inputs, so that one representative value from each input data group may be tested.
  2. What is the advantage of equivalence partitioning?
    It saves time and resources by avoiding redundant tests.
  3. What are the challenges that faced when using equivalence partitioning?
    It assumes that your software treats each input within a partition identically. As a result, it can miss a defect that occurs only with specific values within a group. It can be difficult to identify the input data groups for complex software.
  4. Is equivalence partitioning a type of black-box testing?
    Yes, it is a technique that tests the software while ignoring its code or structure.
Remember to just comment if you have any doubts or queries.


No comments:

Post a Comment

Note: Only a member of this blog may post a comment.