Professional Documents
Culture Documents
3.3.3 Test Selection Using Execution Trace
3.3.3 Test Selection Using Execution Trace
Step 2: Extract test vectors from the execution traces for each node in the
CFG of P
Step 3: Construct syntax trees for each node in the CFGs of P and P’.
Step 4: Traverse the CFGs and determine the subset of T appropriate for
regression testing of P’.
STEP 1: EXECUTION TRACE
Let G=(N, E) denote the CFG of program P.
N is a finite set of nodes and E a finite set of edges connecting the nodes.
Suppose that nodes in N are numbered 1, 2, and so on and that Start and End are two
special nodes.
It is obtained by discarding all tests that have become obsolete for some reason.
STEP 1: EXECUTION TRACE (CONTD…)
An execution trace of program P for some test t in Tno is the sequence of
nodes in G traversed when P is executed against t.
The descent proceeds in parallel and the corresponding nodes are compared.
Try the SelectTests algorithm and check if you get T’={t1, t3}.
HANDLING CHANGES IN DECLARATIONS
The SelectTests algorithm selects modification-traversing tests for regression
testing.
Suppose that a simple change is made to variable declaration and that this
declaration occurs in the main function.
SelectTests will be unable to account for the change made simply because we
have not included declarations in the CFG.
HANDLING CHANGES IN DECLARATIONS (CONTD…)
One method to account for changes in declarations is to add a node
corresponding to the declarations in the CFG of a function.
Tests that traverse the declaration node will be included in T’ if the nodes are
found not equivalent.
HANDLING CHANGES IN DECLARATIONS (CONTD…)
The problem now is that any change in the declaration will force the
inclusion of all tests from T in T’.
This is obviously due to the fact that all tests traverse the node following the
Start node in the CFG for main.
HANDLING CHANGES IN DECLARATIONS: ANOTHER
APPROACH
Let declChangef be the set of all variables in function f whose declarations
have changed in f’.
This set can be computed by traversing the CFG of each function and analyzing the
syntax tree associated with each node.
Any variable used - not assigned to - in an expression at node n in the CFG of function f
is added to usef(n) .
Note that declChangef is empty when there has been no change in declarations of
variables in f.
Similarly, usef(n) is empty when node n in CFG(f) does not use any variable, for example
in statement x = 0
HANDLING CHANGES IN DECLARATIONS: ANOTHER
APPROACH (CONTD…)
Procedure SelectTestsMainDecl is a modified version of procedure
SelectTestsMain.
We can easily trace CFG( P ) for each test case to find the test vectors.
HANDLING CHANGES IN DECLARATIONS: ANOTHER
APPROACH (EXAMPLE)
Step 1 in procedure SelectTestsDecl proceeds as follows: