First, the test case design method of black-box testing
Method of dividing equivalence classes
boundary value analysis
Wrong speculation method
Causality diagram method
Decision table-driven analysis method
Orthogonal experimental design method
Functional diagram analysis method
Use case design
Test case design method for black box testing
At present, there are five test case design methods for black box testing:
1. equivalence class division
2. Boundary value analysis
3. Wrong speculation method
4. Causality diagram
5. Logic diagram
First, the division of equivalence classes
The design method of equivalent column partition is to divide all possible input data, that is, the input field of the program into several parts (subsets), and then select a small amount of representative data from each subset as test cases.
An equivalence class is a subset of the input fields. In this subset, each input data is equivalent to exposing errors in the program. It is reasonable to assume that testing the representative value of an equivalent class is equivalent to testing other values of this class.
There are two different types of equivalence classes: valid equivalence classes and invalid equivalence classes. These two equivalence classes should be considered in the design.
Here are six principles for determining equivalence classes:
1. If the input condition specifies the range of values or the number of values, one valid equivalence class and two invalid equivalence classes can be established.
2. Under the condition that the input condition specifies the set of input values or "what must be done", valid equivalence classes and invalid equivalence classes can be established.
3. If the input condition is a Boolean quantity, you can establish valid equivalence classes and invalid equivalence classes.
4. Under the condition that a set of values of input data are specified (assuming n) and the program must deal with each input value separately, n valid equivalence classes and one invalid equivalence class can be established.
5. Under the condition that the input data must abide by the rules, one valid equivalence class (conforming to the rules) and several invalid equivalence classes (violating the rules from different angles) can be established.
6. If it is known that each element in the divided equivalence class has different ways in program processing, then the equivalence class should be further divided into smaller equivalence classes.
After establishing equivalence classes, an equivalence class table can be established to list all the divided equivalence classes. And then from
In the equivalence class, test cases are designed according to the following three principles:
Assign a unique number to each equivalence class.
Design a new test case, covering as many effective equivalence classes as possible, and repeat this step until all effective equivalence classes are covered.
Design a new test case, covering only one uncovered invalid equivalent class, and repeat this step until all the invalid equivalent classes are covered.
For example: procedural provisions; Enter three integers as the side lengths of three sides to form a triangle. When this triangle is a general triangle, an isosceles triangle and an equilateral triangle, it is calculated separately. Design test cases for this program by the method of equivalence class division.
Solution: Let A, B and C represent three sides of a triangle respectively.
1) Requirements for given and implied input conditions in the analysis topic:
A) integers
B) 3 numbers
C) non-zero number
D) positive number
E) The sum of two sides is greater than the third side.
F) isosceles
G) equilateral
2) List the equivalent classes and number them.
3) List the test cases covering the above equivalent classes, as shown in the following table:
Second, boundary value analysis method
To design test cases by using boundary value analysis, we must first determine the boundary conditions. Usually, the boundary between input and output equivalence classes is the boundary that should be tested emphatically. Secondly, we should choose the value just equal to, just greater than or just less than the boundary as the test data, instead of choosing the typical value or arbitrary value in the equivalence class as the test data.
Principles of test case selection based on boundary value analysis;
1. If the input condition specifies a range of values, the boundary values just reaching the range and the values just beyond the range should be used as test input data.
2. If the input conditions specify the number of numerical values, the maximum number, the minimum number, the number less than the minimum number and the number greater than the maximum number shall be used as test input data.
3. According to each output condition specified in the specification, use the previous principle of 1.
4. According to each output condition in the specification, use the previous principle 2.
5. If the input field or output field given in the program specification is an ordered set, the first element and the last element of the set should be selected as test case data.
6. If an internal data structure is used in the program, the value on the boundary of this internal data structure should be selected as the test case.
7. Analyze the specifications and find out other possible boundary conditions.
Third, the wrong speculation method.
Error inference method is a method to infer all possible errors in the program according to experience and intuition, so as to design test cases in a targeted manner.
Basic idea: list all possible errors and special cases that are prone to errors in the program, and select test cases accordingly. For example, both input data and output data are 0.
There is a program for students to grade in standardized exams and generate score reports. The explanation is as follows: The input file of the program consists of some 80-character records, all of which are divided into three groups, as shown in the following figure:
1. Title: There is only one record in the reorganization, and its content is the name of the performance report.
2. Standard answer to each question: Each record is marked with the number 2 at the 80th character. Records of this group:
The first record: 1~3 is the test number (1~999). The characters 10~59 are the standard answers to the question 1~50 (each legal character represents an answer).
The second record is the standard answer to question 5 1~ 100.
…….
3. Students answer: Each record is marked with the number 3 at the 80th character. Each student's answer sheet has several records.
Student ID: 1~9 characters
The answer to the question 1~50: 10~59. When it is greater than 50 questions, it will be given in the second and third questions.
The number of students shall not exceed 200, and the number of test questions shall not exceed 999.
The output of this program has four reports:
A) Transcripts arranged by student number, listing the scores and rankings of each student.
B) Transcripts sorted by students' grades.
C) average score and standard deviation report
D) test analysis report. According to the number of questions, list the percentage of students who answered each question correctly.
Solution 1: Use boundary value analysis method to analyze and design test cases. Input conditions, output conditions and boundary conditions are considered respectively. The following table lists the input conditions and corresponding test cases.
The following table shows the output conditions and corresponding test cases.
Solution 2: Using the wrong guess method can also supplement the design of some test cases:
1. Does the program answer in spaces?
2. Answer records are mixed with standard answer records.
3. Except for the title record, the last character of some records is neither 2 nor 3.
There are two students with the same student number.
5. The number of questions is negative.
Fourth, the causal diagram
Causality diagram is a test case design method, which is suitable for describing the combination of multiple conditions and the corresponding forms of multiple actions.
Basic steps of generating test cases by using causality diagram:
1. Analyze which software specifications are causes and which are results, and assign an identifier to each cause and result.
2. Analyze the semantics of software specification. Find out the relationship between cause and effect, cause and cause, and draw a causal diagram according to these relationships.
3. Use some markers on the causality diagram to indicate constraints or restrictions.
4. Convert the causality diagram into a decision table.
5. Take out every column of the judgment table as the basis and design the test case.
Example: The first column character must be a or b, and the second column character must be a number. In this case, the file is modified, but if the characters in the first column are incorrect, the information l is given; If the characters in the second column are not numbers, the information m is given.
Solve 1 and draw a causal table and a causal diagram.
2. Establish a judgment table according to the causality diagram.
According to various combinations of conditions, corresponding actions are generated. Reason 1 and reason 2 cannot be established at the same time, so this situation can be ruled out.
Test cases can be designed from the decision table: 6 test cases are necessary data.
/softtest/skills/729536.html