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

Programmer base 2021-10-14 04:33:44

The third chapter Black box testing

Equivalence class division

1. Divide equivalence class : Divide a large number of input cases into several equivalent classes
If you test with an input condition in the set as test data, you can't find the error in the program , Then testing with other input conditions in the set is unlikely to find errors

Effective equivalence class vs Invalid equivalence class
An effective equivalence class can be a , It can be more than one
(1) If the input condition specifies the value range or the number of values , Then one valid equivalence class and two invalid equivalence classes can be determined .
(2) The input condition specifies the set of input values , Or it stipulates “ How to ” Conditions , Then an effective equivalence class and an invalid equivalence class can be determined .
(3) If we know for sure , 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 .
Invalid equivalence class is at least one , There may be more than one

2. Identify test cases

Eg: Some procedure stipulates that : Enter three integers as the length of the three sides to form a triangle , When this triangle is a general triangle 、 Isosceles triangle and equilateral triangle , Calculate separately ……. Try the equivalence class division method to design test cases for the triangular part of the program .

(1) List the equivalence classes :
 Insert picture description here
 Insert picture description here
(2) List the test cases that cover the above equivalent classes
 Insert picture description here
(3) List test cases that override invalid equivalence classes
 Insert picture description here

Cause and effect diagram

1. Steps for exporting test cases : Analyze the causes and results -> Draw a cause and effect diagram ( Indicate constraints )-> Convert to decision table -> Write test cases

2. Causal relationship
Basic symbols of causality :
 Insert picture description here
(1) Identity : if c1 yes 1, be e1 It's also 1; otherwise e1 by 0
(2) Not : if c1 yes 1, be e1 yes 0; otherwise e1 yes 1
(3) or : if c1 or c2 or c3 yes 1, be e1 yes 1; otherwise e1 by 0.“ or ” There can be any number of inputs
(4) And : if c1 and c2 All are 1, be e1 by 1; otherwise e1 by 0.“ And ” You can also have any number of inputs

3. Constraints on input and output conditions
Constraint symbols :
 Insert picture description here
Enter the constraint of the condition :
(1)E constraint ( different ):a and b At most one of them may be 1, namely a and b You can't do it at the same time 1
(2)I constraint ( or ):a、b and c At least one of them has to be 1, namely a、b and c You can't do it at the same time 0
(3)O constraint ( only ):a and b There has to be one , And only 1 A for 1
(4)R constraint ( requirement ):a yes 1 when ,b Must be 1, That is, it is impossible a yes 1 when b yes 0
Constraints on output conditions :
M constraint ( mandatory ): If it turns out a yes 1, Then the result b Force to 0

Eg: A software specification contains such requirements : The first column of characters must be A perhaps B, The second column of characters must be a number , In this case, modify the file , But if 1 Incorrect column characters , Then give the information L; If the first 2 Column characters are not numbers , Then give the information M.

reason :
1: The first column of characters is A;
2: The first column of characters is B;
3: The characters in the second column are numbers ;
result :
21: Make changes to the document ;
22: Give information L;
23: Give information M.

 Insert picture description here

 Insert picture description here

Boundary value analysis

1. Selection of univariate boundary value

Five point method vs Seven point method
Five point method : Select the maximum value 、 Slightly below the maximum 、 Normal value 、 Slightly above the minimum 、 minimum value
Seven point method : Select slightly greater than the maximum value 、 Maximum 、 Slightly below the maximum 、 Normal value 、 Slightly above the minimum 、 minimum value 、 Slightly below the minimum
The weak boundary value is calculated by the five point method , The strong analysis method uses the seven point method

2. Selection of boundary value in the case of multivariable combination
about n Variable function , Make all variables except one take normal values , Apply the five point method to the remaining variable ( Or seven point method ) Minimum value 、 Slightly above the minimum 、 Normal value 、 Slightly below the maximum 、 Maximum , Repeat for each variable .

A functional test

1. Systematization of functional testing
(1) Numeric simple variable
(2) Array 、 Vector variable
(3) Multidimensional arrays
A composite component of a multidimensional array satisfies a certain canonical structure . At this time , We should take this composite component as the basic test data generation unit

2. Decomposition test of module function ( Functional testing of sub functions )
 Insert picture description here
(1) Parallel subfunctions
 Insert picture description here
(2) Sequential subfunction
 Insert picture description here
(3) Control subfunction ( It is often used to select calculation functions or terminate loops and recursive processes )
 Insert picture description here

