using controlled numbers of real faults and mutants to
play

Using Controlled Numbers of Real Faults and Mutants to Empirically - PowerPoint PPT Presentation

Using Controlled Numbers of Real Faults and Mutants to Empirically Evaluate Coverage-Based Test Case Prioritization Gregory Kapfhammer Gordon Fraser Phil McMinn David Paterson University of Sheffield Allegheny College University of Passau


  1. Using Controlled Numbers of Real Faults and Mutants to Empirically Evaluate Coverage-Based Test Case Prioritization Gregory Kapfhammer Gordon Fraser Phil McMinn David Paterson University of Sheffield Allegheny College University of Passau University of Sheffield Workshop on Automation of Software Test 29th May 2018 dpaterson1@sheffield.ac.uk

  2. Test Case Prioritization Testing is required to ensure the correct functionality of software ● ● Larger software → more tests → longer running test suites

  3. Test Case Prioritization Testing is required to ensure the correct functionality of software ● ● Larger software -> more tests -> longer running test suites How can we reduce the time taken to identify new faults whilst still ensuring that all faults are found? Find an ordering of test cases such that faults are detected as early as possible Test Case Prioritization

  4. Types of Fault Seeded Mutant Real Artificial

  5. Test Case Prioritization Strategy A Strategy B 100 subjects 100 subjects ● ● Evaluated on mutants Evaluated on real faults ● ● Score = 0.75 Score = 0.72 ● ●

  6. Research Objectives 1. Compare prioritization strategies across fault types vs 2. Investigate the impact of multiple faults vs vs

  7. • TCP aims to maximize APFD by minimizing TF i

  8. Evaluating Test Prioritization 100 30 90 80 1 fault detected after 7 test cases (n=10) 𝐵𝑄𝐺𝐸 = 1 − 7 10 + 1 70 % Faults Detected 20 = 0.35 30 × 100 100 × 100 = 0.3 60 100 50 40 30 20 2 × 10 × 100 1 100 × 100 = 0.05 10 10 0 0 10 20 30 40 50 60 70 80 90 100 % Test Cases Executed

  9. Evaluating Test Prioritization 100 90 80 1 fault detected after 1 test cases (n=20) 𝐵𝑄𝐺𝐸 = 1 − 1 20 + 1 70 40 = 0.975 % Faults Detected 60 50 40 30 20 10 0 0 10 20 30 40 50 60 70 80 90 100 % Test Cases Executed

  10. Evaluating Test Prioritization 100 90 1 fault detected after 2 test cases 80 2nd fault detected after 8 test cases (n=10) 70 𝐵𝑄𝐺𝐸 = 1 − 2 + 8 + 1 % Faults Detected 20 = 0.55 20 60 50 40 30 20 10 0 0 10 20 30 40 50 60 70 80 90 100 % Test Cases Executed

  11. Test Case Prioritization APFD t 1 t 2 t 3 t 4 t 5 t 6 t 7 t 8 t 9 t 10 ✅ ❌ ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅ Version 1 - ✅ ❌ ✅ ✅ ✅ ✅ ❌ ✅ ✅ ✅ Version 2 0.55 0.35 ✅ ❌ ✅ ❌ ✅ ❌ ✅ ✅ ✅ ✅ Version 3 0.55 0.45

  12. Test Case Prioritization APFD t 1 t 8 t 4 t 5 t 7 t 9 t 2 t 10 t 6 t 3 ✅ ✅ ✅ ✅ ✅ ✅ ❌ ✅ ✅ ✅ Version 1 - ✅ ✅ ✅ ✅ ❌ ✅ ❌ ✅ ✅ ✅ Version 2 0.55 0.85 ✅ ✅ ❌ ✅ ✅ ✅ ❌ ✅ ❌ ✅ Version 3 0.45 0.8

  13. Techniques Coverage-Based History-Based Cluster-Based public int abs( int x){ 28/05/2018 27/05/2018 26/05/2018 25/05/2018 24/05/2018 23/05/2018 22/05/2018 if (x >= 0) { testOne ✅ ✅ ✅ ✅ ✅ ✅ ✅ return x; testTwo ✅ ✅ ❌ ✅ ✅ ✅ ✅ } else { testThree return – x; ✅ ✅ ✅ ✅ ❌ ✅ ✅ } testFour ✅ ✅ ✅ ✅ ✅ ❌ ✅ } testFive ✅ ❌ ✅ ❌ ✅ ❌ ❌

  14. Evaluation RQ1: How does the effectiveness of test case prioritization compare between a single 1. Compare prioritization strategies across fault types real fault and a single mutant? vs 2. Investigate the impact of multiple faults RQ2: How does the effectiveness of test case prioritization compare between single faults and multiple faults? vs vs

  15. Subjects Defects4J : Large repository containing 357 real faults from 5 open-source repositories [1] • Project GitHub Number of Bugs KLOC Tests JFreeChart https://github.com/jfree/jfreechart 26 96 2,205 Closure Compiler https://github.com/google/closure-compiler 133 90 7,927 Apache Commons Lang https://github.com/apache/commons-lang 65 85 3,602 Apache Commons Math https://github.com/apache/commons-math 106 28 4,130 Joda Time https://github.com/JodaOrg/joda-time 27 22 2,245 • Contains developer written test suites • Provides 2 versions of every subject – one buggy and one fixed [1] https://github.com/rjust/defects4 [2] https://homes.cs.washington.edu/~mernst/pubs/bug-database-issta2014.pdfj

  16. Experimental Process Fixed Version Defects4J Major Program Apply Patch Buggy Version Apply Patch 1 testOne 1 test42 2 testTwo 2 test378 Kanonizo Program Test Prioritization … … n testN n test201

  17. Experimental Process Fixed Version Defects4J Major Program Apply Patch 65 test178 Buggy Version Apply Patch 1 testOne 1 test42 2 testTwo 2 test378 Kanonizo Program Test Prioritization … … n testN n test201

  18. Metrics • Wilcoxon U-Test measures likelihood that 2 samples originate from the same distribution 𝑞 - Significant differences occur often when samples are large Vargha-Delaney effect size calculates the magnitude of differences መ 𝐵 12 – the • practical difference between two samples

  19. Metrics • Wilcoxon U-Test measures likelihood that 2 samples originate from the same 𝑞 = 0.5544 distribution Significant = ❌ - Significant differences occur often when samples are large መ 𝐵 12 = 0.5007 Effect Size = None Vargha-Delaney effect size calculates the magnitude of differences – the • practical difference between two samples

  20. Metrics • Wilcoxon U-Test measures likelihood that 2 samples originate from the same 𝑞 = 2.2e-16 distribution Significant = ✅ - Significant differences occur often when samples are large መ 𝐵 12 = 0.4075059 Effect Size = Small Vargha-Delaney effect size calculates the magnitude of differences – the • practical difference between two samples

  21. Metrics 𝑞 = 2.2e-16 Significant = ✅ • Wilcoxon U-Test measures likelihood that 2 samples originate from the same መ 𝐵 12 = 0.3250598 distribution Effect Size = Medium - Significant differences occur often when samples are large Vargha-Delaney effect size calculates the magnitude of differences – the • practical difference between two samples

  22. Metrics 𝑞 = 2.2e-16 • Wilcoxon U-Test measures likelihood that 2 samples originate from the same Significant = ✅ distribution መ 𝐵 12 = 0.005826003 - Significant differences occur often when samples are large Effect Size = Large Vargha-Delaney effect size calculates the magnitude of differences – the • practical difference between two samples

  23. Comparisons RQ1 RQ2 Strategy 1 Strategy 2 Fault Type 1 Fault Type 2 Strategy 1 Strategy 2 Faults 1 Faults 2 Faults 3 A A Real Mutant A A 1 5 10 A B Real Real A B 1 real 5 real 10 real A B Mutant Mutant A B 1 mutant 5 mutant 10 mutant

  24. Results RQ1: Real Faults vs Mutants • APFD is significantly higher for mutants than real faults in all but one case On average, over 10% additional test cases were required to find the real faults • For real faults , 3 out of 16 project/strategy combinations significantly improve over the • baseline, compared to 10 out of 16 improvements for mutants

  25. Results RQ1: Real Faults vs Mutants • APFD is significantly higher for mutants than real faults in all but one case On average, over 10% additional test cases were required to find the real faults • Test Case Prioritization is much more effective for mutants than real faults For real faults , 3 out of 16 project/technique combinations significantly improve over the • baseline, compared to 10 out of 16 improvements for mutants

  26. Results RQ2: Single faults vs Multiple Faults • Variance in APFD scores significantly reduces as more faults are introduced In 37/40 cases, median APFD decreased as more faults are introduced • - APFD punishes test suites that are not able to find all faults

  27. Results RQ2: Single faults vs Multiple Faults • However, real faults and mutants still disagree on the effectiveness of TCP techniques • For real faults , there is very rarely any practical difference when including more faults - 17 of 40 comparisons are significant, of which 3 are M edium or L arge effect size For mutants , increasing the number of faults makes the results clearer • - 35 of 40 comparisons are significant, of which 16 are M edium or L arge effect size - Effect size increases in all but one case for more faults

  28. Results RQ2: Single faults vs Multiple Faults • However, real faults and mutants still disagree on the effectiveness of TCP techniques • For real faults , there is very rarely any practical difference when including more faults - 17 of 40 comparisons are significant, of which 3 are M edium or L arge effect size For mutants , increasing the number of faults makes the results clearer • Using more faults lessens the effect of - 35 of 40 comparisons are significant, of which 16 are M edium or L arge effect size - Effect size increases in all but one case for more faults randomness, but still does not make mutants and real faults consistent

  29. Real Faults vs Mutants • Real faults are much more complex than mutants

  30. Real Faults vs Mutants • Real faults are much more complex than mutants 8 lines of code deleted 9 lines of code added

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend