SlideShare a Scribd company logo
1 of 57
First Steps in Testing Analytics: 
Does Test Code Quality Matter? 
Andy Zaidman 
Delft University of Technology 
Nederlandse Testdag 
17 november 2014, Amersfoort
Joint work with Moritz Beller & Georgios Gousios 
(TU Delft) 
Dimitrios Athanasiou, Ariadi 
Nugroho & Joost Visser 
(Software Improvement Group)
Who am I? 
Software engineering 
teacher by day 
Testing 
evangelist 
Software engineering 
researcher by night
What would you like to know? 
What analytics? 
• ???
WHAT EVER HAP P ENS…
@azaidman
TODAY 
2 test analytics stories
STORY 1 
Test Code Quality 
Matters
Andy teaching 
First year programming course @ TU Delft 
 In week 3 everyone is unit testing 
“I don’t have time for testing” 
“I don’t like testing, my code is good 
anyway” 
“How much should I test?” 
“How good should my test code be?”
@Test 
public void testConstructor() { 
assertTrue(true) 
} 
Solution 1
Solution 2 
@Test 
public void testConstructor() { 
House h = new House(“Street”, “9”); 
assertEquals(“Street 9”, h.toString()); 
}
Solution 3 
@Test 
public void testConstructor() { 
House h = new House(“Street”, “9”); 
assertEquals(“Street”, h.getStreet()); 
assertEquals(9, h.getNumber()); 
}
Solution 4 
@Test 
public void testConstructorStreet() { 
House h = new House(“Street”, “9”); 
assertEquals(“Street”, h.getStreet()); 
} 
@Test 
public void testConstructorNumber() { 
House h = new House(“Street”, “9”); 
assertEquals(9, h.getNumber()); 
}
My first reaction?
SHOOT 
FIRST
BRINGS US 
NOWHERE
Analytics?
Testing Analytics!
Thou shalt not 
have less than 
70% coverage
What makes a 
good 
unit test? 
What makes a 
good 
integration test?
What makes a 
good 
developer test?
What makes a 
good 
developer test? 
Complete 
Effective 
Maintainable
Complete 
• How much of the code is covered by the tests? 
• How many of the decision points in the code are 
tested? 
Code coverage 
#assertions/cyclomatic complexity
Effective 
• How able is the test code to detect defects? 
• How able is the test code to locate the cause? 
Assertion density #assertions / LOCtest 
Directness unit versus integration testing
Maintainable 
• How maintainable is the system’s test code? 
Software Improvement Group quality model
Test Code Quality Model* 
Complete 
+ Effective 
+ Maintainable 
* Calibrated using 86 systems
SO 
WHAT?
Better 
tests 
Easier 
development 
?
Observation 1* 
High quality tests do not lead to quicker/easier 
bug fixing 
Why? 
The low-hanging fruit is already solved if you 
have good tests… the difficult bugs remain 
* While studying 75 years of combined development of 18 software systems
High quality tests do lead to higher productivity 
• More issues fixed per month per developer 
• More issues fixed per month per KLOC 
Why? 
Implementing new features does seem to 
benefit from having a safety net for existing 
functionality. 
Observation 2
High quality tests do make your team 
more productive!
Action(able)
#assertions 
McCabe cyclomatic complexity 
≥ 1 
The single most 
important thing for test 
code quality
…
STORY 2 
Testing takes 50% of 
your time
Says this guy 
• Study from 1975 
• Questionable research 
approach
Differences? 
• Waterfall 
• Developer testing 
• Programming language 
• Tools (e.g. IDE)
New research
+ +
Recording 
1. Time spent on developing production code 
2. Time spent on developing test code 
3. How frequently are Junit tests executed? 
4. How frequently do these test runs fail?
124 developers participating
You might win
http://testroots.org/testroots_watchdog.html
…
My ultimate dream? 
Continuous 
background 
testing
Take home 
• Test code quality matters for the productivity 
of your team 
• #assertions/cyclomatic complexity ≥ 1 
• Help us out with our research! 
a.e.zaidman@tudelft.nl 
http://azaidman.wordpress.com 
httpp://www.st.ewi.tudelft.nl/~zaidman 
@azaidman

More Related Content

What's hot

Ian Agustiawan - Tech Days
Ian Agustiawan - Tech DaysIan Agustiawan - Tech Days
Ian Agustiawan - Tech Days
Ian Agustiawan
 

What's hot (20)

Adopting Agile
Adopting AgileAdopting Agile
Adopting Agile
 
03 - chomu prohramisty ne testuiut - yurii chulovskyi - it event 2013 (5)
03 -  chomu prohramisty ne testuiut - yurii chulovskyi - it event 2013 (5)03 -  chomu prohramisty ne testuiut - yurii chulovskyi - it event 2013 (5)
03 - chomu prohramisty ne testuiut - yurii chulovskyi - it event 2013 (5)
 
Pertanyaan dan jawaban (graham et.al 2011) part 1
Pertanyaan dan jawaban (graham et.al 2011) part 1Pertanyaan dan jawaban (graham et.al 2011) part 1
Pertanyaan dan jawaban (graham et.al 2011) part 1
 
Code Review for Teams Too Busy to Review Code - Atlassian Summit 2010
Code Review for Teams Too Busy to Review Code - Atlassian Summit 2010Code Review for Teams Too Busy to Review Code - Atlassian Summit 2010
Code Review for Teams Too Busy to Review Code - Atlassian Summit 2010
 
David Hayman - Say What? Testing a Voice Avtivated System - EuroSTAR 2010
David Hayman - Say What? Testing a Voice Avtivated System - EuroSTAR 2010David Hayman - Say What? Testing a Voice Avtivated System - EuroSTAR 2010
David Hayman - Say What? Testing a Voice Avtivated System - EuroSTAR 2010
 
Bad metric, bad!
Bad metric, bad!Bad metric, bad!
Bad metric, bad!
 
Psychology and Engineering of Testing
Psychology and Engineering of TestingPsychology and Engineering of Testing
Psychology and Engineering of Testing
 
How to get the most out of code reviews
How to get the most out of code reviewsHow to get the most out of code reviews
How to get the most out of code reviews
 
[Paul Holland] Trends in Software Testing
[Paul Holland] Trends in Software Testing[Paul Holland] Trends in Software Testing
[Paul Holland] Trends in Software Testing
 
Testing for everyone
Testing for everyoneTesting for everyone
Testing for everyone
 
FutureOfTesting2008
FutureOfTesting2008FutureOfTesting2008
FutureOfTesting2008
 
Santa Barbara Agile: Exploratory Testing Explained and Experienced
Santa Barbara Agile: Exploratory Testing Explained and ExperiencedSanta Barbara Agile: Exploratory Testing Explained and Experienced
Santa Barbara Agile: Exploratory Testing Explained and Experienced
 
Ian Agustiawan - Tech Days
Ian Agustiawan - Tech DaysIan Agustiawan - Tech Days
Ian Agustiawan - Tech Days
 
Best pratice
Best praticeBest pratice
Best pratice
 
How (Much) Do Developers Test?
How (Much) Do Developers Test?How (Much) Do Developers Test?
How (Much) Do Developers Test?
 
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
 
How (Much) Do Developers Test?
How (Much) Do Developers Test?How (Much) Do Developers Test?
How (Much) Do Developers Test?
 
Continuous Integration: Finding problems soonest
Continuous Integration: Finding problems soonestContinuous Integration: Finding problems soonest
Continuous Integration: Finding problems soonest
 
A Taste of Exploratory Testing
A Taste of Exploratory TestingA Taste of Exploratory Testing
A Taste of Exploratory Testing
 
Testing strategies for legacy code
Testing strategies for legacy codeTesting strategies for legacy code
Testing strategies for legacy code
 

Viewers also liked

Data Analytics Project Plan
Data Analytics Project PlanData Analytics Project Plan
Data Analytics Project Plan
Jelilat Adesiyan
 
Data Analytics-testing spectrum
Data Analytics-testing spectrumData Analytics-testing spectrum
Data Analytics-testing spectrum
VodqaBLR
 

Viewers also liked (9)

Data Analytics Project Plan
Data Analytics Project PlanData Analytics Project Plan
Data Analytics Project Plan
 
Designing Resource-Aware Applications for the Cloud with ABS
Designing Resource-Aware Applications for the Cloud with ABSDesigning Resource-Aware Applications for the Cloud with ABS
Designing Resource-Aware Applications for the Cloud with ABS
 
Web API Fragility: How Robust Is Your Mobile Application?
Web API Fragility: How Robust Is Your Mobile Application?Web API Fragility: How Robust Is Your Mobile Application?
Web API Fragility: How Robust Is Your Mobile Application?
 
Studying Late Propagations in Code Clone Evolution Using Software Repository ...
Studying Late Propagations in Code Clone Evolution Using Software Repository ...Studying Late Propagations in Code Clone Evolution Using Software Repository ...
Studying Late Propagations in Code Clone Evolution Using Software Repository ...
 
Divide and-conquer approach towards data analytics testing
Divide and-conquer approach towards data analytics testingDivide and-conquer approach towards data analytics testing
Divide and-conquer approach towards data analytics testing
 
Data Analytics-testing spectrum
Data Analytics-testing spectrumData Analytics-testing spectrum
Data Analytics-testing spectrum
 
Mind maps tutorial Agile Testing Days
Mind maps tutorial Agile Testing DaysMind maps tutorial Agile Testing Days
Mind maps tutorial Agile Testing Days
 
ATAGTR2017 Analytics Testing
ATAGTR2017 Analytics TestingATAGTR2017 Analytics Testing
ATAGTR2017 Analytics Testing
 
10 Revealing Statistics About Compensation & Benefits You should Know
10 Revealing Statistics About Compensation & Benefits You should Know10 Revealing Statistics About Compensation & Benefits You should Know
10 Revealing Statistics About Compensation & Benefits You should Know
 

Similar to First steps in testing analytics: Does test code quality matter?

Similar to First steps in testing analytics: Does test code quality matter? (20)

Can we induce change with what we measure?
Can we induce change with what we measure?Can we induce change with what we measure?
Can we induce change with what we measure?
 
Testing As A Bottleneck - How Testing Slows Down Modern Development Processes...
Testing As A Bottleneck - How Testing Slows Down Modern Development Processes...Testing As A Bottleneck - How Testing Slows Down Modern Development Processes...
Testing As A Bottleneck - How Testing Slows Down Modern Development Processes...
 
Transferring Software Testing Tools to Practice
Transferring Software Testing Tools to PracticeTransferring Software Testing Tools to Practice
Transferring Software Testing Tools to Practice
 
Test Driven Development and Automation
Test Driven Development and AutomationTest Driven Development and Automation
Test Driven Development and Automation
 
TDD Best Practices
TDD Best PracticesTDD Best Practices
TDD Best Practices
 
What is Unit Testing
What is Unit TestingWhat is Unit Testing
What is Unit Testing
 
How to Clean Up Your Continuous Testing Suites for Web & Mobile
How to Clean Up Your Continuous Testing Suites for Web & MobileHow to Clean Up Your Continuous Testing Suites for Web & Mobile
How to Clean Up Your Continuous Testing Suites for Web & Mobile
 
Test-Driven Development in the Corporate Workplace
Test-Driven Development in the Corporate WorkplaceTest-Driven Development in the Corporate Workplace
Test-Driven Development in the Corporate Workplace
 
Getting Started with Test-Driven Development at Longhorn PHP 2023
Getting Started with Test-Driven Development at Longhorn PHP 2023Getting Started with Test-Driven Development at Longhorn PHP 2023
Getting Started with Test-Driven Development at Longhorn PHP 2023
 
Getting Started with Test-Driven Development at PHPtek 2023
Getting Started with Test-Driven Development at PHPtek 2023Getting Started with Test-Driven Development at PHPtek 2023
Getting Started with Test-Driven Development at PHPtek 2023
 
Automated Unit Testing and TDD
Automated Unit Testing and TDDAutomated Unit Testing and TDD
Automated Unit Testing and TDD
 
Software Arch TDD ppt.pdf
Software Arch TDD ppt.pdfSoftware Arch TDD ppt.pdf
Software Arch TDD ppt.pdf
 
How to Guarantee Continuous Value from your Test Automation
How to Guarantee Continuous Value from your Test AutomationHow to Guarantee Continuous Value from your Test Automation
How to Guarantee Continuous Value from your Test Automation
 
Agile testing
Agile testingAgile testing
Agile testing
 
Automatic for the People
Automatic for the PeopleAutomatic for the People
Automatic for the People
 
TDD talk
TDD talkTDD talk
TDD talk
 
A la découverte des google/test (aka gtest)
A la découverte des google/test (aka gtest)A la découverte des google/test (aka gtest)
A la découverte des google/test (aka gtest)
 
Google test training
Google test trainingGoogle test training
Google test training
 
Every code coverage tool is measuring the wrong thing (on purpose)
Every code coverage tool is measuring the wrong thing (on purpose)Every code coverage tool is measuring the wrong thing (on purpose)
Every code coverage tool is measuring the wrong thing (on purpose)
 
Test-Driven Development In Action
Test-Driven Development In ActionTest-Driven Development In Action
Test-Driven Development In Action
 

Recently uploaded

Seismic Method Estimate velocity from seismic data.pptx
Seismic Method Estimate velocity from seismic  data.pptxSeismic Method Estimate velocity from seismic  data.pptx
Seismic Method Estimate velocity from seismic data.pptx
AlMamun560346
 
Asymmetry in the atmosphere of the ultra-hot Jupiter WASP-76 b
Asymmetry in the atmosphere of the ultra-hot Jupiter WASP-76 bAsymmetry in the atmosphere of the ultra-hot Jupiter WASP-76 b
Asymmetry in the atmosphere of the ultra-hot Jupiter WASP-76 b
Sérgio Sacani
 
SCIENCE-4-QUARTER4-WEEK-4-PPT-1 (1).pptx
SCIENCE-4-QUARTER4-WEEK-4-PPT-1 (1).pptxSCIENCE-4-QUARTER4-WEEK-4-PPT-1 (1).pptx
SCIENCE-4-QUARTER4-WEEK-4-PPT-1 (1).pptx
RizalinePalanog2
 
Pests of cotton_Borer_Pests_Binomics_Dr.UPR.pdf
Pests of cotton_Borer_Pests_Binomics_Dr.UPR.pdfPests of cotton_Borer_Pests_Binomics_Dr.UPR.pdf
Pests of cotton_Borer_Pests_Binomics_Dr.UPR.pdf
PirithiRaju
 
Presentation Vikram Lander by Vedansh Gupta.pptx
Presentation Vikram Lander by Vedansh Gupta.pptxPresentation Vikram Lander by Vedansh Gupta.pptx
Presentation Vikram Lander by Vedansh Gupta.pptx
gindu3009
 
Conjugation, transduction and transformation
Conjugation, transduction and transformationConjugation, transduction and transformation
Conjugation, transduction and transformation
Areesha Ahmad
 

Recently uploaded (20)

Connaught Place, Delhi Call girls :8448380779 Model Escorts | 100% verified
Connaught Place, Delhi Call girls :8448380779 Model Escorts | 100% verifiedConnaught Place, Delhi Call girls :8448380779 Model Escorts | 100% verified
Connaught Place, Delhi Call girls :8448380779 Model Escorts | 100% verified
 
TEST BANK For Radiologic Science for Technologists, 12th Edition by Stewart C...
TEST BANK For Radiologic Science for Technologists, 12th Edition by Stewart C...TEST BANK For Radiologic Science for Technologists, 12th Edition by Stewart C...
TEST BANK For Radiologic Science for Technologists, 12th Edition by Stewart C...
 
Nanoparticles synthesis and characterization​ ​
Nanoparticles synthesis and characterization​  ​Nanoparticles synthesis and characterization​  ​
Nanoparticles synthesis and characterization​ ​
 
Seismic Method Estimate velocity from seismic data.pptx
Seismic Method Estimate velocity from seismic  data.pptxSeismic Method Estimate velocity from seismic  data.pptx
Seismic Method Estimate velocity from seismic data.pptx
 
Botany 4th semester file By Sumit Kumar yadav.pdf
Botany 4th semester file By Sumit Kumar yadav.pdfBotany 4th semester file By Sumit Kumar yadav.pdf
Botany 4th semester file By Sumit Kumar yadav.pdf
 
Factory Acceptance Test( FAT).pptx .
Factory Acceptance Test( FAT).pptx       .Factory Acceptance Test( FAT).pptx       .
Factory Acceptance Test( FAT).pptx .
 
Call Girls Alandi Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Alandi Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Alandi Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Alandi Call Me 7737669865 Budget Friendly No Advance Booking
 
Chemistry 4th semester series (krishna).pdf
Chemistry 4th semester series (krishna).pdfChemistry 4th semester series (krishna).pdf
Chemistry 4th semester series (krishna).pdf
 
American Type Culture Collection (ATCC).pptx
American Type Culture Collection (ATCC).pptxAmerican Type Culture Collection (ATCC).pptx
American Type Culture Collection (ATCC).pptx
 
Asymmetry in the atmosphere of the ultra-hot Jupiter WASP-76 b
Asymmetry in the atmosphere of the ultra-hot Jupiter WASP-76 bAsymmetry in the atmosphere of the ultra-hot Jupiter WASP-76 b
Asymmetry in the atmosphere of the ultra-hot Jupiter WASP-76 b
 
Zoology 4th semester series (krishna).pdf
Zoology 4th semester series (krishna).pdfZoology 4th semester series (krishna).pdf
Zoology 4th semester series (krishna).pdf
 
Justdial Call Girls In Indirapuram, Ghaziabad, 8800357707 Escorts Service
Justdial Call Girls In Indirapuram, Ghaziabad, 8800357707 Escorts ServiceJustdial Call Girls In Indirapuram, Ghaziabad, 8800357707 Escorts Service
Justdial Call Girls In Indirapuram, Ghaziabad, 8800357707 Escorts Service
 
SCIENCE-4-QUARTER4-WEEK-4-PPT-1 (1).pptx
SCIENCE-4-QUARTER4-WEEK-4-PPT-1 (1).pptxSCIENCE-4-QUARTER4-WEEK-4-PPT-1 (1).pptx
SCIENCE-4-QUARTER4-WEEK-4-PPT-1 (1).pptx
 
Forensic Biology & Its biological significance.pdf
Forensic Biology & Its biological significance.pdfForensic Biology & Its biological significance.pdf
Forensic Biology & Its biological significance.pdf
 
Pests of cotton_Borer_Pests_Binomics_Dr.UPR.pdf
Pests of cotton_Borer_Pests_Binomics_Dr.UPR.pdfPests of cotton_Borer_Pests_Binomics_Dr.UPR.pdf
Pests of cotton_Borer_Pests_Binomics_Dr.UPR.pdf
 
Proteomics: types, protein profiling steps etc.
Proteomics: types, protein profiling steps etc.Proteomics: types, protein profiling steps etc.
Proteomics: types, protein profiling steps etc.
 
FAIRSpectra - Enabling the FAIRification of Spectroscopy and Spectrometry
FAIRSpectra - Enabling the FAIRification of Spectroscopy and SpectrometryFAIRSpectra - Enabling the FAIRification of Spectroscopy and Spectrometry
FAIRSpectra - Enabling the FAIRification of Spectroscopy and Spectrometry
 
Presentation Vikram Lander by Vedansh Gupta.pptx
Presentation Vikram Lander by Vedansh Gupta.pptxPresentation Vikram Lander by Vedansh Gupta.pptx
Presentation Vikram Lander by Vedansh Gupta.pptx
 
Conjugation, transduction and transformation
Conjugation, transduction and transformationConjugation, transduction and transformation
Conjugation, transduction and transformation
 
