SlideShare a Scribd company logo
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, Mauricio Aniche,
Margaret-Anne Storey, Magiel Bruntink, Alberto Bacchelli
@DavideSpadini ishepard
Code review
Research Questions
RQ1: How rigorously is test code reviewed?
RQ2: What do reviewers discuss in test
code reviews?
RQ3: Which practices do reviewers follow
for test files?
RQ4: What problems and challenges do
developers face when reviewing tests?
We collected Code Reviews
from Gerrit
3 OSS: Eclipse, Qt, OpenStack
12 interviews
Research Questions
RQ1: How rigorously is test code reviewed?
RQ2: What do reviewers discuss in test
code reviews?
RQ3: Which practices do reviewers follow
for test files?
RQ4: What problems and challenges do
developers face when reviewing tests?
We collected Code Reviews
from Gerrit
3 OSS: Eclipse, Qt, OpenStack
12 interviews
RQ1: How rigorously is test code reviewed? — Method
# of
prod. files
# of
test files
# of code
reviews
# of
reviewers
# of
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
RQ1: How rigorously is test code reviewed? — Results
Together
A.java ATest.java
RQ1: How rigorously is test code reviewed? — Results
Together
A.java ATest.java
RQ1: How rigorously is test code reviewed? — Results
Together
A.java ATest.java
Production alone
A.java ATest.java
RQ1: How rigorously is test code reviewed? — Results
Together
A.java ATest.java
Production alone
A.java
RQ1: How rigorously is test code reviewed? — Results
Together
A.java ATest.java
Test alone
A.java ATest.java
Production alone
A.java
RQ1: How rigorously is test code reviewed? — Results
Together
A.java ATest.java
Production alone
A.java
Test alone
ATest.java
RQ1: How rigorously is test code reviewed? — Results
Together
A.java ATest.java
Production alone
A.java
Test alone
ATest.java
0
15
30
45
60
75
% of files with review comments
RQ1: How rigorously is test code reviewed? — Results
Together
A.java ATest.java
Production alone
A.java
Test alone
ATest.java
0
15
30
45
60
75
% of files with review comments
RQ1: How rigorously is test code reviewed? — Results
Together
A.java ATest.java
Production alone
A.java
Test alone
ATest.java
0
15
30
45
60
75
% of files with review comments
RQ1: How rigorously is test code reviewed? — Results
Together
A.java ATest.java
Production alone
A.java
Test alone
ATest.java
0
15
30
45
60
75
% of files with review comments
When together,
production code is 1.9
more likely do be discussed
RQ1: How rigorously is test code reviewed? — Results
Together
A.java ATest.java
Production alone
A.java
Test alone
ATest.java
0
15
30
45
60
75
% of files with review comments
When together,
production code is 1.9
more likely do be discussed
When taken separately,
test code is 1.16
more likely to be discussed
Avg # of comments
per file
Avg # of reviewers
Avg length of
comments
Together
Production

Test
3.00

1.27
5.49
19.09

