Equivalence class
The so-called equivalence class refers to a disjoint subset of the input fields, and the set of all equivalence classes is the entire input domain. The goal is to test the non-redundancy of the use case.
Method of equivalence class partitioning
Common principles of equivalence class partitioning
(1) divided by interval
(2) divided by numerical value
(3) divided by numerical value set
(4) by restrictive conditions or rules
(5) Subdivision equivalence class
Design method of test case
(1) After the equivalence class is established, all the partitioned equivalence class tables can be listed.
(2) A unique number is specified for each equivalence class.
(3) Design a new test case so that it overwrites as many valid equivalence classes as they have not yet covered. Repeat this step until the test case overrides all valid equivalence classes.
(4) Design a new test case to overwrite and overwrite only one invalid equivalence class that has not yet been overwritten. Repeat this step until the test case overrides all invalid equivalence classes.
Only one invalid equivalence class is introduced at a time to prevent leakage, or an invalid equivalence class to block out or terminate other valid classes.
EditBox Problems in Example
The topics are as follows:
. EditBox
Allow 1 to 6 English characters or numbers, press OK to end
Valid equivalence classes:
Length: 1 to 6
Character: a-z,a-z,0-9
Invalid equivalence class
Length: 0,7
Characters: English/numeric characters, control characters, punctuation
The design is as follows:
Partitioning equivalence classes with input criteria
Condition One length from 1 to 6
condition Two characters belong to A-Z,A-z,0-9
Number |
Valid equivalence classes |
Number |
Invalid equivalence class |
1 |
1 to the 6 number |
5 |
less than 1 number |
2 |
characters belong to A- z |
6 |
Greater than 6 number |
3 |
characters belong to A- z |
7 |
Character contains control characters |
4 |
characters belong to 0-9 |
8 |
Characters contain punctuation |
Test cases for equivalence class partitioning
Number |
Case |
overriding equivalence classes |
Expected output |
1 |
Az0912 |
The |
Right |
2 |
az0912a |
2,3,6 |
Wrong |
3 |
|
5 |
Wrong |
4 |
Az091, |
1,2,3,8 |
Wrong |
5 |
DEL91, |
1,2,3,8,7 |
Wrong |
6 |
DEL910 |
1,2,3,7 |
Wrong |
7 |
111111 |
1,4 |
Right |
8 |
Aaaaaa |
The |
Right |
9 |
Aaaaaa |
1,3 |
Right |
Software testing: My classroom Thoughts "two" equivalence class division