Interactive Distribution -Equivalence partitioning

Tram Ho

1. Definition

Equivalence Partitioning technique is a method of dividing the input conditions into equal areas. All values ​​in an equivalent region will give the same output. Therefore, we can test a representative value in the equivalent region.

2. Classification of equivalence testing

Equivalence class testing is divided into several categories. Consider a general problem for a function of three variables a, b, c and the input space is three sets A, B, C. Assume that we have defined equivalent domains for each input space:

A = A1 ∪A2 ∪A3

B = B1 ∪B2 ∪B3 ∪B4

C = B1 ∪C2

We denote the elements of the above equivalent domain in lowercase with the same index in the following sections. For example a1 ∈ A1, b3 ∈ B3 and c2 ∈ C2.

2.1. Weak equivalence test

Weak equivalence test only requires each equivalent space with at least one element to appear in a test case. Suppose the program has input space of three variables A, B, C, and the equivalent domains for each input space are:

A = A_1∪ A_2∪ A_3

B = B_1∪ B_2∪ B_3∪ B_4

C = C_1∪ C_2

Then we need to have a value of A_1 in a test case (eg a_1∈A_1). And the same with other subsets. The minimum number of test cases is the largest number of equivalence classes of the input domain.

No.abc
firsta_1b_1c_1
2a_2b_2c_2
3a_3b_3c_1
4a_1b_4c_2

For example, on equivalence testing for selecting the start and end time of a meeting (Time is selected from the calender box). It is not allowed to create meeting schedule with the same time. We have the equivalent areas are:

Location = {A, B}

Start date = {Valid Nbd, Nbđ <X, Nbđ = Duplicate}

End date = {Nkt = valid | Nkt ≤Nbd | Nkt = Duplicate}

Where: X is the current day. Suppose X = 9/8

A is the venue for the meeting scheduled from August 15 to August 16

B is a place where no meetings have been scheduled yet.

No.Start dayEnd datePlaceResult
first8/88/11ACreate a successful meeting
28/88/11BThe start date is invalid
38/158/11AThe start date overlaps
48/114/8AEnd date is invalid
58/88/16AThe end date overlaps

2.2. Strong equivalence class test

Strong equivalence class testing will combine possible combinations of equivalent domains. Considering the assumption in section 2.1, here we will have 3 4 2 = 24 combinations, corresponding to 24 test cases as follows:

No.abc
firsta_1b_1c_1
2a_1b_1c_2
3a_1b_2c_1
4a_1b_2c_2
5a_1b_3c_1
6a_1b_3c_2
7a_1b_4c_1
8a_1b_4c_2
9a_2b_1c_1
tena_2b_1c_2
11a_2b_2c_1
twelftha_2b_2c_2
13a_2b_3c_1
14a_2b_3c_2
15a_2b_4c_1
16a_2b_4c_2
17a_3b_1c_1
18a_3b_1c_2
19a_3b_2c_1
20a_3b_2c_2
21a_3b_3c_1
22a_3b_3c_2
23a_3b_4c_1
24a_3b_4c_2

Here, we focus on the equivalent domains of the input variable. We can also apply this method to the output domain, but this is usually more difficult because we have to recalculate the set of test values ​​in the input domain to create the value in the desired output domain.

  • Consider the example in 2.1

Tests of the weak equivalence class are listed as in the following table:

No.Start dayEnd datePlaceExpected results
first8/88/11ACreate a successful meeting
28/88/16BCreate a successful meeting
38/158/9BFailed to create the meeting

We find that this method is weak because it only gives a few test cases that are not reliable enough for the program.

2.3. Simple equivalence test class

The equivalence class test simply divides a class of valid values ​​and an equivalent class of invalid values. Once equivalence classes are available in this simple way, the test strategy can be applied to strong and weak equivalence testing.

  • Consider the example in section 2.1

According to the strong equivalent method, we have 2 3 3 = 18 combinations. Corresponding to 18 test cases

But in 18 test cases, there were 2 2 2 = 8 test cases that were duplicated and unnecessary. We then got a table of 10 test cases:

No.Start dayEnd datePlaceResult
first8/88/11ACreate a successful meeting
28/88/11BCreate a successful meeting
38/84/8AEnd date is invalid
48/84/8BEnd date is invalid
58/88/16AEnd date is invalid
68/88/16BCreate a successful meeting
78/88/11AThe start date is invalid
88/88/11BThe start date is invalid
98/158/11AThe start date is a duplicate
ten8/158/16BCreate a successful meeting

3. Advantages and Disadvantages of the technique

3.1. Advantages

Because each equivalent region we only need to test on representative elements, the number of test cases is greatly reduced, so that the test time is also significantly reduced.

3.2. Defect

Not all problems can apply this technique. A border error may be omitted if only the value in the middle of the equivalent domain is selected. So when most of the errors are found when checking the values ​​at the boundary of the partitions, we should learn one more technique is to analyze the boundary value.

Share the news now

Source : Viblo