15.32
Production alone 1.64 3.95 18.13
Test alone 2.30 5.15 17.01
RQ1: How rigorously is test code reviewed? — Results
# of comments,
avg length,
avg # reviewers
Prod. files are
2 times more likely
to be discussed
than test files
Test files are
discussed more
when alone
RQ1: How rigorously is test code reviewed? — Summary
Research Questions
RQ1: How rigorously is test code reviewed?
RQ2: What do reviewers discuss in test
code reviews?
RQ3: Which practices do reviewers follow
for test files?
RQ4: What problems and challenges do
developers face when reviewing tests?
We collected Code Reviews
from Gerrit
3 OSS: Eclipse, Qt, OpenStack
12 interviews
RQ2: What do reviewers discuss in test code reviews? — Method
> 1,000,000
comments
600
comments
1st round:
6 categories*
2nd round:
for each category,
more fine-grained
*Bacchelli & Bird. Expectations, Outcomes, and Challenges of Modern Code Review. ICSE 2013
RQ2: What do reviewers discuss in test code reviews? — Results
0% 10% 20% 30% 40%
production reviews (Bacchelli & Bird, ICSE 2013)
test reviews (this study)
Code improvements
Understanding
Social communication
Defects
Knowledge transfer
0
10
20
30
40
Testing practices Code styling Un/Tested paths Better naming Unnecessary code Assertion handling
Code improvements
RQ2: What do reviewers discuss in test code reviews? — Results
RQ2: What do reviewers discuss in test code reviews? — Results
0% 10% 20% 30% 40%
production reviews (Bacchelli & Bird, ICSE 2013)
test reviews (this study)
Understanding
Social communication
Defects
Knowledge transfer
Code improvements
0
10
20
30
40
50
Severe issues Less severe issues Wrong assertions
Defects
RQ2: What do reviewers discuss in test code reviews? — Results
“You need to instantiate
LttngKernelTrace here
otherwise you will get a
class cast exception” —
Severe issue
“This isnt being used, hence
pep8 error.” —
Less severe issue
RQ2: What do reviewers discuss in test code reviews? — Results
0% 10% 20% 30% 40%
production reviews (Bacchelli & Bird, ICSE 2013)
test reviews (this study)
Code improvements
Understanding
Social communication
Knowledge transfer
Defects
0
15
30
45
60
Link to external documentation How-to
Knowledge transfer
RQ2: What do reviewers discuss in test code reviews? — Results
RQ2: What do reviewers discuss in test code reviews? — Summary
Testing practices,
tested paths and
assertions
Defects are not
among the most
discussed topics
Developers often
comment with
how-to or ext.
documentation
Research Questions
RQ1: How rigorously is test code reviewed?
RQ2: What do reviewers discuss in test
code reviews?
RQ3: Which practices do reviewers follow
for test files?
RQ4: What problems and challenges do
developers face when reviewing tests?
We collected Code Reviews
from Gerrit
3 OSS: Eclipse, Qt, OpenStack
12 interviews
RQ3: Which practices do reviewers follow for test files? — Method
Interviews!
1 Openstack
1 Qt
1 Eclipse
1 Microsoft
1 Ericsson
2 Alura
5 OSS
12 interviews
RQ3: Which practices do reviewers follow for test files? — Method
RQ3: Which practices do reviewers follow for test files? — Summary
Checking out the
change and run
the tests
Understanding if
all paths are
covered
Test
Driven
Review
Research questions
RQ1: How rigorously is test code reviewed?
RQ2: What do reviewers discuss in test
code reviews?
RQ3: Which practices do reviewers follow
for test files?
RQ4: What problems and challenges do
developers face when reviewing tests?
We collected Code Reviews
from Gerrit
3 OSS: Eclipse, Qt, OpenStack
12 interviews
Management
policies prioritize
strongly
production code
Novice developers
do not know the
effect of poor
testing
Lack of navigation
support and in-
depth code
coverage info
Reviewing tests
requires context on
both tests and
production
RQ4: What problems and challenges do developers face when reviewing tests?
Management
policies prioritize
strongly
production code
Novice developers
do not know the
effect of poor
testing
Lack of navigation
support and in-
depth code
coverage info
Reviewing tests
requires context on
both tests and
production
RQ4: What problems and challenges do developers face when reviewing tests?
Provide the
context for
reviewing test
Plan enough
time for test
review
Educate on test
reviewing and
writing
Detailed code
coverage
information
Implications and recommendations
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!
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”
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
Metrics in order of importance
Attribute Average merit Average Rank
Churn 0.753 1
Author ownership 0.599 2.2 ± 0.4
Cumulative churn 0.588 2.8 ± 0.4
Total authors 0.521 4
Major authors 0.506 5
Size 0.411 6
Prior defects 0.293 7
Minor authors 0.149 8
Is test 0.085 9
Should test files be reviewed?
• Yes!
• The decision to review a file
should not be based on whether
the file contains production or test
code, as this has no association
with defects.

More Related Content

What's hot

Embedded SW Testing
Embedded SW TestingEmbedded SW Testing
On to code review lessons learned at microsoft
On to code review lessons learned at microsoftOn to code review lessons learned at microsoft
On to code review lessons learned at microsoft
Michaela Greiler
 
Synthesizing Continuous Deployment Practices in Software Development
Synthesizing Continuous Deployment Practices in Software DevelopmentSynthesizing Continuous Deployment Practices in Software Development
Synthesizing Continuous Deployment Practices in Software Development
Akond Rahman
 
Code review guidelines
Code review guidelinesCode review guidelines
Code review guidelines
Lalit Kale
 
Erik Boelen - Testing, The Next Level
Erik Boelen - Testing, The Next LevelErik Boelen - Testing, The Next Level
Erik Boelen - Testing, The Next Level
TEST Huddle
 
Lessons Learned in Software Quality 1
Lessons Learned in Software Quality 1Lessons Learned in Software Quality 1
Lessons Learned in Software Quality 1
Belal Raslan
 
Developer + tester = quality++
Developer + tester = quality++Developer + tester = quality++
Developer + tester = quality++
Mikalai Alimenkou
 
Test driven development
Test driven developmentTest driven development
Test driven development
namkha87
 
First steps in testing analytics: Does test code quality matter?
First steps in testing analytics: Does test code quality matter?First steps in testing analytics: Does test code quality matter?
First steps in testing analytics: Does test code quality matter?
Andy Zaidman
 
Istqb intro with question answer for exam preparation
Istqb intro with question answer for exam preparationIstqb intro with question answer for exam preparation
Istqb intro with question answer for exam preparation
Kevalkumar Shah
 
Acceptance Testing Driven Development, TDD
Acceptance Testing Driven Development, TDDAcceptance Testing Driven Development, TDD
Acceptance Testing Driven Development, TDDLaurent PY
 
Investigating Code Review Practices in Defective Files
Investigating Code Review Practices in Defective FilesInvestigating Code Review Practices in Defective Files
Investigating Code Review Practices in Defective Files
The University of Adelaide
 
Who Should Review My Code?
Who Should Review My Code?  Who Should Review My Code?
Who Should Review My Code?
The University of Adelaide
 
Using HPC Resources to Exploit Big Data for Code Review Analytics
Using HPC Resources to Exploit Big Data for Code Review AnalyticsUsing HPC Resources to Exploit Big Data for Code Review Analytics
Using HPC Resources to Exploit Big Data for Code Review Analytics
The University of Adelaide
 
Review Participation in Modern Code Review: An Empirical Study of the Android...
Review Participation in Modern Code Review: An Empirical Study of the Android...Review Participation in Modern Code Review: An Empirical Study of the Android...
Review Participation in Modern Code Review: An Empirical Study of the Android...
The University of Adelaide
 
ISTQB Foundation Level Certification - Intruduction
ISTQB Foundation Level Certification - IntruductionISTQB Foundation Level Certification - Intruduction
ISTQB Foundation Level Certification - Intruduction
QA Guards
 
Foundation level sample_exam_v2.3_answers_and_justification
Foundation level sample_exam_v2.3_answers_and_justificationFoundation level sample_exam_v2.3_answers_and_justification
Foundation level sample_exam_v2.3_answers_and_justification
Venera Romanova
 
Introduction to software engineering
Introduction to software engineeringIntroduction to software engineering
Introduction to software engineering
สาโรจน์ แสงผ่องอำไพ
 

What's hot (18)

Embedded SW Testing
Embedded SW TestingEmbedded SW Testing
Embedded SW Testing
 
On to code review lessons learned at microsoft
On to code review lessons learned at microsoftOn to code review lessons learned at microsoft
On to code review lessons learned at microsoft
 
Synthesizing Continuous Deployment Practices in Software Development
Synthesizing Continuous Deployment Practices in Software DevelopmentSynthesizing Continuous Deployment Practices in Software Development
Synthesizing Continuous Deployment Practices in Software Development
 
Code review guidelines
Code review guidelinesCode review guidelines
Code review guidelines
 
Erik Boelen - Testing, The Next Level
Erik Boelen - Testing, The Next LevelErik Boelen - Testing, The Next Level
Erik Boelen - Testing, The Next Level
 
Lessons Learned in Software Quality 1
Lessons Learned in Software Quality 1Lessons Learned in Software Quality 1
Lessons Learned in Software Quality 1
 
Developer + tester = quality++
Developer + tester = quality++Developer + tester = quality++
Developer + tester = quality++
 
Test driven development
Test driven developmentTest driven development
Test driven development
 
First steps in testing analytics: Does test code quality matter?
First steps in testing analytics: Does test code quality matter?First steps in testing analytics: Does test code quality matter?
First steps in testing analytics: Does test code quality matter?
 
Istqb intro with question answer for exam preparation
Istqb intro with question answer for exam preparationIstqb intro with question answer for exam preparation
Istqb intro with question answer for exam preparation
 
Acceptance Testing Driven Development, TDD
Acceptance Testing Driven Development, TDDAcceptance Testing Driven Development, TDD
Acceptance Testing Driven Development, TDD
 
Investigating Code Review Practices in Defective Files
Investigating Code Review Practices in Defective FilesInvestigating Code Review Practices in Defective Files
Investigating Code Review Practices in Defective Files
 
Who Should Review My Code?
Who Should Review My Code?  Who Should Review My Code?
Who Should Review My Code?
 
Using HPC Resources to Exploit Big Data for Code Review Analytics
Using HPC Resources to Exploit Big Data for Code Review AnalyticsUsing HPC Resources to Exploit Big Data for Code Review Analytics
Using HPC Resources to Exploit Big Data for Code Review Analytics
 
