an empirical study on the use of defect
play

An Empirical Study on the Use of Defect U N I VE R SI TY OF WASHI N - PowerPoint PPT Presentation

D AVID PATERSON, U N I VE RSI TY O F S HE FFI ELD JOSE CAMPOS, An Empirical Study on the Use of Defect U N I VE R SI TY OF WASHI N G TON Prediction for Test Case Prioritization RUI ABREU, U N I VE R SI TY OF LI SB ON GREGORY M. KAPFHAMMER,


  1. D AVID PATERSON, U N I VE RSI TY O F S HE FFI ELD JOSE CAMPOS, An Empirical Study on the Use of Defect U N I VE R SI TY OF WASHI N G TON Prediction for Test Case Prioritization RUI ABREU, U N I VE R SI TY OF LI SB ON GREGORY M. KAPFHAMMER, AL L EGHENY CO L L EGE International Conference on Software Testing, Verification and Validation GORDON FRASER, Xi'an, China April 22-27 2019 UNIV ERS ITY O F PAS S AU PHIL MCMINN, UNIV ERS ITY O F S HEF F IEL D DPATERSON1@SHEFFIELD.AC.UK

  2. In software development, our goal is to minimize the impact of faults Defect If we know that a fault exists, we can use fault localization to pinpoint the Prediction code unit responsible If we don’t know that a fault exists, we can use defect prediction to estimate which code units are likely to be faulty DPATERSON1@SHEFFIELD.AC.UK

  3. ClassA ClassB 33% 10% Defect Prediction ClassC ClassD 72% 3%

  4. Defect Prediction Version Control Code Smells Code Features Information • Feature Envy • Cyclomatic • Number of Changes Complexity • God Class • Number of Authors • Method Length • Inappropriate • Number of Fixes Intimacy • Class Length DPATERSON1@SHEFFIELD.AC.UK

  5. Regression testing can account for up to 80% of the total testing budget, and up to 50% of the cost of software maintenance Why Do We In some situations, it may not be possible to re-run all test cases on a system Prioritize Test Cases? By prioritizing test cases , we aim to ensure faults are detected in the smallest amount of time irrespective of program changes DPATERSON1@SHEFFIELD.AC.UK

  6. How Do We Prioritize Test Cases? t 1 t 2 t 3 t 4 t n-3 t n-2 t n-1 t n Version 1 ✅ ✅ ✅ ❌ ✅ ✅ ✅ ✅ Version 2 ✅ ✅ ✅ ❌ ✅ ✅ ✅ ✅ Version 3 ✅ ✅ ✅ ❌ ✅ ✅ ✅ ✅ ... Version 4 ✅ ✅ ✅ ❌ ❌ ✅ ✅ ✅ Version 5 ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅ Version 6 ✅ ✅ ✅ ✅ ✅ ❌ ✅ ✅ Version 7 ✅ ✅ ❌ ✅ ✅ ❌ ✅ ✅ Version 8 ✅ ✅ ✅ ✅ ✅ ❌ ✅ ✅ Version 9 ❌ ✅ ✅ ✅ ✅ ✅ ✅ ✅ Version n ❓ ❓ ❓ ❓ ❓ ❓ ❓ ❓ Version n+1 ❓ ❓ ❓ ❓ ❓ ❓ ❓ ❓ DPATERSON1@SHEFFIELD.AC.UK

  7. How Do We Prioritize Test Cases? This Paper Code Coverage Test History Defect Prediction: “How many lines of “Has this test case “What is the code are executed failed recently?” likelihood that this by this test case?” code is faulty?” public int abs( int x){ if (x >= 0) { return x; } else { return – x; } } DPATERSON1@SHEFFIELD.AC.UK

  8. Defect Prediction for Test Case Prioritization ClassA ClassB ClassC ClassD 33% 10% 72% 3% DPATERSON1@SHEFFIELD.AC.UK

  9. Defect Prediction for Test Case Prioritization ClassC 72% DPATERSON1@SHEFFIELD.AC.UK

  10. Defect Prediction for Test Case Prioritization ClassC Test Cases that execute code in ClassC: - TestClass.testOne - TestClass.testSeventy - OtherTestClass.testFive - OtherTestClass.testThirteen 72% - TestClassThree.test165 How do we order these test cases before placing them in the prioritized suite? DPATERSON1@SHEFFIELD.AC.UK

  11. Secondary Objectives Test Cases that execute code in ClassC: - TestClass.testOne - TestClass.testSeventy - OtherTestClass.testFive - OtherTestClass.testThirteen - TestClassThree.test165 We can use one of the features described earlier (e.g. code coverage) as a way of ordering the subset of test cases DPATERSON1@SHEFFIELD.AC.UK

  12. Secondary Objectives Test Cases that execute code in ClassC: Lines Covered: - TestClass.testOne 25 - TestClass.testSeventy 32 - OtherTestClass.testFive 144 - OtherTestClass.testThirteen 8 - TestClassThree.test165 39 We can use one of the features described earlier (e.g. code coverage) as a way of ordering the subset of test cases DPATERSON1@SHEFFIELD.AC.UK

  13. Secondary Objectives Test Cases that execute code in ClassC: Lines Covered: - OtherTestClass.testFive 144 - TestClassThree.test165 39 - TestClass.testSeventy 32 - TestClass.testOne 25 - OtherTestClass.testThirteen 8 We can use one of the features described earlier (e.g. code coverage) as a way of ordering the subset of test cases DPATERSON1@SHEFFIELD.AC.UK

  14. Defect Prediction for Test Case Prioritization ClassC Test Cases that execute code in ClassC: - OtherTestClass.testFive - TestClassThree.test165 - TestClass.testSeventy - TestClass.testOne 72% - OtherTestClass.testThirteen Prioritized Test Suite: DPATERSON1@SHEFFIELD.AC.UK

  15. Defect Prediction for Test Case Prioritization ClassC Test Cases that execute code in ClassC: 72% Prioritized Test Suite: - OtherTestClass.testFive - TestClassThree.test165 - TestClass.testSeventy - TestClass.testOne - OtherTestClass.testThirteen DPATERSON1@SHEFFIELD.AC.UK

  16. Defect Prediction for Test Case Prioritization ClassA Test Cases that execute code in ClassA: Lines Covered: - ClassATest.testA 14 - ClassATest.testB 27 - ClassATest.testC 9 33% Prioritized Test Suite: - OtherTestClass.testFive - TestClassThree.test165 - TestClass.testSeventy - TestClass.testOne - OtherTestClass.testThirteen DPATERSON1@SHEFFIELD.AC.UK

  17. Defect Prediction for Test Case Prioritization ClassA Test Cases that execute code in ClassA: Lines Covered: - ClassATest.testB 27 - ClassATest.testA 14 - ClassATest.testC 9 33% Prioritized Test Suite: - OtherTestClass.testFive - TestClassThree.test165 - TestClass.testSeventy - TestClass.testOne - OtherTestClass.testThirteen DPATERSON1@SHEFFIELD.AC.UK

  18. Defect Prediction for Test Case Prioritization ClassA Test Cases that execute code in ClassA: Prioritized Test Suite: - OtherTestClass.testFive 33% - TestClassThree.test165 - TestClass.testSeventy - TestClass.testOne - OtherTestClass.testThirteen - ClassATest.testB - ClassATest.testA - ClassATest.testC DPATERSON1@SHEFFIELD.AC.UK

  19. By repeating this process for all Defect classes in the system, we Prediction for Test Case generate a fully prioritized test Prioritization suite based on defect prediction DPATERSON1@SHEFFIELD.AC.UK

  20. Empirical Evaluation DPATERSON1@SHEFFIELD.AC.UK

  21. Empirical Evaluation Defect Prediction: Schwa [1] Uses version control information to produce defect prediction scores comprised of weighted number of commits, authors, and fixes related to a file [1] - https://github.com/andrefreitas/schwa DPATERSON1@SHEFFIELD.AC.UK

  22. Empirical Evaluation Defect Prediction: Schwa [1] Uses version control information to produce defect prediction scores comprised of weighted number of commits, authors, and fixes related to a file D EFECTS 4J [2] Faults: Repository containing 395 real faults collected across 6 open- source Java projects [1] - https://github.com/andrefreitas/schwa [2] - https://github.com/rjust/defects4j DPATERSON1@SHEFFIELD.AC.UK

  23. Empirical Evaluation Defect Prediction: Schwa [1] Uses version control information to produce defect prediction scores comprised of weighted number of commits, authors, and fixes related to a file D EFECTS 4J [2] Faults: Repository containing 395 real faults collected across 6 open- source Java projects Test Prioritization: K ANONIZO [3] Test Case Prioritization tool built for Java Applications [1] - https://github.com/andrefreitas/schwa [2] - https://github.com/rjust/defects4j [3] - https://github.com/kanonizo/kanonizo DPATERSON1@SHEFFIELD.AC.UK

  24. 1 2 3 Discover the best Compare our approach Compare our approach parameters for defect against existing against existing prediction in order to coverage-based / history-based predict faulty classes as approaches approaches soon as possible Research Objectives DPATERSON1@SHEFFIELD.AC.UK

  25. 1 1.Revisions Weight 2.Authors Weight Parameter 3.Fixes Weight Tuning 4.Time Weight ෍𝑺𝒇𝒘𝒋𝒕𝒋𝒑𝒐𝒕𝑿𝒇𝒋𝒉𝒊𝒖 + 𝑩𝒗𝒖𝒊𝒑𝒔𝒕𝑿𝒇𝒋𝒉𝒊𝒖 + 𝑮𝒋𝒚𝒇𝒕𝑿𝒇𝒋𝒉𝒊𝒖 = 𝟐 DPATERSON1@SHEFFIELD.AC.UK

  26. 1 ෍ 𝑺𝒇𝒘𝒋𝒕𝒋𝒑𝒐𝒕𝑿𝒇𝒋𝒉𝒊𝒖 + 𝑩𝒗𝒖𝒊𝒑𝒔𝒕𝑿𝒇𝒋𝒉𝒊𝒖 + 𝑮𝒋𝒚𝒇𝒕𝑿𝒇𝒋𝒉𝒊𝒖 = 𝟐 Revisions Weight Authors Weight Fixes Weight Time Range 1.0 0.0 0.0 0.0 0.9 0.1 0.0 0.0 Parameter 0.8 0.2 0.0 0.0 . Tuning . . 0.0 0.0 1.0 0.9 0.0 0.0 1.0 1.0 726 Valid Configurations

  27. 1 - Select 5 bugs from each project at random - For each bug/valid configuration Parameter - Initialize Schwa with configuration and run Tuning - Collect “true” faulty class from D EFECTS 4J - Calculate index of “true” faulty class according to prediction

Recommend


More recommend