Black box test case design method-equivalence class division method

Purpose of sharing: The black box test case design method is very common in written examinations or work, and the equivalence class division method is the most commonly used.

1. The concept of equivalence class division method

Divide all possible input data, that is, the input domain of the program into several parts (subsets), and then select a few representative data from each subset as test cases. In this sub-collection, all input data is equivalent for exposing errors in the software.

The equivalence class can be divided into two different situations: valid equivalence class and invalid equivalence class.

2. Scenarios used by the equivalence class division method

1) The situation where the value range or the number of values ​​is specified; for example, the red envelope range is 0.01-200

2) Specify the set of input values ​​or specify "how it must be"; for example, the recharge amount must be an integer

3) In the case of true and false, a valid equivalence class and an invalid equivalence class can be determined;

4) A set of values ​​(assuming n) of the input data is specified, and when the program needs to process each input value separately, n valid equivalence classes and one invalid equivalence class can be established; for example, gender input can only It is male or female, except for male and female is an invalid equivalence class

5) In the case of stipulating the rules that must be followed by the input data, a valid equivalence class (conforming to the rules) and several invalid equivalence classes (violating the rules from different angles) can be established; common user name and password rules

6) In the case that it is known that each element in the equivalence class has been divided in different ways in the program processing, the equivalence class should be further divided into smaller equivalence classes; for example, the evaluation grade of school students In the system, the entry of scores of 1-100 is effective, but the system program will judge different grades according to the entered scores, for example, 0-59 is failing, 90-100 is excellent; that will further divide the equivalence category

3. Steps for applying equivalence class division method to use case design

1) Specify a unique number for each equivalence class;

2) Design a new test case to cover as many effective equivalence classes as possible that have not been covered, and repeat this step until all valid equivalence classes are covered;

3) Design a new test case to cover only an invalid equivalence class that has not been covered, and repeat this step until all invalid equivalence classes are covered

4. Case sharing

The following takes the registered password setting of Sina Weibo as an example

Black box test case design method-equivalence class division method

Setting rules: 6-16 digits, letters, and common symbols combination, letters are case sensitive

1) Divide equivalence classes, list each valid equivalence class and invalid equivalence class, and specify a unique number for each equivalence class

Black box test case design method-equivalence class division method

2) Design test cases to cover as many effective equivalence classes as possible that have not been covered, and repeat this step until all valid equivalence classes are covered; the length is chosen to cover the boundary value.

Black box test case design method-equivalence class division method

3) Design a new test case so that it only covers an invalid equivalence class that has not been covered. Repeat this step until all invalid equivalence classes are covered. The length is chosen to cover the boundary value.

Black box test case design method-equivalence class division method

 


Above are some videos and interview questions I collected.

For software testing friends, it should be the most comprehensive and complete interview preparation warehouse. In order to better organize each module, I also refer to many high-quality blog posts and projects on the Internet, and strive not to miss every knowledge point. Friends relied on these contents to review, and got offers from big factories such as BATJ. This warehouse has also helped many software test learners, and I hope it can also help you.

Follow my WeChat public account [Programmer Erhei] Get it for free
 

Guess you like

Origin blog.csdn.net/m0_52668874/article/details/114988108