Review Participation in Modern Code Review: An Empirical Study of the Android...
Review Participation in Modern Code Review: An Empirical Study of the Android...Review Participation in Modern Code Review: An Empirical Study of the Android...
Review Participation in Modern Code Review: An Empirical Study of the Android...
 
ISTQB Foundation Level Certification - Intruduction
ISTQB Foundation Level Certification - IntruductionISTQB Foundation Level Certification - Intruduction
ISTQB Foundation Level Certification - Intruduction
 
Foundation level sample_exam_v2.3_answers_and_justification
Foundation level sample_exam_v2.3_answers_and_justificationFoundation level sample_exam_v2.3_answers_and_justification
Foundation level sample_exam_v2.3_answers_and_justification
 
Introduction to software engineering
Introduction to software engineeringIntroduction to software engineering
Introduction to software engineering
 

Similar to When Testing Meets Code Review: Why and How Developers Review Tests

Speculative analysis for comment quality assessment
Speculative analysis for comment quality assessmentSpeculative analysis for comment quality assessment
Speculative analysis for comment quality assessment
Pooja Rani
 
Unit testing (Exploring the other side as a tester)
Unit testing (Exploring the other side as a tester)Unit testing (Exploring the other side as a tester)
Unit testing (Exploring the other side as a tester)
Abhijeet Vaikar
 
PTAQ L - Adam Makarowicz - The quality, or there and back again
PTAQ L - Adam Makarowicz - The quality, or there and back againPTAQ L - Adam Makarowicz - The quality, or there and back again
PTAQ L - Adam Makarowicz - The quality, or there and back again
Adam Makarowicz
 
End-end tests as first class citizens - SeleniumConf 2020
End-end tests as first class citizens - SeleniumConf 2020End-end tests as first class citizens - SeleniumConf 2020
End-end tests as first class citizens - SeleniumConf 2020
Abhijeet Vaikar
 
Battle for Code Quality - A Story of One Java Project
Battle for Code Quality - A Story of One Java ProjectBattle for Code Quality - A Story of One Java Project
Battle for Code Quality - A Story of One Java Project
GlobalLogic Ukraine
 
Software presentation
Software presentationSoftware presentation
Software presentation
JennaPrengle
 
What if Clippy Would Criticize Your Code? (benevol2015)
What if Clippy Would Criticize Your Code? (benevol2015)What if Clippy Would Criticize Your Code? (benevol2015)
What if Clippy Would Criticize Your Code? (benevol2015)
Yuriy Tymchuk
 
Making the Unstable Stable - An Intro To Testing
Making the Unstable Stable - An Intro To TestingMaking the Unstable Stable - An Intro To Testing
Making the Unstable Stable - An Intro To Testing
Cameron Presley
 
Software Development Lifecycle Presentation
Software Development Lifecycle PresentationSoftware Development Lifecycle Presentation
Software Development Lifecycle Presentation
ssuser645e24
 
Tester developer interaction
Tester developer interactionTester developer interaction
Tester developer interactiongaoliang641
 
Product quality in agile project
Product quality in agile projectProduct quality in agile project
Product quality in agile project
Nhan Nguyen
 
CORRECT-ToolDemo-ASE2016
CORRECT-ToolDemo-ASE2016CORRECT-ToolDemo-ASE2016
CORRECT-ToolDemo-ASE2016
Masud Rahman
 
Top 20 software testing interview questions for sdet
Top 20 software testing interview questions for sdetTop 20 software testing interview questions for sdet
Top 20 software testing interview questions for sdet
DevLabs Alliance
 
DevLabs Alliance Top 20 Software Testing Interview Questions for SDET - by De...
DevLabs Alliance Top 20 Software Testing Interview Questions for SDET - by De...DevLabs Alliance Top 20 Software Testing Interview Questions for SDET - by De...
DevLabs Alliance Top 20 Software Testing Interview Questions for SDET - by De...
DevLabs Alliance
 
DevLabs Alliance Top 20 Software Testing Interview Questions for SDET - by De...
DevLabs Alliance Top 20 Software Testing Interview Questions for SDET - by De...DevLabs Alliance Top 20 Software Testing Interview Questions for SDET - by De...
DevLabs Alliance Top 20 Software Testing Interview Questions for SDET - by De...
DevLabs Alliance
 
What Do Developers Discuss about Code Comments?
What Do Developers Discuss about Code Comments?What Do Developers Discuss about Code Comments?
What Do Developers Discuss about Code Comments?
Pooja Rani
 
