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

Jet reorientation in central galaxies of clusters and groups: insights from V...
Jet reorientation in central galaxies of clusters and groups: insights from V...Jet reorientation in central galaxies of clusters and groups: insights from V...
Jet reorientation in central galaxies of clusters and groups: insights from V...
Sérgio Sacani
 
Climate extremes likely to drive land mammal extinction during next supercont...
Climate extremes likely to drive land mammal extinction during next supercont...Climate extremes likely to drive land mammal extinction during next supercont...
Climate extremes likely to drive land mammal extinction during next supercont...
Sérgio Sacani
 
Tuberculosis (TB)-Notes.pdf microbiology notes
Tuberculosis (TB)-Notes.pdf microbiology notesTuberculosis (TB)-Notes.pdf microbiology notes
Tuberculosis (TB)-Notes.pdf microbiology notes
jyothisaisri
 
Isolation of AMF by wet sieving and decantation method pptx
Isolation of AMF by wet sieving and decantation method pptxIsolation of AMF by wet sieving and decantation method pptx
Isolation of AMF by wet sieving and decantation method pptx
GOWTHAMIM22
 
The importance of continents, oceans and plate tectonics for the evolution of...
The importance of continents, oceans and plate tectonics for the evolution of...The importance of continents, oceans and plate tectonics for the evolution of...
The importance of continents, oceans and plate tectonics for the evolution of...
Sérgio Sacani
 
Exomoons & Exorings with the Habitable Worlds Observatory I: On the Detection...
Exomoons & Exorings with the Habitable Worlds Observatory I: On the Detection...Exomoons & Exorings with the Habitable Worlds Observatory I: On the Detection...
Exomoons & Exorings with the Habitable Worlds Observatory I: On the Detection...
Sérgio Sacani
 

Recently uploaded (20)

Extensive Pollution of Uranus and Neptune’s Atmospheres by Upsweep of Icy Mat...
Extensive Pollution of Uranus and Neptune’s Atmospheres by Upsweep of Icy Mat...Extensive Pollution of Uranus and Neptune’s Atmospheres by Upsweep of Icy Mat...
Extensive Pollution of Uranus and Neptune’s Atmospheres by Upsweep of Icy Mat...
 
family therapy psychotherapy types .pdf
family therapy psychotherapy types  .pdffamily therapy psychotherapy types  .pdf
family therapy psychotherapy types .pdf
 
TEST BANK for Organic Chemistry 6th Edition.pdf
TEST BANK for Organic Chemistry 6th Edition.pdfTEST BANK for Organic Chemistry 6th Edition.pdf
TEST BANK for Organic Chemistry 6th Edition.pdf
 
Factor Causing low production and physiology of mamary Gland
Factor Causing low production and physiology of mamary GlandFactor Causing low production and physiology of mamary Gland
Factor Causing low production and physiology of mamary Gland
 
Jet reorientation in central galaxies of clusters and groups: insights from V...
Jet reorientation in central galaxies of clusters and groups: insights from V...Jet reorientation in central galaxies of clusters and groups: insights from V...
Jet reorientation in central galaxies of clusters and groups: insights from V...
 
Climate extremes likely to drive land mammal extinction during next supercont...
Climate extremes likely to drive land mammal extinction during next supercont...Climate extremes likely to drive land mammal extinction during next supercont...
Climate extremes likely to drive land mammal extinction during next supercont...
 
Mining Activity and Investment Opportunity in Myanmar.pptx
Mining Activity and Investment Opportunity in Myanmar.pptxMining Activity and Investment Opportunity in Myanmar.pptx
Mining Activity and Investment Opportunity in Myanmar.pptx
 
mixotrophy in cyanobacteria: a dual nutritional strategy
mixotrophy in cyanobacteria: a dual nutritional strategymixotrophy in cyanobacteria: a dual nutritional strategy
mixotrophy in cyanobacteria: a dual nutritional strategy
 
Microbial bio Synthesis of nanoparticles.pptx
Microbial bio Synthesis of nanoparticles.pptxMicrobial bio Synthesis of nanoparticles.pptx
Microbial bio Synthesis of nanoparticles.pptx
 
VILLAGE ATTACHMENT For rural agriculture PPT.pptx
VILLAGE ATTACHMENT For rural agriculture  PPT.pptxVILLAGE ATTACHMENT For rural agriculture  PPT.pptx
VILLAGE ATTACHMENT For rural agriculture PPT.pptx
 
Alternative method of dissolution in-vitro in-vivo correlation and dissolutio...
Alternative method of dissolution in-vitro in-vivo correlation and dissolutio...Alternative method of dissolution in-vitro in-vivo correlation and dissolutio...
Alternative method of dissolution in-vitro in-vivo correlation and dissolutio...
 
Tuberculosis (TB)-Notes.pdf microbiology notes
Tuberculosis (TB)-Notes.pdf microbiology notesTuberculosis (TB)-Notes.pdf microbiology notes
Tuberculosis (TB)-Notes.pdf microbiology notes
 
Isolation of AMF by wet sieving and decantation method pptx
Isolation of AMF by wet sieving and decantation method pptxIsolation of AMF by wet sieving and decantation method pptx
Isolation of AMF by wet sieving and decantation method pptx
 
Virulence Analysis of Citrus canker caused by Xanthomonas axonopodis pv. citr...
Virulence Analysis of Citrus canker caused by Xanthomonas axonopodis pv. citr...Virulence Analysis of Citrus canker caused by Xanthomonas axonopodis pv. citr...
Virulence Analysis of Citrus canker caused by Xanthomonas axonopodis pv. citr...
 
GBSN - Biochemistry (Unit 4) Chemistry of Carbohydrates
GBSN - Biochemistry (Unit 4) Chemistry of CarbohydratesGBSN - Biochemistry (Unit 4) Chemistry of Carbohydrates
GBSN - Biochemistry (Unit 4) Chemistry of Carbohydrates
 
ERTHROPOIESIS: Dr. E. Muralinath & R. Gnana Lahari
ERTHROPOIESIS: Dr. E. Muralinath & R. Gnana LahariERTHROPOIESIS: Dr. E. Muralinath & R. Gnana Lahari
ERTHROPOIESIS: Dr. E. Muralinath & R. Gnana Lahari
 
The importance of continents, oceans and plate tectonics for the evolution of...
The importance of continents, oceans and plate tectonics for the evolution of...The importance of continents, oceans and plate tectonics for the evolution of...
The importance of continents, oceans and plate tectonics for the evolution of...
 
Exomoons & Exorings with the Habitable Worlds Observatory I: On the Detection...
Exomoons & Exorings with the Habitable Worlds Observatory I: On the Detection...Exomoons & Exorings with the Habitable Worlds Observatory I: On the Detection...
Exomoons & Exorings with the Habitable Worlds Observatory I: On the Detection...
 
Land use land cover change analysis and detection of its drivers using geospa...
Land use land cover change analysis and detection of its drivers using geospa...Land use land cover change analysis and detection of its drivers using geospa...
Land use land cover change analysis and detection of its drivers using geospa...
 
NUMERICAL Proof Of TIme Electron Theory.
NUMERICAL Proof Of TIme Electron Theory.NUMERICAL Proof Of TIme Electron Theory.
NUMERICAL Proof Of TIme Electron Theory.
 

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