Chapter four White box testing

Logical coverage

1. Several common logic coverage test methods
Statement override : When testing , First, several test cases are designed , Then run the program under test , Make each executable statement in the program execute at least once
 Insert picture description here
The test case :
A=2,B=0,X=3 Path is ace, Statement coverage is reached
A=2,B=1,X=3 Path is abe, Failed to reach statement override

Determine coverage : So that the true branch and false branch of each judgment in the program go through at least once , That is, the true and false values of judgment have been satisfied .
The test case :
Reach decision coverage

Conditional coverage : The possible value of each condition in each judgment shall be satisfied at least once
T2: B=0
T3: A=2
T4: X>1
 Insert picture description here
3 A test case puts 4 Conditional 8 Both cases are covered . However, satisfying the conditional coverage does not necessarily satisfy the decision coverage .

determine - Conditional coverage : Make all possible occurrences of each condition in the judgment occur at least once , And the judgment result of each judgment itself appears at least once
 Insert picture description here
Both satisfy the decision coverage ( covers 4 Branches bcde), And satisfy the conditional coverage ( covers 8 In this case ), But one path is missing acd

Path coverage : It is required to cover all possible paths in the program
 Insert picture description here

Path analysis

Testing that focuses on path analysis can be called path testing , The ideal situation to complete the path test is to do Path coverage .

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

Introduce two operations : Multiply and add
ride : arc a And arc b Multiply , The product is ab, It means first along the arc a Then along the arc b The road section experienced
Add : arc a And arc b Add up , And a + b Indicates that two arcs are or , It's a parallel section

 Insert picture description here
chart (a) The path expression for is :e(a + b)(c + d)f
chart (b) The path expression for is :a(b+c)d

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

V: Complexity
E: Number of edges
N: Number of nodes ( The judgment box is also a node )

 Insert picture description here
3. Calculate the number of independent paths
Independent path : The independent path of a program is multiple executions from the program entry to the exit , At least one statement at a time ( Including computing 、 assignment 、 Input / output or judgment ) It's new

 Insert picture description here
 Insert picture description here

Tree representation of program path and path coding

1. route “ And / or ” Trees and their characteristics
 Insert picture description here
2. Simplify the tree
AND There are... Under the node AND node (a)
OR There are... Under the node OR node (c)
 Insert picture description here
AND A node has a child node that is a leaf node A,A Adjacent nodes are also leaf nodes (a)
AND A node has a child node that is a leaf node A,A Adjacent nodes are OR node (b)
AND A node has a child node that is a leaf node A,A Adjacent nodes are AND node (c)

 Insert picture description here
3. Path coding
 Insert picture description here
The coding of any path is all the experience of traversing each leaf node of the path from the root node and then returning to the root node OR The sequence of node out coding
 Insert picture description here

Program instrumentation

Program instrumentation : It is a basic test method , It is widely used in software testing . In short, it is a method to achieve the purpose of testing by inserting operations into the program under test , By using for troubleshooting .


Assertions : Sometimes some statements used to judge the characteristics of variables are inserted into a specific part of the program , These statements can be verified during program execution , Thus, the running characteristics of the program are confirmed , We call these inserted statements assertions

Program variation

Error driven testing : It means that the method is for a specific type of program error

Program strong variation
Strong program variation means that for every element in the test data set , To the program P And its variation factors , Therefore, it is required to test the data set D And variation factor set m(P) All need to be carefully selected . This is the key to the success of strong mutation method .

m(P) It's right P With minor changes , It's also a program , be called P Variation factor of
hypothesis P There are test data sets D, if P stay D That's right , You can find out P A set of variation factors
M={M( P)|M( P) yes P Variation factor of }.

if M Each element in D There are errors in , It is considered that the procedure is more correct .
if M Some elements in D There are no errors on , There are three possible situations :
(1) These variation factors are related to P It's functionally equivalent ;
(2) The existing test data are not enough to find P The difference between its variation factors ;
(3)P May contain errors , And some of its variation factors are correct ;

Strong variation has two weaknesses : One is to run all the variation factors , And multiply Increases the cost of testing ; The second is to determine whether the program is equivalent to its variation factor Recursive unsolvable problem

Program weak variation
The difference from strong variation is : Strong variation is the factor that produces the actual variation , Weak variation does not produce , Instead of just selecting test data , Make the program components produce different values before and after variation .

The fifth chapter 、 Chapter VI review summary

Please bring the original link to reprint ,thank
Similar articles