Code Reviews
Code ReviewsCode Reviews
Code Reviews
phildenoncourt
 
КАТЕРИНА АБЗЯТОВА - Certify with confidence: ISTQB Foundation 4.0. Common err...
КАТЕРИНА АБЗЯТОВА - Certify with confidence: ISTQB Foundation 4.0. Common err...КАТЕРИНА АБЗЯТОВА - Certify with confidence: ISTQB Foundation 4.0. Common err...
КАТЕРИНА АБЗЯТОВА - Certify with confidence: ISTQB Foundation 4.0. Common err...
QADay
 
Test Driven Development - Overview and Adoption
Test Driven Development - Overview and AdoptionTest Driven Development - Overview and Adoption
Test Driven Development - Overview and Adoption
Pyxis Technologies
 
Software testing
Software testingSoftware testing
Software testingthaneofife
 

Similar to When Testing Meets Code Review: Why and How Developers Review Tests (20)

Speculative analysis for comment quality assessment
Speculative analysis for comment quality assessmentSpeculative analysis for comment quality assessment
Speculative analysis for comment quality assessment
 
Unit testing (Exploring the other side as a tester)
Unit testing (Exploring the other side as a tester)Unit testing (Exploring the other side as a tester)
Unit testing (Exploring the other side as a tester)
 
PTAQ L - Adam Makarowicz - The quality, or there and back again
PTAQ L - Adam Makarowicz - The quality, or there and back againPTAQ L - Adam Makarowicz - The quality, or there and back again
PTAQ L - Adam Makarowicz - The quality, or there and back again
 
End-end tests as first class citizens - SeleniumConf 2020
End-end tests as first class citizens - SeleniumConf 2020End-end tests as first class citizens - SeleniumConf 2020
End-end tests as first class citizens - SeleniumConf 2020
 
Battle for Code Quality - A Story of One Java Project
Battle for Code Quality - A Story of One Java ProjectBattle for Code Quality - A Story of One Java Project
Battle for Code Quality - A Story of One Java Project
 
Software presentation
Software presentationSoftware presentation
Software presentation
 
What if Clippy Would Criticize Your Code? (benevol2015)
What if Clippy Would Criticize Your Code? (benevol2015)What if Clippy Would Criticize Your Code? (benevol2015)
What if Clippy Would Criticize Your Code? (benevol2015)
 
Making the Unstable Stable - An Intro To Testing
Making the Unstable Stable - An Intro To TestingMaking the Unstable Stable - An Intro To Testing
Making the Unstable Stable - An Intro To Testing
 
Software Development Lifecycle Presentation
Software Development Lifecycle PresentationSoftware Development Lifecycle Presentation
Software Development Lifecycle Presentation
 
Tester developer interaction
Tester developer interactionTester developer interaction
Tester developer interaction
 
Product quality in agile project
Product quality in agile projectProduct quality in agile project
Product quality in agile project
 
CORRECT-ToolDemo-ASE2016
CORRECT-ToolDemo-ASE2016CORRECT-ToolDemo-ASE2016
CORRECT-ToolDemo-ASE2016
 
Top 20 software testing interview questions for sdet
Top 20 software testing interview questions for sdetTop 20 software testing interview questions for sdet
Top 20 software testing interview questions for sdet
 
DevLabs Alliance Top 20 Software Testing Interview Questions for SDET - by De...
DevLabs Alliance Top 20 Software Testing Interview Questions for SDET - by De...DevLabs Alliance Top 20 Software Testing Interview Questions for SDET - by De...
DevLabs Alliance Top 20 Software Testing Interview Questions for SDET - by De...
 
DevLabs Alliance Top 20 Software Testing Interview Questions for SDET - by De...
DevLabs Alliance Top 20 Software Testing Interview Questions for SDET - by De...DevLabs Alliance Top 20 Software Testing Interview Questions for SDET - by De...
DevLabs Alliance Top 20 Software Testing Interview Questions for SDET - by De...
 
What Do Developers Discuss about Code Comments?
What Do Developers Discuss about Code Comments?What Do Developers Discuss about Code Comments?
What Do Developers Discuss about Code Comments?
 
Code Reviews
Code ReviewsCode Reviews
Code Reviews
 
КАТЕРИНА АБЗЯТОВА - Certify with confidence: ISTQB Foundation 4.0. Common err...
КАТЕРИНА АБЗЯТОВА - Certify with confidence: ISTQB Foundation 4.0. Common err...КАТЕРИНА АБЗЯТОВА - Certify with confidence: ISTQB Foundation 4.0. Common err...
КАТЕРИНА АБЗЯТОВА - Certify with confidence: ISTQB Foundation 4.0. Common err...
 
