Review knowledge points at the end of software testing (Chapter 3, Chapter 4)

Chapter 3 Black Box Testing

Equivalence class division

1. Divide the equivalence class: divide the extremely large number of input conditions into several equivalence classes.
If you use one of the input conditions in the set as the test data to test and can not find the error in the program, then use other input conditions in the set to proceed Tests can not find errors

Effective equivalence class vs invalid equivalence class
Effective equivalence class can be one or more than one
(1) If the input condition specifies the value range or the number of values, one valid equivalence class and two invalid equivalence classes can be determined Equivalent class.
(2) The input condition stipulates the set of input values, or stipulates the condition of "how to", then a valid equivalence class and an invalid equivalence class can be determined.
(3) If we know for sure that each element in the divided equivalence class is handled differently in the program, then this equivalence class should be further divided into smaller equivalence classes.
There is at least one invalid equivalence class, and there may be more than one

2. Determine the test case

Eg: A program stipulates: Enter three integers as the side lengths of the three sides to form a triangle. When the triangle is a general triangle, an isosceles triangle, or an equilateral triangle, do calculations separately... Try the equivalence class division method to design test cases for the triangular part of the program.

(1) List the equivalence class table:
Insert picture description here
Insert picture description here
(2) List the test cases covering the above equivalence classes
Insert picture description here
(3) List the test cases covering invalid equivalence classes
Insert picture description here

Cause and effect diagram

1. Steps to derive test cases : Analyze the reasons and results -> draw a cause and effect diagram (indicating constraints) -> convert to a judgment table -> write test cases

2. Causality
The basic symbols of causality:
Insert picture description here
(1) Identity: if c1 is 1, then e1 is also 1; otherwise e1 is 0
(2) No: if c1 is 1, then e1 is 0; otherwise e1 is 1
( 3) Or: if c1 or c2 or c3 is 1, then e1 is 1; otherwise, e1 is 0. "Or" can have any number of inputs
(4) and: If both c1 and c2 are 1, then e1 is 1; otherwise, e1 is 0. "And" can also have any number of inputs

3. Constraints on input and output conditions
Constraint symbols: constraints on
Insert picture description here
input conditions:
(1) E constraint (exclusive): at most one of a and b may be 1, that is, a and b cannot be 1 at the same time
(2) I constraint ( Or): at least one of a, b, and c must be 1, that is, a, b, and c cannot be 0 at the same time
(3) O constraint (unique): a and b must have one, and only 1 is 1
( 4) R constraint (required): when a is 1, b must be 1, that is, it is not possible when a is 1, b is 0.
Output condition constraint:
M constraint (mandatory): if the result a is 1, the result b is forced to 0

Eg: The specification of a certain software contains such requirements: the first column of characters must be A or B, and the second column of characters must be a number. In this case, modify the file, but if the first column of characters is incorrect, Information L is given; if the character in column 2 is not a number, information M is given.

Reasons:
1: The characters in the first column are A;
2: The characters in the first column are B;
3: The characters in the second column are numbers;
Result:
21: Modify the file;
22: Give information L;
23: Give information M.

Insert picture description here

Insert picture description here

Boundary value analysis

1. Selection of single variable boundary value

Five-point method vs seven-point method
Five-point method: select the maximum value, slightly lower than the maximum value, normal value, slightly higher than the minimum value, and minimum value
Seven-point method: select slightly larger than the maximum value, maximum value, slightly lower than the maximum value , Normal value, slightly higher than the minimum value, minimum value, slightly lower than the minimum
value. Use the five-point method for weak boundary value, and use the seven-point method for strong analysis method.

2. Selection of boundary value in the case of multi-variable combination
For the n-variable function, make all variables except one take normal values, and apply the five-point method (or seven-point method) to the remaining variable to take the minimum value, which is slightly higher than the minimum Value, normal value, slightly lower than maximum value, maximum value, repeat for each variable.

function test

1. Systematization of functional testing
(1) Digital simple variables
(2) Arrays and vector variables
(3)
Multidimensional arrays A certain composite component of a multidimensional array satisfies a certain standard structure. At this time, we should use this composite component as the basic test data generation unit

2. Decomposition test of module functions (functional test of sub-functions)
Insert picture description here
(1) Parallel sub-functions
Insert picture description here
(2) Sequential sub-functions
Insert picture description here
(3) Control sub-functions (usually used to select calculation functions or terminate loop and recursive processes)
Insert picture description here

Chapter 4 White Box Testing

Logical coverage