❤Jammu Kashmir Call Girls 8617697112 Personal Whatsapp Number 💦✅.
❤Jammu Kashmir Call Girls 8617697112 Personal Whatsapp Number 💦✅.❤Jammu Kashmir Call Girls 8617697112 Personal Whatsapp Number 💦✅.
❤Jammu Kashmir Call Girls 8617697112 Personal Whatsapp Number 💦✅.
 

First steps in testing analytics: Does test code quality matter?

  • 1. First Steps in Testing Analytics: Does Test Code Quality Matter? Andy Zaidman Delft University of Technology Nederlandse Testdag 17 november 2014, Amersfoort
  • 2. Joint work with Moritz Beller & Georgios Gousios (TU Delft) Dimitrios Athanasiou, Ariadi Nugroho & Joost Visser (Software Improvement Group)
  • 3. Who am I? Software engineering teacher by day Testing evangelist Software engineering researcher by night
  • 4. What would you like to know? What analytics? • ???
  • 5.
  • 6. WHAT EVER HAP P ENS…
  • 8. TODAY 2 test analytics stories
  • 9. STORY 1 Test Code Quality Matters
  • 10. Andy teaching First year programming course @ TU Delft  In week 3 everyone is unit testing “I don’t have time for testing” “I don’t like testing, my code is good anyway” “How much should I test?” “How good should my test code be?”
  • 11. @Test public void testConstructor() { assertTrue(true) } Solution 1
  • 12.
  • 13. Solution 2 @Test public void testConstructor() { House h = new House(“Street”, “9”); assertEquals(“Street 9”, h.toString()); }
  • 14. Solution 3 @Test public void testConstructor() { House h = new House(“Street”, “9”); assertEquals(“Street”, h.getStreet()); assertEquals(9, h.getNumber()); }
  • 15. Solution 4 @Test public void testConstructorStreet() { House h = new House(“Street”, “9”); assertEquals(“Street”, h.getStreet()); } @Test public void testConstructorNumber() { House h = new House(“Street”, “9”); assertEquals(9, h.getNumber()); }
  • 21.
  • 22.
  • 23.
  • 24.
  • 25. Thou shalt not have less than 70% coverage
  • 26.
  • 27. What makes a good unit test? What makes a good integration test?
  • 28. What makes a good developer test?
  • 29. What makes a good developer test? Complete Effective Maintainable
  • 30. Complete • How much of the code is covered by the tests? • How many of the decision points in the code are tested? Code coverage #assertions/cyclomatic complexity
  • 31. Effective • How able is the test code to detect defects? • How able is the test code to locate the cause? Assertion density #assertions / LOCtest Directness unit versus integration testing
  • 32. Maintainable • How maintainable is the system’s test code? Software Improvement Group quality model
  • 33. Test Code Quality Model* Complete + Effective + Maintainable * Calibrated using 86 systems
  • 35.
  • 36. Better tests Easier development ?
  • 37. Observation 1* High quality tests do not lead to quicker/easier bug fixing Why? The low-hanging fruit is already solved if you have good tests… the difficult bugs remain * While studying 75 years of combined development of 18 software systems
  • 38. High quality tests do lead to higher productivity • More issues fixed per month per developer • More issues fixed per month per KLOC Why? Implementing new features does seem to benefit from having a safety net for existing functionality. Observation 2
  • 39. High quality tests do make your team more productive!
  • 41. #assertions McCabe cyclomatic complexity ≥ 1 The single most important thing for test code quality
  • 42.
  • 43. STORY 2 Testing takes 50% of your time
  • 44. Says this guy • Study from 1975 • Questionable research approach
  • 45. Differences? • Waterfall • Developer testing • Programming language • Tools (e.g. IDE)
  • 47.
  • 48. + +
  • 49. Recording 1. Time spent on developing production code 2. Time spent on developing test code 3. How frequently are Junit tests executed? 4. How frequently do these test runs fail?
  • 51.
  • 54.
  • 55. My ultimate dream? Continuous background testing
  • 56.
  • 57. Take home • Test code quality matters for the productivity of your team • #assertions/cyclomatic complexity ≥ 1 • Help us out with our research! a.e.zaidman@tudelft.nl http://azaidman.wordpress.com httpp://www.st.ewi.tudelft.nl/~zaidman @azaidman