1. Principle of equivalence class division method
- Divide the input domain of the program into several parts, and then select a small number as test cases
- The representative data of each class is equivalent to other values in this class in the test. If one example in a certain class finds an error, other examples in this equivalence class can also find the same error .
- Conversely, if one instance of a class finds no errors, other instances of that class will not find errors either.
2. Principles for determining equivalence classes
- When the input conditions specify the value range or the number of values, one valid equivalence class and two invalid equivalence classes can be established
- For example, account input only supports 6-18 digits
- 1 valid equivalence class: range 6-18
- 1 invalid equivalence class: <6 bits; >18 bits
- For example, account input only supports 6-18 digits
- In cases where input conditions specify a set of input values or specify a "must be" condition,
a valid equivalence class and an invalid equivalence class can be established- For example: Please enter the 11-digit mobile phone number
- 1 valid equivalence class: 11-digit mobile phone number
- 1 invalid equivalence class: non-11-digit mobile phone number
- For example: Please enter the 11-digit mobile phone number
- In the case where the input condition is a Boolean quantity, one valid equivalence class and one invalid equivalence class can be determined
- 1 valid class: true
- 1 invalid class: false
- In the case where a set of values of input data (assumed to be n) is specified, and the program is to deal with each input value separately,
n valid equivalence classes and one invalid equivalence class can be established- For example: ask to enter the account number and password
- n effective equivalents: n account numbers and passwords that meet the rules
- 1 invalid equivalent: account password that does not meet the rules
- For example: ask to enter the account number and password
- In the case where the rules that the input data must comply with are specified, one valid equivalence class (conforming to the rules) and several
invalid equivalence classes (violating the rules from different angles) can be established- For example: the username is 6~8 digits, composed of letters and underscores; letters are case-sensitive; the username starts with a letter
- 1 valid equivalence: username matching the rule
- n invalid equivalence: different angles violate the rules
- For example: the username is 6~8 digits, composed of letters and underscores; letters are case-sensitive; the username starts with a letter
If it is known that in the equivalence class that has been divided, each element is processed in a different way in the program, then the equivalence
class should be further divided into smaller equivalence classes