1. Several commonly used logic coverage test methods
Statement coverage : When testing, first design a number of test cases, and then run the program under test so that each executable statement in the program is executed at least once.
Eg:
Insert picture description here
Test case:
A=2, B=0,X=3 The path is ace, the statement coverage is reached
A=2,B=1,X=3 The path is abe, the statement coverage is not reached

Judgment coverage : Make each judgment true branch and false branch in the program go through at least once, that is, both the true and false values ​​of the judgment have been satisfied.
Test case:
A=2, B=0, X=3
A=1, B=1, X=1
to reach judgment coverage

Condition coverage : make the possible value of each condition in each judgment meet at least once
T1: A>1
T2: B=0
T3: A=2
T4: X>1
Insert picture description here
3 test cases, 8 types of 4 conditions The situation is covered. But satisfying condition coverage does not necessarily satisfy judgment coverage.

Judgment-condition coverage : make all the possible occurrences of each condition in the judgment occur at least once, and the judgment result of each judgment itself also appears at least once
Insert picture description here
to satisfy both the judgment coverage (covering 4 branches bcde) and the condition coverage (covering 8 cases), but one path acd is missing

Path coverage : require coverage of all possible paths in the program
Insert picture description here

Path analysis

The test that focuses on path analysis can be called path testing. The ideal situation for completing path testing is to achieve path coverage .

1. Program path expression
(1) The arc sequence representation and node sequence representation of the
Insert picture description here
Insert picture description here
path (2) Path expression

Introduce two operations: multiplication and addition.
Multiplication: multiply arc a and arc b, and the resulting product is ab, which means to
add along arc a and then along arc b : add arc a and arc b, and the sum a + b represents the relationship between the two arcs and is a parallel section

Insert picture description here
The path expression of Figure (a) is: e(a + b)(c + d)f
The path expression of Figure (b) is: ab(1+cb+(cb)2+…)d

2. Calculation of the number of paths in the
program (1) Calculation of program complexity

V=E-N+2
V: complexity
E: number of sides
N: number of nodes (the judgment box is also counted as nodes)

Insert picture description here
3. Calculate the number of
independent paths Independent path: The independent path of a program is executed multiple times from the program entry to the exit, and each time at least one statement (including operation, assignment, input and output or judgment) is new

Insert picture description here
Insert picture description here

Tree representation and path coding of program path

1. Path "and/or" tree and its characteristics
Insert picture description here
2. Simplified path tree with
AND node under AND node (a)
OR node under OR node (c)
Insert picture description here
AND node has a child node that is a leaf node A, A adjacent node is also a leaf node (a)
AND node has one child node is leaf node A, A adjacent node is OR node (b)
AND node has one child node is leaf node A, A adjacent node is AND node (c)

Insert picture description here
3. Path coding The coding of
Insert picture description here
any path is the sequence of the output codes of all OR nodes experienced by starting from the root node and traversing each leaf node of the path and then returning to the root node.
Insert picture description here

Program instrumentation

Program instrumentation: It is a basic testing method and is widely used in software testing. Simply put, it is a method to achieve the purpose of testing by inserting operations into the program under test, and through debugging.

Assert statement

Assertion statements: sometimes insert certain statements to determine the characteristics of variables in a specific part of the program, so that these statements can be verified during program execution, so that the operating characteristics of the program can be verified. We call these inserted statements as assertions

Program mutation

Error-driven testing: refers to the method is for a certain type of specific program error

Strong program variation
. Strong program variation means that program P and its variation factor must be tested for each element in the test data set. Therefore, the test data set D and the variation factor set m(P) are required to be carefully selected. This is the key to the success of the strong mutation method.

m(P) is obtained by making small changes to P. It is also a procedure. The variation factor called P
assumes that P has a test data set D. If P is correct on D, one of the variation factors of P can be found Set
M={M(P)|M(P) is the variation factor of P}.

If every element in M ​​has errors on D, the program is considered to be more correct.
If there are no errors in D for some elements in M, there may be three situations:
(1) These variation factors are functionally equivalent to P;
(2) The existing test data is not enough to find out P and P The difference between the variation factors;
(3) P may contain errors, but some of its variation factors are correct;

There are two major weaknesses of strong mutation: one is to run all mutation factors, which doubles the cost of testing ; the other is to determine whether the program and its mutation factor are equivalent is a recursive and unsolvable problem


The difference between program weak mutation and strong mutation is that strong mutation produces actual mutation factors, while weak mutation does not occur, but only selects test data so that program components before and after mutation produce different values.

Chapter 5 and Chapter 6 Review Summary

Guess you like

Origin blog.csdn.net/qq_41890041/article/details/109712254