Region Based Regression Testing Using Path Vectors Huma

Region Based Regression Testing Using Path Vectors Huma Tahir M. E. (ISE), CSA Region Based Regression Testing Using Path Vectors

Outline ¢ Introduction ¢ Path Vectors ¢ Identifying Affected Def Use Associations ¢ Testing Region Based Regression Testing Using Path Vectors

Introduction Regression Testing : Process of validating modified parts of software. Selective Regression Testing : Identify and retest only those parts of the program that are affected by a change. Region Based Regression Testing Using Path Vectors

Introduction Two problems in selective regression testing : ¢ Identifying those existing tests that must be re run. ¢ Identifying those program components that must be retested. We address the second problem. Region Based Regression Testing Using Path Vectors

Path Vectors ¢ Path Vector : A bit vector in which each bit maps to a unique path in the CFG. ¢ The data dependences within a CFG is stored using two kinds of path vectors : l BPV (n) : Encodes all the paths that flow through block n. l DUPV (w, r, v) : Represents the set of control flow paths along which the value v is written by w and read by r. Region Based Regression Testing Using Path Vectors

Path Vectors – An Example Region Based Regression Testing Using Path Vectors

Path Vectors Based Approach ¢ Use path vector data structures to detect the affected def use associations. ¢ While constructing path vectors take each back edge once. Region Based Regression Testing Using Path Vectors

Affected Def Use Associations ¢ Directly Affected l ¢ due to insertion and/or deletion of definitions and uses. Indirectly Affected l due to change in either a computed value or a path condition. Region Based Regression Testing Using Path Vectors

Detecting Affected Def Use Associations – A Region Based Approach Region is defined as – ¢ ¢ Each node is a region. If there is a back edge, then the natural loop of the back edge is a region. Analyzing Regions – ¢ ¢ ¢ Determine Regions. Analyze regions hierarchically. l Construct BPV and DUPV for each region. l Replace inner region at each level by a node with summary information • defs, may defs, uses, BPV and DUPV Construct BPV and DUPV for the CFG. Region Based Regression Testing Using Path Vectors

Region Based Approach – An Example 1 (1, 1) 1 2 3 Y = --- X = --- 6 (1, 0) 2 Defs: (Y, 2) May defs: (X, 4) Uses: (Y, 5) BPV, DUPV 4 6 7 Defs: (Z, 7) May defs: Uses: BPV, DUPV 7 5 --- = Y Z=1 8 8 Region Based Regression Testing Using Path Vectors (0, 1) (1, 1) (0, 1)

Detecting Affected Def Use Associations – A Region Based Approach Reporting Modifications – ¢ Modifications stated in terms of the line numbers in the program ¢ Saves the user from tedious task of reporting modifications as insertions and deletions of defs and uses. Region Based Regression Testing Using Path Vectors

Detecting Affected Def Use Associations – A Region Based Approach Detecting Affected Def-Use Associations – ¢ Map the line numbers to the region which encloses them most tightly. ¢ Find effect of deletion of downward exposed definitions from that region. ¢ Recompute the control flow through the region as dictated by changes. ¢ Find the effect of insertion of upward exposed uses and downward exposed defs in the region. ¢ All the def use associations in the modified region also need to be tested. Region Based Regression Testing Using Path Vectors

Algorithms ¢ The Reaching. Def Algorithm l l l Backward Data Flow Analysis. Returns all the statements whose definitions reach a program point for a given variable. Input Output program point, pgmpoint and variable, var. set of statements “Defs. Of. Var” that contain the definitions of var and that reach the pgmpoint. If the current statement contains any use of var • all the definitions and may defsof that variable are paired with this use to check if their DUPV is not empty. • all the statements that contain these definitions and may defsare added to the set Defs. Of. Var. If the current statement defines var • add the particular statement to the set Defs. Of. Var. Region Based Regression Testing Using Path Vectors

Algorithms ¢ The Affected. Def. Use Algorithm l l Forward Data Flow Analysis. Returns all the def use associations that are influenced by a given set of definitions that are changed. l Input Output l Start with a program point, pgmpoint and variable, v pair from the given set. l all DU pairs of v whose definition is in pgmpoint and whose DUPV is not empty are added to the output set Triples. l All the program points of uses which were added to Triples are then processed to check for two conditions • If that program point defines or may defines any variable d a new pair consisting of that program point and the variable d is added to pairs. • If the use is a predicate use then it identifies all def use associations that are control dependent on this predicate. l set pairs set Triples Region Based Regression Testing Using Path Vectors

Algorithms for detecting affected def use associations ¢ Insert use of variable X in statement S l use Reaching. Def to find all the definitions of X that reach S. l If S is predicate node • locate all the def use associations that are control dependent on S. l If S defines a variable • use Affected. Def. Use to detect the def use associations affected by the change in the value of the variable defined in S. Region Based Regression Testing Using Path Vectors

Algorithms for detecting affected def use associations ¢ Delete l use of X in statement S If S is a predicate node • locate all the def use associations that are control dependent on S. l If S defines a variable • use Affected. Def. Use to detect the def use associations that are affected by the change in the value of the variable defined in S. Region Based Regression Testing Using Path Vectors

Algorithms for detecting affected def use associations ¢ Insert definition of X in statement S l ¢ use Affected. Def. Use to detect all the affected def use associations Delete definition of X in statement S l use Reaching. Def to get all the definitions of X that reach S. l use Affected. Def. Use to find the uses of X reachable from S and other def use associations that are dependent on these uses. Region Based Regression Testing Using Path Vectors

Testing Affected def use associations ¢ ¢ ¢ Use Reaching. Def algorithm to determine the validity of the def use associations. Discard invalid associations. Test the remaining def use associations. Techniques for Testing – ¢ Maintain a test suite that is used to retest the program. ¢ Generate tests only for the changed parts of the program. Region Based Regression Testing Using Path Vectors

Future Wok ¢ To extend the data flow analysis to include inter proceduralanalysis. Region Based Regression Testing Using Path Vectors

THANK YOU Region Based Regression Testing Using Path Vectors
- Slides: 20