White box test design techniques use the following code coverage techniques. Data flow testing in white box testingData flow testing is used to analyze the flow of data in the program. It is the process of collecting information about how the variables flow the data in the program. It tries to obtain particular information of each particular point in the process. Data flow testing is a group of testing strategies to examine the control flow of programs in order to explore the sequence of variables according to the sequence of events. It mainly focuses on the points at which values assigned to the variables and the point at which these values are used by concentrating on both points, data flow can be tested. Data flow testing uses the control flow graph to detect illogical things that can interrupt the flow of data. Anomalies in the flow of data are detected at the time of associations between values and variables due to:
Let's understand this with an example: In this code, we have a total 8 statements, and we will choose a path which covers all the 8 statements. As it is evident in the code, we cannot cover all the statements in a single path because if statement 2 is true then statements 4, 5, 6, 7 not covered, and if statement 4 is true then statement 2 and 3 are not covered. So, we are taking two paths to cover all the statements. 1. x= 1 Path  1, 2, 3, 8 Output = 2 When we set value of x as 1 first it come on step 1 to read and assign the value of x (we took 1 in path) then come on statement 2 (x>0 (we took 2 in path)) which is true and it comes on statement 3 (a= x+1 (we took 3 in path)) at last it comes on statement 8 to print the value of x (output is 2). For the second path, we take the value of x is 1 2. Set x= 1 Path = 1, 2, 4, 5, 6, 5, 6, 5, 7, 8 Output = 2 When we set the value of x as ?1 then first, it comes on step 1 to read and assign the value of x (we took 1 in the path) then come on step number 2 which is false because x is not greater than 0 (x>0 and their x=1). Due to false condition, it will not come on statement 3 and directly jump on statement 4 (we took 4 in path) and 4 is true (x<=0 and their x is less than 0) then come on statement 5 (x<1 (we took 5 in path)) which is also true so it will come on statement 6 (x=x+1 (we took 6 in path)) and here x is incremented by 1. So, x=1+1 x=0 There is value of x become 0. Now it goes to statement 5(x<1 (we took 5 in path)) with value 0 and 0 is less than 1 so, it is true. Come on statement 6 (x=x+1 (we took 6 in path)) x=x+1 x= 0+1 x=1 There x has become 1 and again goes to statement 5 (x<1 (we took 5 in path)) and now 1 is not less than 1 so, condition is false and it will come to else part means statement 7 (a=x+1 where the value of x is 1) and assign the value to a (a=2). At last, it come on statement 8 and print the value (Output is 2). Make associations for the code: AssociationsIn associations we list down all the definitions with all of its uses. (1, (2, f), x), (1, (2, t), x), (1, 3, x), (1, (4, t), x), (1, (4, f), x), (1, (5, t), x), (1, (5, f), x), (1, 6, x), (1, 7, x), (6,(5, f)x), (6,(5,t)x), (6, 6, x), (3, 8, a), (7, 8, a). How to make associations in data flow testing <link>
Definition, cuse, puse, cuse some puse coverage, puse some cuse coverage in data flow testing <link>The next task is to group all the associations in Definition, cuse, puse, cuse some puse coverage, puse some cuse coverage categories. See the code below: So, these are the all association which contain definition, Predicate use (puse), Computation use (cuse) (1, (2, f), x), (1, (2, t), x), (1, 3, x), (1, (4, t), x), (1, (4, f), x), (1, (5, t), x), (1, (5, f), x), (1, 6, x), (1, 7, x), (6,(5, f)x), (6,(5,t)x), (6, 6, x), (3, 8, a), (7, 8, a), (3, 8, a), (7, 8, a) DefinitionDefinition of a variable is the occurrence of a variable when the value is bound to the variable. In the above code, the value gets bound in the first statement and then start to flow.
All definitions coverage (1, (2, f), x), (6, (5, f) x), (3, 8, a), (7, 8, a). Predicate use (puse)If the value of a variable is used to decide an execution path is considered as predicate use (puse). In control flow statements there are two Statement 4 if (x<=0) is predicate use because it can be predicate as true or false. If it is true then if (x<1),6x=x+1; execution path will be executed otherwise, else path will be executed. Computation use (cuse)If the value of a variable is used to compute a value for output or for defining another variable. Statement 3 a= x+1 (1, 3, x) These are Computation use because the value of x is used to compute and value of a is used for output. All cuse coverage (1, 3, x), (1, 6, x), (1, 7, x), (6, 6, x), (6, 7, x), (3, 8, a), (7, 8, a). All cuse some puse coverage (1, 3, x), (1, 6, x), (1, 7, x), (6, 6, x), (6, 7, x), (3, 8, a), (7, 8, a). All puse some cuse coverage (1, (2, f), x), (1, (2, t), x), (1, (4, t), x), (1, (4, f), x), (1, (5, t), x), (1, (5, f), x), (6, (5, f), x), (6, (5, t), x), (3, 8, a), (7, 8, a). After collecting these groups, (By examining every point where the variable used or not used at least once) tester can see all statements and variables are used or not. The statements and variables which are not used but exist in the code, get eliminated from the code.
Next TopicControl flow Testing
