How to create test cases using Equivalence Partitioning and Boundary Value Analysis test technique (Step by step)

Both are black box testing techniques. Let’s start with an explanation of the Equivalence Partitioning technique.

✅ Equivalence Partitioning

The steps should be as follows:

Divide the test conditions into groups or sets of partitions. All the eleme…


This content originally appeared on DEV Community and was authored by Alan Liew

Both are black box testing techniques. Let’s start with an explanation of the Equivalence Partitioning technique.

Equivalence Partitioning

The steps should be as follows:

  1. Divide the test conditions into groups or sets of partitions. All the elements under the same set of partitions are considered the same, and the system should handle them equivalently.
  • A partition containing valid values is called a valid partition
  • A partition containing invalid values is called an invalid partition

For non-numeric example:
If the fruits = apple, then print green
If the fruits = orange, then print the orange

Non Numeric Example

In the above example, Apple and Orange are valid partitions, while no invalid partition is specified; we assumed other fruits are invalid partitions.

For numeric example :
Users should be able to register when they are between ages 1 and 21.

1 and 21 is a valid partition(able to register), while an age less than 1 and more than 21 is an invalid partition

In the above example, an age between 1 and 21 is a valid partition(able to register), while an age less than 1 and more than 21 is an invalid partition(unable to register).

2. When there are multiple sets of partitions or more than one input,

  • The valid partition shall combined.
  • The invalid partition should be tested individually.

Let’s take this as an example; the requirement is to register a user email when it hits the requirements below:

  • It should be 6–30 characters long
  • Should be alphanumeric

We should be able to come up with these valid and invalid partitions.

Following the No. 2 rules, we don't need to create 5 test cases for 3 partitions belonging to (6–30 characters long) and 2 partitions belonging to (should be alphanumeric).

We shall combine the valid partition and come out with the test value (input) of
We can satisfy the valid partition with the value of “abc123”

then to test the invalid partition individually,

A total of 4 test cases will be needed to cover all partitions.

In this example, 4 test cases are sufficient to test out all the combinations of partitions.

The question may arise: why don't we combine the invalid partition?

For example, if we combine less than 6 characters and not alphanumeric as one test,

when testing the invalid partition of <6 characters, the error message “Sorry, your username must be between 6 and 30 characters long”

Image description

However, when we testing the invalid partition of <6 characters and the invalid partition of not alphanumeric, the error message “Sorry, only letters (a-z), numbers (0–9), and periods (.) are allowed.”

Image description

It’s clear that when we combine two invalid partitions to test, it’s very easy to miss out on validating an invalid partition of <6 characters. In this case, the test cases are not well designed.

✅ Boundary Value Analysis

Boundary value analysis is closely related to equivalence partitioning. We can determine the boundary value by knowing the partition.

We will use back the same numeric example :
Users should be able to register when they are between ages 1 and 21

Image description

And we know that

  • age between 1 and 21 is a valid partition (able to register),
  • age less than 1 and more than 21 is an invalid partition (unable to register).

To determine what is the boundary values:

1. The first rule of BVA is that the minimum and maximum values of the partition are called the partition's boundary values.

Hence, boundary values of 1 to 21 — — 1 and 21

Next, let's find out what is 2-value BVA or 3-value BVA.

To find out what is the 2 value BVA

2. This boundary value and its closest neighbour belonging to the adjacent partition will be boundary values.

Boundary values of 1 to 21 — — 1 and 21

(adjacent partition) Boundary values of 1 to 21 — — 0 and 22

Hence, the 2-value boundary value of 1 to 21 is — — 0, 1, 21, 22

To find out what is the 3 value BVA,

3. This boundary values and both their neighbors will be boundary values.

Boundary values of 1 to 21 — — 1 and 21

(adjacent partition) Boundary values of 1 to 21 — — 0 and 22

boundary values and both its neighbors of 1 to 21 — — 0, 1, 2, 20, 21, 22

boundary values and both its neighbors of 0 and 22 — — -1, 0, 1, 21, 22, 23

Hence, the 3 value BVA is -1, 0, 1, 2, 20, 21, 22, 23

Now, you may wonder another question: when should we use 2-value BVA or 3-value BVA?

Let’s recap the requirements:

  • Users should be able to register when they are between ages 1 and 21

And somehow, developers make this mistake in the logic to be able to register when 1 ≤ age and/or age = 21.

We may have overlooked and missed this bug because the 2-value BVA only tests 21; however, a 3-value BVA may be able to surface the issue because the value of 20 is tested.


This content originally appeared on DEV Community and was authored by Alan Liew


Print Share Comment Cite Upload Translate Updates
APA

Alan Liew | Sciencx (2024-07-15T06:13:30+00:00) How to create test cases using Equivalence Partitioning and Boundary Value Analysis test technique (Step by step). Retrieved from https://www.scien.cx/2024/07/15/how-to-create-test-cases-using-equivalence-partitioning-and-boundary-value-analysis-test-technique-step-by-step/

MLA
" » How to create test cases using Equivalence Partitioning and Boundary Value Analysis test technique (Step by step)." Alan Liew | Sciencx - Monday July 15, 2024, https://www.scien.cx/2024/07/15/how-to-create-test-cases-using-equivalence-partitioning-and-boundary-value-analysis-test-technique-step-by-step/
HARVARD
Alan Liew | Sciencx Monday July 15, 2024 » How to create test cases using Equivalence Partitioning and Boundary Value Analysis test technique (Step by step)., viewed ,<https://www.scien.cx/2024/07/15/how-to-create-test-cases-using-equivalence-partitioning-and-boundary-value-analysis-test-technique-step-by-step/>
VANCOUVER
Alan Liew | Sciencx - » How to create test cases using Equivalence Partitioning and Boundary Value Analysis test technique (Step by step). [Internet]. [Accessed ]. Available from: https://www.scien.cx/2024/07/15/how-to-create-test-cases-using-equivalence-partitioning-and-boundary-value-analysis-test-technique-step-by-step/
CHICAGO
" » How to create test cases using Equivalence Partitioning and Boundary Value Analysis test technique (Step by step)." Alan Liew | Sciencx - Accessed . https://www.scien.cx/2024/07/15/how-to-create-test-cases-using-equivalence-partitioning-and-boundary-value-analysis-test-technique-step-by-step/
IEEE
" » How to create test cases using Equivalence Partitioning and Boundary Value Analysis test technique (Step by step)." Alan Liew | Sciencx [Online]. Available: https://www.scien.cx/2024/07/15/how-to-create-test-cases-using-equivalence-partitioning-and-boundary-value-analysis-test-technique-step-by-step/. [Accessed: ]
rf:citation
» How to create test cases using Equivalence Partitioning and Boundary Value Analysis test technique (Step by step) | Alan Liew | Sciencx | https://www.scien.cx/2024/07/15/how-to-create-test-cases-using-equivalence-partitioning-and-boundary-value-analysis-test-technique-step-by-step/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.