Regression Test Selection for Aspect J Software Guoqing
- Slides: 26
Regression Test Selection for Aspect. J Software Guoqing Xu and Atanas Rountev Ohio State University ICSE’ 07 PRESTO: Program Analyses and Software Tools Research Group, Ohio State University
Outline § Background and motivation - Regression test selection - Aspect. J semantics and challenges § Contributions - A control-flow representation for Aspect. J software - A graph traversal algorithm for test selection - Experimental evaluation § Conclusions 2 PRESTO: Program Analyses and Software Tools Research Group, Ohio State University
Regression Test Selection § Select a safe subset of regression tests § Harrold et al. , OOPSLA 01 - Java interclass graph (JIG): intraand inter-procedural flow of control - Simultaneous JIG traversal for P and P' Program P Execute P and record coverage JIG edge coverage matrix Select tests Dangerous edges in P Program P' 3 Identify dangerous entities PRESTO: Program Analyses and Software Tools Research Group, Ohio State University
Motivation and Challenges § Aspects can change dramatically the behavior of the original code § Why not select tests based on the woven bytecode? - The discrepancy between the source code and the bytecode can be significant - Compiler-specific artificial code - Shown in our experimental study § A more general question - What is an appropriate static representation for Aspect. J software for regression test selection and other analyses? 4 PRESTO: Program Analyses and Software Tools Research Group, Ohio State University
Aspect. J Semantics § Join points, pointcuts, and advices - before, around (with proceed), after § Shadow - Textual part of the program executed during the time span of a join point § Dynamic pointcut/advice: triggered only when certain run-time conditions hold - if… § Advice precedence rules 5 PRESTO: Program Analyses and Software Tools Research Group, Ohio State University
Running Example /* before 1 */ class Point { before(Point p, int x) : int x; setter. X(p) && args(x) throws void…set. X(int x) { this. x = x; } { … if (…) throw ex … } static void main(String[] a) { Point p = new Point(); /* around 1 */ void around(Point p, int x) : p. set. X(10); setter. X(p) && args(x) && }if(x==0) { … proceed(p, x); … }} aspect Bound. Point { /* before 2 */ pointcut setter. X(Point p) : before(Point p) : setter. X(p) { … } call(void Point. set. X(*)) && /* after 1 */ target(p); after(Point p) : setter. X(p) { …advices } … // } 6 PRESTO: Program Analyses and Software Tools Research Group, Ohio State University
Aspect. J Semantic try { before 1(); if (x==0) around 1(); main(…) { … else { before 2(); p. set. X(10); … p. set. X(); } } } catch(Throwable e) { after 1(); throw e; } after 1(); 7 around 1() { before 2(); p. set. X(); } PRESTO: Program Analyses and Software Tools Research Group, Ohio State University
Control-Flow Representation § Aspect. J Inter-module Graph (AJIG) - JIG-like representation for “normal” calls ú No join points - New representation for interactions at join points ú Interaction graph § Multiple advices applicable at a join point - Model complex interactions among multiple advices § Dynamic advices - E. g. model the invocation of around 1 in the example ú void around(Point p, int x) : … if(x==0) 8 PRESTO: Program Analyses and Software Tools Research Group, Ohio State University
Multiple Advice Invocation § Input: a list of advices that statically match a shadow § Sort the list using precedence rules, taking into account the shadow - before 1, around 1, before 2, p. set. X, after 1 § Build advice nesting tree - Create a root node, and put every advice under root - Scan the list, build around subtrees; advices that are invoked within an around advice A are the children of A - Parent-child relationships represent nesting of advice time span 9 PRESTO: Program Analyses and Software Tools Research Group, Ohio State University
Advice Nesting Tree before 1 around 1 before 2 p. set. X after 1 root before 1 10 around 1 before 2 p. set. X after 1 PRESTO: Program Analyses and Software Tools Research Group, Ohio State University
Modeling of “proceed” § Important observation - Advices at one level are invoked by the call to proceed in their parent advice § Introduction of placeholder methods ph_* - A call to a ph_proceed represents a call to proceed - ph_root is called to replace the shadow - The CFG for a ph_proceed method contains a sequence of call/return nodes pairs for all advices that are invoked by proceed 11 PRESTO: Program Analyses and Software Tools Research Group, Ohio State University
root before 1 around 1 before 2 12 after 1 p. set. X PRESTO: Program Analyses and Software Tools Research Group, Ohio State University
Handling of After Advices § Normal subgraph - {after 1} § Exceptional subgraph - {after 1} Normal subgraph 13 Exceptional subgraph PRESTO: Program Analyses and Software Tools Research Group, Ohio State University
Handling of Dynamic Advices § Challenges - No way to know whether a dynamic advice is invoked at run time - Advices that are nested within a dynamic around advice A are still invoked even if A is not invoked § Solutions - Introduce placeholder decision making nodes ph_decision - Create a ph_decision node before the call node of each dynamic advice 14 PRESTO: Program Analyses and Software Tools Research Group, Ohio State University
Example § Create a ph_decison node § Create a “T” edge going from ph_decison to the guarded advice § Create an “F” edge - For a non-around advice, link the edge to the next call node - For an around advice, link the edge to the call node of its ph_proceed - Redirect edges 15 ph_decision F T F before 1 return around 1 ph_decision T F ph_proceed 1 return exit PRESTO: Program Analyses and Software Tools Research Group, Ohio State University return
Graph Traversal Algorithm § Edge-level comparison for edges outside the interaction graph § Interaction graph comparison - Interprocedural traversal ú Compare the calling structure ú Schedule advice bodies for further processing - Intraprocedural comparison ú Edge-level comparison for advice bodies 16 PRESTO: Program Analyses and Software Tools Research Group, Ohio State University
Inter-procedural traversal Case 1: if ad 1 != ad 2 e is dangerous 17 PRESTO: Program Analyses and Software Tools Research Group, Ohio State University
Inter-procedural traversal Case 2: e is dangerous 18 PRESTO: Program Analyses and Software Tools Research Group, Ohio State University
Inter-procedural traversal Case 3: if ad 1 == ad 2 e is dangerous else ‘T’ is dangerous 3 a: if ad 1 is non-around compare(e’’, e’) 3 b: else compare(ph, e’) 19 PRESTO: Program Analyses and Software Tools Research Group, Ohio State University
Empirical Evaluation 20 Subject #Shadows #versions #Tests bean 11 7 42 tracing 32 5 45 Telecom 19 6 41 quicksort 15 3 24 nullcheck 146 4 63 dcm 1103 3 63 lod 359 3 63 PRESTO: Program Analyses and Software Tools Research Group, Ohio State University
23. 8% more 35% more 21 PRESTO: Program Analyses and Software Tools Research Group, Ohio State University
Study 1 (Cond. ) § Compiler changes names of existing advices when adding a new advice § Compiler inlines an advice when removing some control flow paths from it § Compiler generates try-catch block, when adding an after. Throwing advice § Compiler inserts dynamic residue that performs run -time check before dynamic advice § Conclusion - These are not program changes - Such changes prevent JIG-based approach from selecting the changes only made in the source. 22 PRESTO: Program Analyses and Software Tools Research Group, Ohio State University
Study 2 -Test Suite Reduction bean telecom 23 tracing quicksort PRESTO: Program Analyses and Software Tools Research Group, Ohio State University
Study 2 -Test Suite Reduction nullcheck dcm JIG- 98. 8% AJIG- 69. 0% loc 24 PRESTO: Program Analyses and Software Tools Research Group, Ohio State University
Conclusions § Bytecode level analysis does not work for Aspect. J program § A source code level control-flow representation AJIG - Multiple advice invocation - Dynamic advice § A graph traversal algorithm § Evaluation - Our approach outperforms the JIG-based approach 25 PRESTO: Program Analyses and Software Tools Research Group, Ohio State University
§ Questions? 26 PRESTO: Program Analyses and Software Tools Research Group, Ohio State University
- La structure du texte descriptif
- Simple multiple linear regression
- Multiple linear regression
- Survival analysis vs logistic regression
- Logistic regression vs linear regression
- Regression shrinkage and selection via the lasso
- 16x9 test pattern
- Balancing selection vs stabilizing selection
- Similarities
- K selected
- Natural selection vs artificial selection
- Artificial selection vs natural selection
- What is stablizing selection
- Clumped dispersion
- Natural selection vs artificial selection
- Two way selection and multiway selection in c
- Multiway selection
- Procedure of pure line selection
- What is regression testing in software engineering
- Unit 6
- Fspos vägledning för kontinuitetshantering
- Typiska drag för en novell
- Tack för att ni lyssnade bild
- Returpilarna
- Shingelfrisyren
- En lathund för arbete med kontinuitetshantering
- Särskild löneskatt för pensionskostnader