Ren´ e Just1 & Gregory M. Kapfhammer2 & Franz Schweiggert1 1Ulm University, Germany 2Allegheny College, USA 6th International Workshop on the Automation of Software Test Waikiki, Honolulu, Hawaii, USA May 23 - 24, 2011
Mutation Analysis Just & Kapfhammer & Schweiggert Ulm University, Allegheny College Using Conditional Mutation to Increase the Efficiency of Mutation Analysis
Mutation Analysis Challenges Just & Kapfhammer & Schweiggert Ulm University, Allegheny College Using Conditional Mutation to Increase the Efficiency of Mutation Analysis
Mutation Analysis Challenges Solutions Just & Kapfhammer & Schweiggert Ulm University, Allegheny College Using Conditional Mutation to Increase the Efficiency of Mutation Analysis
Mutation Analysis Challenges Solutions Conditional Mutation Just & Kapfhammer & Schweiggert Ulm University, Allegheny College Using Conditional Mutation to Increase the Efficiency of Mutation Analysis
Mutation Analysis Challenges Solutions Conditional Mutation Syntax Tree Transformation Just & Kapfhammer & Schweiggert Ulm University, Allegheny College Using Conditional Mutation to Increase the Efficiency of Mutation Analysis
Mutation Analysis Challenges Solutions Conditional Mutation Syntax Tree Transformation Expressions and Statements Just & Kapfhammer & Schweiggert Ulm University, Allegheny College Using Conditional Mutation to Increase the Efficiency of Mutation Analysis
Mutation Analysis Challenges Solutions Conditional Mutation Syntax Tree Transformation Expressions and Statements Compiler Integrated Just & Kapfhammer & Schweiggert Ulm University, Allegheny College Using Conditional Mutation to Increase the Efficiency of Mutation Analysis
Mutation Analysis Challenges Solutions Conditional Mutation Syntax Tree Transformation Expressions and Statements Compiler Integrated Comprehensive Empirical Study Just & Kapfhammer & Schweiggert Ulm University, Allegheny College Using Conditional Mutation to Increase the Efficiency of Mutation Analysis
Mutation Analysis Challenges Solutions Conditional Mutation Syntax Tree Transformation Expressions and Statements Compiler Integrated Comprehensive Empirical Study Efficient Technique - Fully Integrated into the Java 6 SE Compiler Just & Kapfhammer & Schweiggert Ulm University, Allegheny College Using Conditional Mutation to Increase the Efficiency of Mutation Analysis
int eval(int x){ int a=3, b=1, y; y = a * x; y += b; return y; } public int max(int a, int b){ int max = a; if(b>a){ max=b; } return max; } Just & Kapfhammer & Schweiggert Ulm University, Allegheny College Using Conditional Mutation to Increase the Efficiency of Mutation Analysis
int eval(int x){ int a=3, b=1, y; y = a * x; y += b; return y; } public int max(int a, int b){ int max = a; if(b>a){ max=b; } return max; } Methodically inject small syntactical faults into the program under test Just & Kapfhammer & Schweiggert Ulm University, Allegheny College Using Conditional Mutation to Increase the Efficiency of Mutation Analysis
int eval(int x){ int a=3, b=1, y; y = a * x; y += b; return y; } public int max(int a, int b){ int max = a; if(b>a){ max=b; } return max; } Just & Kapfhammer & Schweiggert Ulm University, Allegheny College Using Conditional Mutation to Increase the Efficiency of Mutation Analysis
int eval(int x){ int a=3, b=1, y; y = a * x; y += b; return y; } public int max(int a, int b){ int max = a; if(b>a){ max=b; } return max; } =⇒ =⇒ y = a - x; y = a + x; y = a / x; if(b < a) if(b != a) if(b == a) Just & Kapfhammer & Schweiggert Ulm University, Allegheny College Using Conditional Mutation to Increase the Efficiency of Mutation Analysis
int eval(int x){ int a=3, b=1, y; y = a * x; y += b; return y; } public int max(int a, int b){ int max = a; if(b>a){ max=b; } return max; } Unbiased and powerful method for assessing oracles and input values Just & Kapfhammer & Schweiggert Ulm University, Allegheny College Using Conditional Mutation to Increase the Efficiency of Mutation Analysis
int eval(int x){ int a=3, b=1, y; y = a * x; y += b; return y; } public int max(int a, int b){ int max = a; if(b>a){ max=b; } return max; } Unbiased and powerful method for assessing oracles and input values Useful method for fault seeding during the empirical study of testing techniques Just & Kapfhammer & Schweiggert Ulm University, Allegheny College Using Conditional Mutation to Increase the Efficiency of Mutation Analysis
Mutation Operators Just & Kapfhammer & Schweiggert Ulm University, Allegheny College Using Conditional Mutation to Increase the Efficiency of Mutation Analysis
Mutation Operators Program Just & Kapfhammer & Schweiggert Ulm University, Allegheny College Using Conditional Mutation to Increase the Efficiency of Mutation Analysis
Mutation Operators Program Mutants Just & Kapfhammer & Schweiggert Ulm University, Allegheny College Using Conditional Mutation to Increase the Efficiency of Mutation Analysis
Mutation Operators Program Mutants Often Yields a Substantial Num- ber of Mutants Just & Kapfhammer & Schweiggert Ulm University, Allegheny College Using Conditional Mutation to Increase the Efficiency of Mutation Analysis
Mutation Operators Program Mutants Often Yields a Substantial Num- ber of Mutants High Time Over- head for Generation Just & Kapfhammer & Schweiggert Ulm University, Allegheny College Using Conditional Mutation to Increase the Efficiency of Mutation Analysis
Mutation Operators Program Mutants Often Yields a Substantial Num- ber of Mutants High Time Over- head for Generation Mutation Analysis Just & Kapfhammer & Schweiggert Ulm University, Allegheny College Using Conditional Mutation to Increase the Efficiency of Mutation Analysis
Mutation Operators Program Mutants Often Yields a Substantial Num- ber of Mutants High Time Over- head for Generation Mutation Analysis Tests Just & Kapfhammer & Schweiggert Ulm University, Allegheny College Using Conditional Mutation to Increase the Efficiency of Mutation Analysis
Mutation Operators Program Mutants Often Yields a Substantial Num- ber of Mutants High Time Over- head for Generation Mutation Analysis Tests Results Just & Kapfhammer & Schweiggert Ulm University, Allegheny College Using Conditional Mutation to Increase the Efficiency of Mutation Analysis
Mutation Operators Program Mutants Often Yields a Substantial Num- ber of Mutants High Time Over- head for Generation Mutation Analysis Tests Results Individually Executing the Mutants is Too Expensive Just & Kapfhammer & Schweiggert Ulm University, Allegheny College Using Conditional Mutation to Increase the Efficiency of Mutation Analysis
Mutation Operators Program Mutants Often Yields a Substantial Num- ber of Mutants High Time Over- head for Generation Mutation Analysis Tests Results Individually Executing the Mutants is Too Expensive Prior Solutions? Just & Kapfhammer & Schweiggert Ulm University, Allegheny College Using Conditional Mutation to Increase the Efficiency of Mutation Analysis
Improving Mutation Analysis Just & Kapfhammer & Schweiggert Ulm University, Allegheny College Using Conditional Mutation to Increase the Efficiency of Mutation Analysis
Improving Mutation Analysis Offutt and Untch Just & Kapfhammer & Schweiggert Ulm University, Allegheny College Using Conditional Mutation to Increase the Efficiency of Mutation Analysis
Improving Mutation Analysis Offutt and Untch Do Fewer Just & Kapfhammer & Schweiggert Ulm University, Allegheny College Using Conditional Mutation to Increase the Efficiency of Mutation Analysis
Improving Mutation Analysis Offutt and Untch Do Fewer Sampling Selection Just & Kapfhammer & Schweiggert Ulm University, Allegheny College Using Conditional Mutation to Increase the Efficiency of Mutation Analysis
Improving Mutation Analysis Offutt and Untch Do Fewer Do Smarter Just & Kapfhammer & Schweiggert Ulm University, Allegheny College Using Conditional Mutation to Increase the Efficiency of Mutation Analysis
Improving Mutation Analysis Offutt and Untch Do Fewer Do Smarter Distributed Weak Mutation Just & Kapfhammer & Schweiggert Ulm University, Allegheny College Using Conditional Mutation to Increase the Efficiency of Mutation Analysis
Improving Mutation Analysis Offutt and Untch Do Fewer Do Smarter Do Faster Just & Kapfhammer & Schweiggert Ulm University, Allegheny College Using Conditional Mutation to Increase the Efficiency of Mutation Analysis
Improving Mutation Analysis Offutt and Untch Do Fewer Do Smarter Do Faster Compiler Integrated Bytecode Transformation Mutant Schemata Just & Kapfhammer & Schweiggert Ulm University, Allegheny College Using Conditional Mutation to Increase the Efficiency of Mutation Analysis
Improving Mutation Analysis Offutt and Untch Do Fewer Do Smarter Do Faster Higher Order Mutation Jia and Harman Just & Kapfhammer & Schweiggert Ulm University, Allegheny College Using Conditional Mutation to Increase the Efficiency of Mutation Analysis
all mutants within the same block Just & Kapfhammer & Schweiggert Ulm University, Allegheny College Using Conditional Mutation to Increase the Efficiency of Mutation Analysis
all mutants within the same block Can be inte- grated within the compiler Just & Kapfhammer & Schweiggert Ulm University, Allegheny College Using Conditional Mutation to Increase the Efficiency of Mutation Analysis
all mutants within the same block Transforms the abstract syntax tree (AST) Can be inte- grated within the compiler Just & Kapfhammer & Schweiggert Ulm University, Allegheny College Using Conditional Mutation to Increase the Efficiency of Mutation Analysis
all mutants within the same block Transforms the abstract syntax tree (AST) Stmt → Conditional Stmt (if-then-else, switch) Expr → Conditional Expr (conditional operator ?:) Can be inte- grated within the compiler Just & Kapfhammer & Schweiggert Ulm University, Allegheny College Using Conditional Mutation to Increase the Efficiency of Mutation Analysis
x){ int a=3, b=1, y; y = a * x ; y += b; return y; } Just & Kapfhammer & Schweiggert Ulm University, Allegheny College Using Conditional Mutation to Increase the Efficiency of Mutation Analysis
x){ int a=3, b=1, y; y = a * x ; y += b; return y; } ⇓ ASSIGN IDENT y BINARY ∗ a x Just & Kapfhammer & Schweiggert Ulm University, Allegheny College Using Conditional Mutation to Increase the Efficiency of Mutation Analysis
x){ int a=3, b=1, y; y = a * x ; y += b; return y; } ⇓ ASSIGN IDENT y BINARY ∗ a x Just & Kapfhammer & Schweiggert Ulm University, Allegheny College Using Conditional Mutation to Increase the Efficiency of Mutation Analysis
x){ int a=3, b=1, y; y = a * x ; y += b; return y; } ⇓ ASSIGN IDENT y BINARY ∗ a x =⇒ =⇒ ASSIGN IDENT y COND-EXPR THEN BINARY + a x COND (M NO ==2) ELSE COND-EXPR THEN BINARY - a x COND (M NO ==1) ELSE BINARY ∗ a x Just & Kapfhammer & Schweiggert Ulm University, Allegheny College Using Conditional Mutation to Increase the Efficiency of Mutation Analysis
eval(int x){ int a=3, b=1, y; y = a * x ; y += b; return y; } 1 Define mutation operators MOP(x ∗ y) = {x − y, x + y, x/y} 2 Determine whether current expression or statement is affected by mutation 3 Apply mutation operators Just & Kapfhammer & Schweiggert Ulm University, Allegheny College Using Conditional Mutation to Increase the Efficiency of Mutation Analysis
eval(int x){ int a=3, b=1, y; y = a * x ; y += b; return y; } 1 Define mutation operators MOP(x ∗ y) = {x − y, x + y, x/y} 2 Determine whether current expression or statement is affected by mutation 3 Apply mutation operators Just & Kapfhammer & Schweiggert Ulm University, Allegheny College Using Conditional Mutation to Increase the Efficiency of Mutation Analysis
eval(int x){ int a=3, b=1, y; y = a * x ; y += b; return y; } 1 Define mutation operators MOP(x ∗ y) = {x − y, x + y, x/y} 2 Determine whether current expression or statement is affected by mutation 3 Apply mutation operators Just & Kapfhammer & Schweiggert Ulm University, Allegheny College Using Conditional Mutation to Increase the Efficiency of Mutation Analysis
eval(int x){ int a=3, b=1, y; y = (M_NO==1)? a - x : a * x ; y += b; return y; } 1 Define mutation operators MOP(x ∗ y) = {x − y, x + y, x/y} 2 Determine whether current expression or statement is affected by mutation 3 Apply mutation operators Just & Kapfhammer & Schweiggert Ulm University, Allegheny College Using Conditional Mutation to Increase the Efficiency of Mutation Analysis
eval(int x){ int a=3, b=1, y; y = (M_NO==2)? a + x : (M_NO==1)? a - x : a * x ; y += b; return y; } 1 Define mutation operators MOP(x ∗ y) = {x − y, x + y, x/y} 2 Determine whether current expression or statement is affected by mutation 3 Apply mutation operators Just & Kapfhammer & Schweiggert Ulm University, Allegheny College Using Conditional Mutation to Increase the Efficiency of Mutation Analysis
eval(int x){ int a=3, b=1, y; y = (M_NO==3)? a / x : (M_NO==2)? a + x : (M_NO==1)? a - x : a * x ; y += b; return y; } 1 Define mutation operators MOP(x ∗ y) = {x − y, x + y, x/y} 2 Determine whether current expression or statement is affected by mutation 3 Apply mutation operators Versatile approach, can be combined with prior solutions Formal description and implementation details in the paper Just & Kapfhammer & Schweiggert Ulm University, Allegheny College Using Conditional Mutation to Increase the Efficiency of Mutation Analysis
eval(int x){ int a=3, b=1, y; y = (M_NO==3)? a / x : (M_NO==2)? a + x : (M_NO==1)? a - x : a * x ; y += b; return y; } 1 Define mutation operators MOP(x ∗ y) = {x − y, x + y, x/y} 2 Determine whether current expression or statement is affected by mutation 3 Apply mutation operators Versatile approach, can be combined with prior solutions Formal description and implementation details in the paper Just & Kapfhammer & Schweiggert Ulm University, Allegheny College Using Conditional Mutation to Increase the Efficiency of Mutation Analysis
eval(int x){ int a=3, b=1, y; y = (M_NO==3)? a / x : (M_NO==2)? a + x : (M_NO==1)? a - x : a * x ; y += b; return y; } 1 Define mutation operators MOP(x ∗ y) = {x − y, x + y, x/y} 2 Determine whether current expression or statement is affected by mutation 3 Apply mutation operators Versatile approach, can be combined with prior solutions Formal description and implementation details in the paper Just & Kapfhammer & Schweiggert Ulm University, Allegheny College Using Conditional Mutation to Increase the Efficiency of Mutation Analysis
x){ int a=3, b=1, y; y = (M_NO==3)? a / x : (M_NO==2)? a + x : (M_NO==1)? a - x : a * x ; y += b; return y; } Just & Kapfhammer & Schweiggert Ulm University, Allegheny College Using Conditional Mutation to Increase the Efficiency of Mutation Analysis
x){ int a=3, b=1, y; y = (M_NO==3)? a / x : (M_NO==2)? a + x : (M_NO==1)? a - x : a * x ; y += b; return y; } Mutants not exe- cuted cannot be killed Just & Kapfhammer & Schweiggert Ulm University, Allegheny College Using Conditional Mutation to Increase the Efficiency of Mutation Analysis
x){ int a=3, b=1, y; y = (M_NO==3)? a / x : (M_NO==2)? a + x : (M_NO==1)? a - x : (M_NO==0 && COVERED(1,3))? a * x : a * x ; y += b; return y; } Mutants not exe- cuted cannot be killed Determine covered mutants with addi- tional instrumentation Just & Kapfhammer & Schweiggert Ulm University, Allegheny College Using Conditional Mutation to Increase the Efficiency of Mutation Analysis
x){ int a=3, b=1, y; y = (M_NO==3)? a / x : (M_NO==2)? a + x : (M_NO==1)? a - x : (M_NO==0 && COVERED(1,3))? a * x : a * x ; y += b; return y; } Mutants not exe- cuted cannot be killed Determine covered mutants with addi- tional instrumentation Only execute and investi- gate the covered mutants Just & Kapfhammer & Schweiggert Ulm University, Allegheny College Using Conditional Mutation to Increase the Efficiency of Mutation Analysis
Java Compiler Just & Kapfhammer & Schweiggert Ulm University, Allegheny College Using Conditional Mutation to Increase the Efficiency of Mutation Analysis
Java Compiler Just & Kapfhammer & Schweiggert Ulm University, Allegheny College Using Conditional Mutation to Increase the Efficiency of Mutation Analysis
Java Compiler Just & Kapfhammer & Schweiggert Ulm University, Allegheny College Using Conditional Mutation to Increase the Efficiency of Mutation Analysis
Java Compiler Configuration: Common compiler options Domain specific language (DSL) http://www.mathematik.uni-ulm.de/sai/major Just & Kapfhammer & Schweiggert Ulm University, Allegheny College Using Conditional Mutation to Increase the Efficiency of Mutation Analysis
4 5 6 7 8 9 10 11 12 0 20000 40000 60000 80000 100000 120000 140000 Compiler runtime in seconds Number of mutants apache ant jfreechart itext java pathfinder commons math commons lang numerics4j Overhead for generating and compiling mutants is negligible Just & Kapfhammer & Schweiggert Ulm University, Allegheny College Using Conditional Mutation to Increase the Efficiency of Mutation Analysis
4 5 6 7 8 9 10 11 12 0 20000 40000 60000 80000 100000 120000 140000 Compiler runtime in seconds Number of mutants apache ant jfreechart itext java pathfinder commons math commons lang numerics4j Overhead for generating and compiling mutants is negligible Just & Kapfhammer & Schweiggert Ulm University, Allegheny College Using Conditional Mutation to Increase the Efficiency of Mutation Analysis
of mutation analysis to date Mutant generation time reduced to a minimum Mutation coverage provides runtime optimization Versatilely applicable in every Java-based environment Arbitrary conditions enable support for higher order mutation Future Work: Implement new mutation operators Enhance the domain specific language Just & Kapfhammer & Schweiggert Ulm University, Allegheny College Using Conditional Mutation to Increase the Efficiency of Mutation Analysis
of mutation analysis to date Mutant generation time reduced to a minimum Mutation coverage provides runtime optimization Versatilely applicable in every Java-based environment Arbitrary conditions enable support for higher order mutation Future Work: Implement new mutation operators Enhance the domain specific language Just & Kapfhammer & Schweiggert Ulm University, Allegheny College Using Conditional Mutation to Increase the Efficiency of Mutation Analysis