when testing meets code review why and how developers
play

When testing meets Code Review: Why and How Developers Review Tests - PowerPoint PPT Presentation

When testing meets Code Review: Why and How Developers Review Tests Davide Spadini, Mauricio Aniche, Margaret-Anne Storey, Magiel Bruntink, Alberto Bacchelli When testing meets Code Review: Why and How Developers Review Tests Davide Spadini ,


  1. When testing meets Code Review: Why and How Developers Review Tests Davide Spadini, Mauricio Aniche, Margaret-Anne Storey, Magiel Bruntink, Alberto Bacchelli

  2. When testing meets Code Review: Why and How Developers Review Tests Davide Spadini , Mauricio Aniche, Margaret-Anne Storey, Magiel Bruntink, Alberto Bacchelli @DavideSpadini ishepard

  3. Code review

  4. Research Questions We collected Code Reviews from Gerrit RQ1: How rigorously is test code reviewed? RQ2: What do reviewers discuss in test code reviews? 3 OSS: Eclipse, Qt, OpenStack RQ3: Which practices do reviewers follow 12 interviews for test files? RQ4: What problems and challenges do developers face when reviewing tests?

  5. Research Questions We collected Code Reviews from Gerrit RQ1: How rigorously is test code reviewed? RQ2: What do reviewers discuss in test code reviews? 3 OSS: Eclipse, Qt, OpenStack RQ3: Which practices do reviewers follow 12 interviews for test files? RQ4: What problems and challenges do developers face when reviewing tests?

  6. RQ1: How rigorously is test code reviewed? — Method # of # of # of code # of # of prod. files test files reviews reviewers comments Eclipse 215k 19k 60k 1k 95k Openstack 75k 48k 199k 9k 894k Qt 158k 8k 114k 1k 19k Total 450k 77k 374k 12k 1,010k

  7. RQ1: How rigorously is test code reviewed? — Results Together A.java ATest.java

  8. RQ1: How rigorously is test code reviewed? — Results Together A.java ATest.java

  9. RQ1: How rigorously is test code reviewed? — Results Production alone A.java ATest.java Together A.java ATest.java

  10. RQ1: How rigorously is test code reviewed? — Results Together Production alone A.java ATest.java A.java

  11. RQ1: How rigorously is test code reviewed? — Results Test alone A.java ATest.java Together Production alone A.java ATest.java A.java

  12. RQ1: How rigorously is test code reviewed? — Results Together Production alone Test alone A.java ATest.java A.java ATest.java

  13. RQ1: How rigorously is test code reviewed? — Results % of files with review comments 75 60 45 30 15 0 Together Production alone Test alone A.java ATest.java A.java ATest.java

  14. RQ1: How rigorously is test code reviewed? — Results % of files with review comments 75 60 45 30 15 0 Together Production alone Test alone A.java ATest.java A.java ATest.java

  15. RQ1: How rigorously is test code reviewed? — Results % of files with review comments 75 60 45 30 15 0 Together Production alone Test alone A.java ATest.java A.java ATest.java

  16. RQ1: How rigorously is test code reviewed? — Results % of files with review comments 75 When together, 60 production code is 1.9 45 more likely do be discussed 30 15 0 Together Production alone Test alone A.java ATest.java A.java ATest.java

  17. RQ1: How rigorously is test code reviewed? — Results % of files with review comments 75 When together, When taken separately, 60 production code is 1.9 test code is 1.16 45 more likely do be discussed more likely to be discussed 30 15 0 Together Production alone Test alone A.java ATest.java A.java ATest.java

  18. RQ1: How rigorously is test code reviewed? — Results Avg # of comments Avg length of Avg # of reviewers per file comments Together Production 3.00 19.09 5.49 Test 1.27 15.32 Production alone 1.64 3.95 18.13 Test alone 2.30 5.15 17.01

  19. RQ1: How rigorously is test code reviewed? — Summary Prod. files are Test files are # of comments, 2 times more likely discussed more avg length, to be discussed when alone avg # reviewers than test files

  20. Research Questions We collected Code Reviews from Gerrit RQ1: How rigorously is test code reviewed? RQ2: What do reviewers discuss in test code reviews? 3 OSS: Eclipse, Qt, OpenStack RQ3: Which practices do reviewers follow 12 interviews for test files? RQ4: What problems and challenges do developers face when reviewing tests?

  21. RQ2: What do reviewers discuss in test code reviews? — Method > 1,000,000 comments 600 comments 2nd round: 1st round: for each category, 6 categories* more fine-grained *Bacchelli & Bird. Expectations, Outcomes, and Challenges of Modern Code Review . ICSE 2013

  22. RQ2: What do reviewers discuss in test code reviews? — Results Code improvements Understanding Social communication Defects Knowledge transfer 0% 10% 20% 30% 40% production reviews (Bacchelli & Bird, ICSE 2013) test reviews (this study)

  23. RQ2: What do reviewers discuss in test code reviews? — Results Code improvements 40 30 20 10 0 Testing practices Code styling Un/Tested paths Better naming Unnecessary code Assertion handling

  24. RQ2: What do reviewers discuss in test code reviews? — Results Code improvements Understanding Social communication Defects Knowledge transfer 0% 10% 20% 30% 40% production reviews (Bacchelli & Bird, ICSE 2013) test reviews (this study)

  25. RQ2: What do reviewers discuss in test code reviews? — Results Defects “You need to instantiate 50 LttngKernelTrace here otherwise you will get a class cast exception” — 40 Severe issue 30 “This isnt being used, hence pep8 error.” — 20 Less severe issue 10 0 Severe issues Less severe issues Wrong assertions

  26. RQ2: What do reviewers discuss in test code reviews? — Results Code improvements Understanding Social communication Defects Knowledge transfer 0% 10% 20% 30% 40% production reviews (Bacchelli & Bird, ICSE 2013) test reviews (this study)

  27. RQ2: What do reviewers discuss in test code reviews? — Results Knowledge transfer 60 45 30 15 0 Link to external documentation How-to

  28. RQ2: What do reviewers discuss in test code reviews? — Summary Developers often Testing practices, Defects are not comment with tested paths and among the most how-to or ext. assertions discussed topics documentation

  29. Research Questions We collected Code Reviews from Gerrit RQ1: How rigorously is test code reviewed? RQ2: What do reviewers discuss in test code reviews? 3 OSS: Eclipse, Qt, OpenStack RQ3: Which practices do reviewers follow 12 interviews for test files? RQ4: What problems and challenges do developers face when reviewing tests?

  30. RQ3: Which practices do reviewers follow for test files? — Method Interviews!

  31. RQ3: Which practices do reviewers follow for test files? — Method 12 interviews 1 Openstack 1 Qt 1 Eclipse 1 Microsoft 1 Ericsson 2 Alura 5 OSS

  32. RQ3: Which practices do reviewers follow for test files? — Summary Test Checking out the Understanding if Driven change and run all paths are the tests covered Review

  33. Research questions We collected Code Reviews from Gerrit RQ1: How rigorously is test code reviewed? RQ2: What do reviewers discuss in test code reviews? 3 OSS: Eclipse, Qt, OpenStack RQ3: Which practices do reviewers follow 12 interviews for test files? RQ4: What problems and challenges do developers face when reviewing tests?

  34. RQ4: What problems and challenges do developers face when reviewing tests? Lack of navigation Reviewing tests Management Novice developers support and in- requires context on policies prioritize do not know the depth code both tests and strongly effect of poor coverage info production production code testing

  35. RQ4: What problems and challenges do developers face when reviewing tests? Lack of navigation Reviewing tests Management Novice developers support and in- requires context on policies prioritize do not know the depth code both tests and strongly effect of poor coverage info production production code testing Implications and recommendations Provide the Plan enough Educate on test Detailed code context for time for test reviewing and coverage reviewing test review writing information

  36. Code Review •Developers have limited time to do code review •Should test files be reviewed? •If production files are more prone to contain bugs…reviewer should focus on production!

  37. Should test files be reviewed? • We conducted a preliminary investigation to see whether test and production code files are equally associated with defects • We built a statistical model and used as an explanatory variable “being a test”

  38. Should test files be reviewed? • 3 OSS projects: Qt, Eclipse and Openstack • Dependent variable: post-release defects • Explanatory variables: metrics well related to defect proneness: product metrics, process metrics and human factors. ‣ Plus, our variable: isTest

  39. Metrics in order of importance Attribute Average merit Average Rank Churn 0.753 1 Should test files be reviewed? Author ownership 0.599 2.2 ± 0.4 • Yes! Cumulative churn 0.588 2.8 ± 0.4 Total authors 0.521 4 • The decision to review a file Major authors 0.506 5 should not be based on whether the file contains production or test Size 0.411 6 code, as this has no association Prior defects 0.293 7 with defects. Minor authors 0.149 8 Is test 0.085 9

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