Test Driven Development - Overview and Adoption
Test Driven Development - Overview and AdoptionTest Driven Development - Overview and Adoption
Test Driven Development - Overview and Adoption
 
Software testing
Software testingSoftware testing
Software testing
 

More from Delft University of Technology

Investigating Severity Thresholds for Test Smells
Investigating Severity Thresholds for Test SmellsInvestigating Severity Thresholds for Test Smells
Investigating Severity Thresholds for Test Smells
Delft University of Technology
 
Primers or Reminders? The Effects of Existing Review Comments on Code Review
Primers or Reminders? The Effects of Existing Review Comments on Code ReviewPrimers or Reminders? The Effects of Existing Review Comments on Code Review
Primers or Reminders? The Effects of Existing Review Comments on Code Review
Delft University of Technology
 
Practices and Tools for Better Software Testing
Practices and Tools for  Better Software TestingPractices and Tools for  Better Software Testing
Practices and Tools for Better Software Testing
Delft University of Technology
 
PyDriller: Python Framework for Mining Software Repositories
PyDriller: Python Framework for Mining Software RepositoriesPyDriller: Python Framework for Mining Software Repositories
PyDriller: Python Framework for Mining Software Repositories
Delft University of Technology
 
On The Relation of Test Smells to Software Code Quality
On The Relation of Test Smells to Software Code QualityOn The Relation of Test Smells to Software Code Quality
On The Relation of Test Smells to Software Code Quality
Delft University of Technology
 
To Mock or Not To Mock
To Mock or Not To MockTo Mock or Not To Mock
To Mock or Not To Mock
Delft University of Technology
 

More from Delft University of Technology (6)

Investigating Severity Thresholds for Test Smells
Investigating Severity Thresholds for Test SmellsInvestigating Severity Thresholds for Test Smells
Investigating Severity Thresholds for Test Smells
 
Primers or Reminders? The Effects of Existing Review Comments on Code Review
Primers or Reminders? The Effects of Existing Review Comments on Code ReviewPrimers or Reminders? The Effects of Existing Review Comments on Code Review
Primers or Reminders? The Effects of Existing Review Comments on Code Review
 
Practices and Tools for Better Software Testing
Practices and Tools for  Better Software TestingPractices and Tools for  Better Software Testing
Practices and Tools for Better Software Testing
 
PyDriller: Python Framework for Mining Software Repositories
PyDriller: Python Framework for Mining Software RepositoriesPyDriller: Python Framework for Mining Software Repositories
PyDriller: Python Framework for Mining Software Repositories
 
On The Relation of Test Smells to Software Code Quality
On The Relation of Test Smells to Software Code QualityOn The Relation of Test Smells to Software Code Quality
On The Relation of Test Smells to Software Code Quality
 
To Mock or Not To Mock
To Mock or Not To MockTo Mock or Not To Mock
To Mock or Not To Mock
 

Recently uploaded

MCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdfMCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdf
Osamah Alsalih
 
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
H.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdfH.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdf
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
MLILAB
 
block diagram and signal flow graph representation
block diagram and signal flow graph representationblock diagram and signal flow graph representation
block diagram and signal flow graph representation
Divya Somashekar
 
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
ydteq
 
Investor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptxInvestor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptx
AmarGB2
 
English lab ppt no titlespecENG PPTt.pdf
English lab ppt no titlespecENG PPTt.pdfEnglish lab ppt no titlespecENG PPTt.pdf
English lab ppt no titlespecENG PPTt.pdf
BrazilAccount1
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
zwunae
 
Immunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary AttacksImmunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary Attacks
gerogepatton
 
DESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docxDESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docx
FluxPrime1
 
Gen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdfGen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdf
gdsczhcet
 
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdfGoverning Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
WENKENLI1
 
weather web application report.pdf
weather web application report.pdfweather web application report.pdf
weather web application report.pdf
Pratik Pawar
 
Runway Orientation Based on the Wind Rose Diagram.pptx
Runway Orientation Based on the Wind Rose Diagram.pptxRunway Orientation Based on the Wind Rose Diagram.pptx
Runway Orientation Based on the Wind Rose Diagram.pptx
SupreethSP4
 
ethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.pptethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.ppt
Jayaprasanna4
 
Hierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power SystemHierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power System
Kerry Sado
 
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang,  ICLR 2024, MLILAB, KAIST AI.pdfJ.Yang,  ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
MLILAB
 
The Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdfThe Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdf
Pipe Restoration Solutions
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
fxintegritypublishin
 
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
SamSarthak3
 
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdfWater Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation & Control
 

Recently uploaded (20)

MCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdfMCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdf
 
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
H.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdfH.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdf
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
 
block diagram and signal flow graph representation
block diagram and signal flow graph representationblock diagram and signal flow graph representation
block diagram and signal flow graph representation
 
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
 
Investor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptxInvestor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptx
 
English lab ppt no titlespecENG PPTt.pdf
English lab ppt no titlespecENG PPTt.pdfEnglish lab ppt no titlespecENG PPTt.pdf
English lab ppt no titlespecENG PPTt.pdf
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
 
Immunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary AttacksImmunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary Attacks
 
DESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docxDESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docx
 
Gen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdfGen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdf
 
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdfGoverning Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
 
weather web application report.pdf
weather web application report.pdfweather web application report.pdf
weather web application report.pdf
 
Runway Orientation Based on the Wind Rose Diagram.pptx
Runway Orientation Based on the Wind Rose Diagram.pptxRunway Orientation Based on the Wind Rose Diagram.pptx
Runway Orientation Based on the Wind Rose Diagram.pptx
 
ethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.pptethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.ppt
 
Hierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power SystemHierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power System
 
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang,  ICLR 2024, MLILAB, KAIST AI.pdfJ.Yang,  ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
 
The Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdfThe Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdf
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
 
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
 
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdfWater Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdf
 

