Detailed explanation of equivalence class division

one. Equivalence Class Partitioning

1. Definition of equivalence class division: Divide all input domains into several subsets, and select a small amount of representative data from each subset as test cases.

Can be divided into two equivalence classes: valid equivalence classes and invalid equivalence classes

Valid equivalence classes: data that fully satisfy the product specification, valid, meaningful set of input data

Invalid equivalence class: a set of input data that does not satisfy the program's input requirements or invalid input data

2. The division method of equivalence class:

1>. The input value specifies the value range or the number of input data, which can be divided into one valid equivalence class and two invalid equivalence classes;

eg: input student grades: 0~100, valid equivalence class is input value "0~100", invalid equivalence class is: input value>100 and input value<100

eg: specifies the sides of the input triangle, valid equivalence class: the number of input sides is 3

                                        Invalid equivalence class: number of input edges > 3 and number of input edges < 3

2>. When the input value has specified the "must be" condition, it can be divided into a valid equivalence class and an invalid equivalence class;

 eg: Enter the name of 'Zhang San', the valid equivalence class is: "Zhang San", the invalid equivalence class is: any character content of Fei Zhangsan

3>. When the input value is a Boolean condition, it can be divided into a valid equivalence class and an invalid equivalence class;

 eg: input value>10, valid equivalence class is: any number greater than 10, invalid equivalence class is: any number less than 10

4>. A set of n values ​​of input data is specified, and when the program processes each input value separately, n valid equivalence classes and one invalid equivalence class can be determined;

  eg: It is stipulated that the input subject conditions indicate that the academic qualifications can be one of the three types: master, undergraduate, and college. Then, these three values ​​are determined into 3 valid equivalence classes, and any academic qualifications other than these three academic qualifications are regarded as invalid equivalence classes.

5> In the case of specifying that the input data must comply with several rules, several valid equivalence classes can be confirmed (compliance with the rules) and several invalid equivalence classes (violating the rules from different angles)

eg: Email rules: must contain @, the format after @ is xy , and the address cannot contain symbols: #¥%

Valid equivalence classes: letters@xydigits      @xy

Invalid equivalence class: does not contain @, the format after @ is not xy   , contains special characters, ¥%

 

 

6> In the case of confirming that the elements in the divided equivalence class are processed differently in the program, the equivalence class can be divided into smaller equivalence classes

 eg: grades of students with passing grades, 80> grades> 60: average; 90> grades> 80: good;

100>Grade>90: Excellent;


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324415338&siteId=291194637