Report

Share

•0 likes•132 views

•0 likes•132 views

Report

Share

Download to read offline

State-of-the-art search-based approaches for test case generation work at test case level, where tests are represented as sequences of statements. These approaches make use of genetic operators (i.e., mutation and crossover) that create test variants by adding, altering, and removing statements from existing tests. While this encoding schema has been shown to be very effective for many-objective test case generation, the standard crossover operator (single-point) only alters the structure of the test cases but not the input data. In this paper, we argue that changing both the test case structure and the input data is necessary to increase the genetic variation and improve the search process. Hence, we propose a hybrid multi-level crossover (HMX) operator that combines the traditional test-level crossover with data-level recombination. The former evolves and alters the test case structures, while the latter evolves the input data using numeric and string-based recombinational operators. We evaluate our new crossover operator by performing an empirical study on more than 100 classes selected from open-source Java libraries for numerical operations and string manipulation.

- 1. HYBRID MULTI-LEVEL CROSSOVER FOR UNIT TEST CASE GENERATION 1 Pouria Derakhshanfar Annibale Panichella Mitchell Olsthoorn
- 2. Test4 SEARCH-BASED UNIT TEST GENERATION 2 JAR Application Evolutionary-based algorithm Random initialization Test0 Test5 Test1 Test3 Test2 … Evaluate fitness of tests Search objective(s) Fitness value(s) Fitness value(s) Fitness value(s) Fitness value(s) Fitness value(s) Fitness value(s) Selection Class under tests CLASS
- 3. SEARCH-BASED UNIT TEST GENERATION 4 JAR Application Random initialization Evaluate fitness of tests Selection Crossover Test1 Test4 Offspring1 Offspring2 Evolutionary-based algorithm Class under tests CLASS
- 4. SEARCH-BASED CRASH REPRODUCTION 5 JAR Application Random initialization Evaluate fitness of tests Selection Crossover Test1 Test4 Offspring1 Offspring2 Mutation Or Or Edit Remove Add Or Or Edit Remove Add Evolutionary-based algorithm Class under tests CLASS
- 5. SEARCH-BASED UNIT TEST GENERATION 6 JAR Application Random initialization Evaluate fitness of tests Selection Crossover Mutation Reinsertion NewTest0 NewTest5 NewTest4 NewTest1 NewTest3 NewTest2 … Evolutionary-based algorithm Class under tests CLASS
- 6. SEARCH-BASED UNIT TEST GENERATION 7 JAR Application Random initialization Evaluate fitness of tests Selection Crossover Mutation Reinsertion Evolutionary-based algorithm Class under tests CLASS Test1 Test4 Offspring1 Offspring2 ! No crossover for input data
- 7. CROSSOVER OPERATOR 8 public void test1 () { Fraction f0 = new Fraction (2, 3); Fraction f1 = new Fraction (2, -1); f0. divideBy (f1); f0.add ( Fraction.ZERO); } Parent 1 public void test2 () { Fraction f0 = new Fraction (3, 1); Fraction f1 = new Fraction (1, 3); f0.add (f1); f0.pow (2.0); } Parent 2
- 8. CROSSOVER OPERATOR 9 public void test1 () { Fraction f0 = new Fraction (2, 3); Fraction f1 = new Fraction (2, -1); f0. divideBy (f1); f0.add ( Fraction.ZERO); } Parent 1 public void test2 () { Fraction f0 = new Fraction (3, 1); Fraction f1 = new Fraction (1, 3); f0.add (f1); f0.pow (2.0); } Parent 2 public void test1 () { Fraction f0 = new Fraction (2, 3); Fraction f1 = new Fraction (2, -1); f0.add (f1); f0.pow (2.0); } Offspring 1 public void test2 () { Fraction f0 = new Fraction (3, 1); Fraction f1 = new Fraction (1, 3); f0. divideBy (f1); f0.add ( Fraction.ZERO); } Offspring 2
- 9. CROSSOVER OPERATOR 10 public void test1 () { Fraction f0 = new Fraction (2, 3); Fraction f1 = new Fraction (2, -1); f0. divideBy (f1); f0.add ( Fraction.ZERO); } Parent 1 public void test2 () { Fraction f0 = new Fraction (3, 1); Fraction f1 = new Fraction (1, 3); f0.add (f1); f0.pow (2.0); } Parent 2 public void test1 () { Fraction f0 = new Fraction (2, 3); Fraction f1 = new Fraction (2, -1); f0.add (f1); f0.pow (2.0); } Offspring 1 public void test2 () { Fraction f0 = new Fraction (3, 1); Fraction f1 = new Fraction (1, 3); f0. divideBy (f1); f0.add ( Fraction.ZERO); } Offspring 2 Hybrid Multi-level Crossover (HMX) operator Traditional test-level crossover + Data-level recombination
- 10. OUR SOLUTION 11 HMX: HYBRID MULTI-LEVEL CROSSOVER input: Two parent test cases P1 and P2 output: Two offspring test cases O1 and O2 begin O1,O2 <—— SINGLE-POINT-CROSSOVER(P1,P2); // detect candidate data inputs for data-level crossover C1,C2,M1,M2 <—— DETECT-CORSSOVER-CANDIDATES(O1,O2) foreach SIG ∈ C1.keys ∪ C2.keys do // choose random constructor with same signature S1 <—— random.choice(C1[SIG]) S2 <—— random.choice(C2[SIG]) O1,O2 <—— DATA-CROSSOVER(O1,O2,PARAMS(S1),PARAMS(S2)) done foreach SIG ∈ M1.keys ∪ M2.keys do // choose random method with same signature S1 <—— random.choice(M1[SIG]) S2 <—— random.choice(M2[SIG]) O1,O2 <—— DATA-CROSSOVER(O1,O2,PARAMS(S1),PARAMS(S2)) done return O1,O2; end
- 11. TEST-LEVEL CROSSOVER OPERATOR 12 HMX: HYBRID MULTI-LEVEL CROSSOVER input: Two parent test cases P1 and P2 output: Two offspring test cases O1 and O2 begin O1,O2 <—— SINGLE-POINT-CROSSOVER(P1,P2); // detect candidate data inputs for data-level crossover C1,C2,M1,M2 <—— DETECT-CORSSOVER-CANDIDATES(O1,O2) foreach SIG ∈ C1.keys ∪ C2.keys do // choose random constructor with same signature S1 <—— random.choice(C1[SIG]) S2 <—— random.choice(C2[SIG]) O1,O2 <—— DATA-CROSSOVER(O1,O2,PARAMS(S1),PARAMS(S2)) done foreach SIG ∈ M1.keys ∪ M2.keys do // choose random method with same signature S1 <—— random.choice(M1[SIG]) S2 <—— random.choice(M2[SIG]) O1,O2 <—— DATA-CROSSOVER(O1,O2,PARAMS(S1),PARAMS(S2)) done return O1,O2; end
- 12. TEST-LEVEL CROSSOVER OPERATOR 13 public void test1 () { Fraction f0 = new Fraction (2, 3); Fraction f1 = new Fraction (2, -1); f0. divideBy (f1); f0.add ( Fraction.ZERO); } P1 public void test2 () { Fraction f0 = new Fraction (3, 1); Fraction f1 = new Fraction (1, 3); f0.add (f1); f0.pow (2.0); } P2 public void test1 () { Fraction f0 = new Fraction (2, 3); Fraction f1 = new Fraction (2, -1); f0.add (f1); f0.pow (2.0); } O1 public void test2 () { Fraction f0 = new Fraction (3, 1); Fraction f1 = new Fraction (1, 3); f0. divideBy (f1); f0.add ( Fraction.ZERO); } O2
- 13. DETECT CROSSOVER CANDIDATES 14 HMX: HYBRID MULTI-LEVEL CROSSOVER input: Two parent test cases P1 and P2 output: Two offspring test cases O1 and O2 begin O1,O2 <—— SINGLE-POINT-CROSSOVER(P1,P2); // detect candidate data inputs for data-level crossover C1,C2,M1,M2 <—— DETECT-CORSSOVER-CANDIDATES(O1,O2) foreach SIG ∈ C1.keys ∪ C2.keys do // choose random constructor with same signature S1 <—— random.choice(C1[SIG]) S2 <—— random.choice(C2[SIG]) O1,O2 <—— DATA-CROSSOVER(O1,O2,PARAMS(S1),PARAMS(S2)) done foreach SIG ∈ M1.keys ∪ M2.keys do // choose random method with same signature S1 <—— random.choice(M1[SIG]) S2 <—— random.choice(M2[SIG]) O1,O2 <—— DATA-CROSSOVER(O1,O2,PARAMS(S1),PARAMS(S2)) done return O1,O2; end Data-level crossover can not be applied to every combination of input data: A. Performing crossover on input data with different types is not logical. B. Applying crossover on input parameters with the same data type that belong to different methods may lead to generate offsprings that are farther from the desired search objective.
- 14. DETECT CROSSOVER CANDIDATES 15 public void test1 () { Fraction f0 = new Fraction (2, 3); Fraction f1 = new Fraction (2, -1); f0.add (f1); f0.pow (2.0); } O1 public void test2 () { Fraction f0 = new Fraction (3, 1); Fraction f1 = new Fraction (1, 3); f0. divideBy (f1); f0.add ( Fraction.ZERO); } O2 C1 Key (Signature of constructors invoked in both O1 and O2) Value (list of constructors called in O1 that has the same signature) Fraction|<init>(int, int) new Fraction (2, 3) new Fraction (2, -1) Each method or constructor implemented in a project has a unique string called Signature. Signature format: CLASS_NAME|FUNCTION_NAME(PARAM1_TYPE, PARAM2_TYPE, …)RETURN_TYPE C2 Key (Signature of constructors invoked in both O1 and O2) Value (list of constructors called in O2 that has the same signature) Fraction|<init>(int, int) new Fraction (3, 1) new Fraction (1, 3)
- 15. DETECT CROSSOVER CANDIDATES 16 public void test1 () { Fraction f0 = new Fraction (2, 3); Fraction f1 = new Fraction (2, -1); f0.add (f1); f0.pow (2.0); } O1 public void test2 () { Fraction f0 = new Fraction (3, 1); Fraction f1 = new Fraction (1, 3); f0. divideBy (f1); f0.add ( Fraction.ZERO); } O2 M1 Key (Signature of methods invoked in both O1 and O2) Value (list of methods called in O1 that has the same signature) Fraction|add(Fraction)V add(f1) Each method or constructor implemented in a project has a unique string called Signature. Signature format: CLASS_NAME|FUNCTION_NAME(PARAM1_TYPE, PARAM2_TYPE, …)RETURN_TYPE M2 Key (Signature of methods invoked in both O1 and O2) Value (list of methods called in O2 that has the same signature) Fraction|add(Fraction)V add(Fraction.ZERO)
- 16. DATA CROSSOVER 17 HMX: HYBRID MULTI-LEVEL CROSSOVER input: Two parent test cases P1 and P2 output: Two offspring test cases O1 and O2 begin O1,O2 <—— SINGLE-POINT-CROSSOVER(P1,P2); // detect candidate data inputs for data-level crossover C1,C2,M1,M2 <—— DETECT-CORSSOVER-CANDIDATES(O1,O2) foreach SIG ∈ C1.keys ∪ C2.keys do // choose random constructor with same signature S1 <—— random.choice(C1[SIG]) S2 <—— random.choice(C2[SIG]) O1,O2 <—— DATA-CROSSOVER(O1,O2,PARAMS(S1),PARAMS(S2)) done foreach SIG ∈ M1.keys ∪ M2.keys do // choose random method with same signature S1 <—— random.choice(M1[SIG]) S2 <—— random.choice(M2[SIG]) O1,O2 <—— DATA-CROSSOVER(O1,O2,PARAMS(S1),PARAMS(S2)) done return O1,O2; end
- 17. DATA CROSSOVER 18 public void test1 () { Fraction f0 = new Fraction (2, 3); Fraction f1 = new Fraction (2, -1); f0.add (f1); f0.pow (2.0); } O1 public void test2 () { Fraction f0 = new Fraction (3, 1); Fraction f1 = new Fraction (1, 3); f0. divideBy (f1); f0.add ( Fraction.ZERO); } O2 C1 Key (Signature of constructors invoked in both O1 and O2) Value (list of constructors called in O1 that has the same signature) Fraction|<init>(int, int) new Fraction (2, 3) new Fraction (2, -1) C2 Key (Signature of constructors invoked in both O1 and O2) Value (list of constructors called in O2 that has the same signature) Fraction|<init>(int, int) new Fraction (3, 1) new Fraction (1, 3) DATA-CROSSOVER(…)
- 18. DATA CROSSOVER 19 HMX: HYBRID MULTI-LEVEL CROSSOVER input: Two parent test cases P1 and P2 output: Two offspring test cases O1 and O2 begin O1,O2 <—— SINGLE-POINT-CROSSOVER(P1,P2); // detect candidate data inputs for data-level crossover C1,C2,M1,M2 <—— DETECT-CORSSOVER-CANDIDATES(O1,O2) foreach SIG ∈ C1.keys ∪ C2.keys do // choose random constructor with same signature S1 <—— random.choice(C1[SIG]) S2 <—— random.choice(C2[SIG]) O1,O2 <—— DATA-CROSSOVER(O1,O2,PARAMS(S1),PARAMS(S2)) done foreach SIG ∈ M1.keys ∪ M2.keys do // choose random method with same signature S1 <—— random.choice(M1[SIG]) S2 <—— random.choice(M2[SIG]) O1,O2 <—— DATA-CROSSOVER(O1,O2,PARAMS(S1),PARAMS(S2)) done return O1,O2; end
- 19. DATA CROSSOVER 20 1. Numerical data types —> Simulated Binary Crossover (SBX) 2. Strings —> String Crossover HMX SUPPORTS DATA RECOMBINATION FOR TWO DATA TYPES
- 20. DATA CROSSOVER 21 SIMULATED BINARY CROSSOVER (SBX) O1: new Fraction (1.5, -1) O2: new Fraction (3.8, 1) Crossover (2, 3) Crossover (-1, 1) Deb, K., Sindhya, K., Okabe, T.: Self-adaptive simulated binary crossover for real parameter optimization. In: GECCO 2007. 1.5 3.8 O1: new Fraction (2, -1) O2: new Fraction (3, 1)
- 21. DATA CROSSOVER 22 SINGLE-POINT STRING CROSSOVER String 1: lor em String 2: ipsum lorsum ipem McMinn, P.: Search-based software test data generation: A survey. Software Testing Verification and Reliability. (2004)
- 22. EMPIRICAL EVALUATION 23 1. State-of-the-art search-based unit test generation: EvoSuite running DynaMOSA with default parameters • Baseline: EvoSuite + SPX • Novel approach: EvoSuite + HMX 2. Benchmark: • 9 projects, which commonly use numeric and string input data. • 100 non-trivial classes under test that accept at least one string or numeric value as input parameter. 3. Search budget = 5 minutes 4. Repeated each execution for 100 times 5. in total: 23,200 executions EMPIRICAL EVALUATION
- 23. RQ1: TO WHAT EXTENT DOES HMX IMPROVE STRUCTURAL COVERAGE COMPARED TO THE SINGLE-POINT CROSSOVER? 24 ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● 0.00 0.25 0.50 0.75 1.00 HMX SPX Crossover Line coverage ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● 0.00 0.25 0.50 0.75 1.00 HMX SPX Crossover Branch coverage OVERVIEW OF STRUCTURAL COVERAGE COMPARING HMX TO SPX
- 24. RQ1: TO WHAT EXTENT DOES HMX IMPROVE STRUCTURAL COVERAGE COMPARED TO THE SINGLE-POINT CROSSOVER? 25 Pairwise comparison of impact of HMX on structural coverage with a small, medium, and large effect size and a statistical significance <0.05 1. Impact factor measurement: Vargha-Delaney Â12 statistic 2. Assess the significance of results: non-parametric Wilcoxon Rank Sum test Metric #Win #Lose Small Medium Large Small Medium Large Branch coverage 5 3 22 1 0 0 Line coverage 1 3 19 1 0 0 Summary: HMX crossover operator achieves significantly higher (~30% of the cases) or equal structural code coverage for unit test case generation compared to the baseline SPX. Maximum increase of branch coverage achieved by HMX: 19.1% Maximum increase of line coverage achieved by HMX: 19.4%
- 25. RQ2: HOW DOES HMX IMPACT THE FAULT-DETECTION CAPABILITY OF THE GENERATED TESTS? 26 OVERVIEW OF MUTATION SCORE ACHIEVED BY HMX AND SPX ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● 0.25 0.50 0.75 1.00 HMX SPX Crossover Weak mutation score 0.00 0.25 0.50 0.75 1.00 HMX SPX Crossover Strong Mutation score
- 26. RQ2: HOW DOES HMX IMPACT THE FAULT-DETECTION CAPABILITY OF THE GENERATED TESTS? 27 Pairwise comparison of impact of HMX on fast detection capability of search process with a small, medium, and large effect size and a statistical significance <0.05 1. Impact factor measurement: Vargha-Delaney Â12 statistic 2. Assess the significance of results: non-parametric Wilcoxon Rank Sum test Metric #Win #Lose Small Medium Large Small Medium Large Weak mutation 3 3 21 1 0 0 Strong mutation 8 0 15 3 0 0 Summary: HMX achieves significantly higher (~25% of the cases) or equal fault detection capability compared to SPX and is outperformed only in one and three classes for weak and strong mutation, respectively. Maximum increase of weak mutation achieved by HMX: 14% Maximum increase of strong mutation achieved by HMX: 12.2%
- 27. FUTURE WORK 28 • Additional crossover operators for other types (e.g., array, list, map). • Extend our experiment by assessing other crossover operators for numbers (e.g., parent-centric and arithmetic crossover) and strings (e.g., multi-point crossover).
- 28. REPLICATION PACKAGE THANK YOU FOR LISTENING 29 Replication Package https://zenodo.org/record/5102598#.YV6uAS8Rqrw