When Testing Meets Code Review: Why and How Developers Review Tests

  • 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.
  • 5. Research Questions RQ1: How rigorously is test code reviewed? RQ2: What do reviewers discuss in test code reviews? RQ3: Which practices do reviewers follow for test files? RQ4: What problems and challenges do developers face when reviewing tests? We collected Code Reviews from Gerrit 3 OSS: Eclipse, Qt, OpenStack 12 interviews
  • 6. Research Questions RQ1: How rigorously is test code reviewed? RQ2: What do reviewers discuss in test code reviews? RQ3: Which practices do reviewers follow for test files? RQ4: What problems and challenges do developers face when reviewing tests? We collected Code Reviews from Gerrit 3 OSS: Eclipse, Qt, OpenStack 12 interviews
  • 7. RQ1: How rigorously is test code reviewed? — Method # of prod. files # of test files # of code reviews # of reviewers # of 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
  • 8. RQ1: How rigorously is test code reviewed? — Results Together A.java ATest.java
  • 9. RQ1: How rigorously is test code reviewed? — Results Together A.java ATest.java
  • 10. RQ1: How rigorously is test code reviewed? — Results Together A.java ATest.java Production alone A.java ATest.java
  • 11. RQ1: How rigorously is test code reviewed? — Results Together A.java ATest.java Production alone A.java
  • 12. RQ1: How rigorously is test code reviewed? — Results Together A.java ATest.java Test alone A.java ATest.java Production alone A.java
  • 13. RQ1: How rigorously is test code reviewed? — Results Together A.java ATest.java Production alone A.java Test alone ATest.java
  • 14. RQ1: How rigorously is test code reviewed? — Results Together A.java ATest.java Production alone A.java Test alone ATest.java 0 15 30 45 60 75 % of files with review comments
  • 15. RQ1: How rigorously is test code reviewed? — Results Together A.java ATest.java Production alone A.java Test alone ATest.java 0 15 30 45 60 75 % of files with review comments
  • 16. RQ1: How rigorously is test code reviewed? — Results Together A.java ATest.java Production alone A.java Test alone ATest.java 0 15 30 45 60 75 % of files with review comments
  • 17. RQ1: How rigorously is test code reviewed? — Results Together A.java ATest.java Production alone A.java Test alone ATest.java 0 15 30 45 60 75 % of files with review comments When together, production code is 1.9 more likely do be discussed
  • 18. RQ1: How rigorously is test code reviewed? — Results Together A.java ATest.java Production alone A.java Test alone ATest.java 0 15 30 45 60 75 % of files with review comments When together, production code is 1.9 more likely do be discussed When taken separately, test code is 1.16 more likely to be discussed
  • 19. Avg # of comments per file Avg # of reviewers Avg length of comments Together Production Test 3.00 1.27 5.49 19.09 15.32 Production alone 1.64 3.95 18.13 Test alone 2.30 5.15 17.01 RQ1: How rigorously is test code reviewed? — Results
  • 20. # of comments, avg length, avg # reviewers Prod. files are 2 times more likely to be discussed than test files Test files are discussed more when alone RQ1: How rigorously is test code reviewed? — Summary
  • 21. Research Questions RQ1: How rigorously is test code reviewed? RQ2: What do reviewers discuss in test code reviews? RQ3: Which practices do reviewers follow for test files? RQ4: What problems and challenges do developers face when reviewing tests? We collected Code Reviews from Gerrit 3 OSS: Eclipse, Qt, OpenStack 12 interviews
  • 22. RQ2: What do reviewers discuss in test code reviews? — Method > 1,000,000 comments 600 comments 1st round: 6 categories* 2nd round: for each category, more fine-grained *Bacchelli & Bird. Expectations, Outcomes, and Challenges of Modern Code Review. ICSE 2013
  • 23. RQ2: What do reviewers discuss in test code reviews? — Results 0% 10% 20% 30% 40% production reviews (Bacchelli & Bird, ICSE 2013) test reviews (this study) Code improvements Understanding Social communication Defects Knowledge transfer
  • 24. 0 10 20 30 40 Testing practices Code styling Un/Tested paths Better naming Unnecessary code Assertion handling Code improvements RQ2: What do reviewers discuss in test code reviews? — Results
  • 25. RQ2: What do reviewers discuss in test code reviews? — Results 0% 10% 20% 30% 40% production reviews (Bacchelli & Bird, ICSE 2013) test reviews (this study) Understanding Social communication Defects Knowledge transfer Code improvements
  • 26. 0 10 20 30 40 50 Severe issues Less severe issues Wrong assertions Defects RQ2: What do reviewers discuss in test code reviews? — Results “You need to instantiate LttngKernelTrace here otherwise you will get a class cast exception” — Severe issue “This isnt being used, hence pep8 error.” — Less severe issue
  • 27. RQ2: What do reviewers discuss in test code reviews? — Results 0% 10% 20% 30% 40% production reviews (Bacchelli & Bird, ICSE 2013) test reviews (this study) Code improvements Understanding Social communication Knowledge transfer Defects
  • 28. 0 15 30 45 60 Link to external documentation How-to Knowledge transfer RQ2: What do reviewers discuss in test code reviews? — Results
  • 29. RQ2: What do reviewers discuss in test code reviews? — Summary Testing practices, tested paths and assertions Defects are not among the most discussed topics Developers often comment with how-to or ext. documentation
  • 30. Research Questions RQ1: How rigorously is test code reviewed? RQ2: What do reviewers discuss in test code reviews? RQ3: Which practices do reviewers follow for test files? RQ4: What problems and challenges do developers face when reviewing tests? We collected Code Reviews from Gerrit 3 OSS: Eclipse, Qt, OpenStack 12 interviews
  • 31. RQ3: Which practices do reviewers follow for test files? — Method Interviews!
  • 32. 1 Openstack 1 Qt 1 Eclipse 1 Microsoft 1 Ericsson 2 Alura 5 OSS 12 interviews RQ3: Which practices do reviewers follow for test files? — Method
  • 33. RQ3: Which practices do reviewers follow for test files? — Summary Checking out the change and run the tests Understanding if all paths are covered Test Driven Review
  • 34. Research questions RQ1: How rigorously is test code reviewed? RQ2: What do reviewers discuss in test code reviews? RQ3: Which practices do reviewers follow for test files? RQ4: What problems and challenges do developers face when reviewing tests? We collected Code Reviews from Gerrit 3 OSS: Eclipse, Qt, OpenStack 12 interviews
  • 35. Management policies prioritize strongly production code Novice developers do not know the effect of poor testing Lack of navigation support and in- depth code coverage info Reviewing tests requires context on both tests and production RQ4: What problems and challenges do developers face when reviewing tests?
  • 36. Management policies prioritize strongly production code Novice developers do not know the effect of poor testing Lack of navigation support and in- depth code coverage info Reviewing tests requires context on both tests and production RQ4: What problems and challenges do developers face when reviewing tests? Provide the context for reviewing test Plan enough time for test review Educate on test reviewing and writing Detailed code coverage information Implications and recommendations
  • 37.
  • 38. 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!
  • 39. 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”
  • 40. 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
  • 41. Metrics in order of importance Attribute Average merit Average Rank Churn 0.753 1 Author ownership 0.599 2.2 ± 0.4 Cumulative churn 0.588 2.8 ± 0.4 Total authors 0.521 4 Major authors 0.506 5 Size 0.411 6 Prior defects 0.293 7 Minor authors 0.149 8 Is test 0.085 9 Should test files be reviewed? • Yes! • The decision to review a file should not be based on whether the file contains production or test code, as this has no association with defects.