SlideShare a Scribd company logo
1 of 10
Utility of Test Coverage Metrics
in TDD
Virender Kumar
TDD Trainer, Consultant
vir_kum77@yahoo.com
Learning Objectives
• TDD Overview
• Common Test Coverage Metrics
• Significance of Test Coverage Metrics in TDD
• Test Coverage Measurement Tools
TDD
• Software development technique in which
tests are written prior to code
• If you can’t write test for what you are trying
to code, then you should not be thinking
about coding
• TDD reduces the gap between design and
feedback (performance achieved by
implementing the design)
Test Coverage Metrics
• Statement Coverage
• Branch Coverage
• Condition Coverage
• MCDC
• Data Flow Coverage
• Path Coverage
• Mutation Coverage
Mutation Coverage
• Mutation – small change in program
• Apply mutations to program to obtain set of
mutants M1, M2 … Mn
• Run test suite on each of mutants. Mutant is
killed if an error is detected
• Mutation Test Coverage = No. of mutants
killed / Total no. of mutants
• Has to be automated for any reasonable sized
program
Mutation Coverage
• May not be practical to consider all possible
mutants
• Use mutation operators (rules) to generate
mutants
• Value mutations – change values to reflect errors
in reasoning about programs
• Decision mutations – change relational operators
or parenthesisation in conditions
• Statement mutations – change whole line of code
Test Coverage Measurement Tools
• PIT (www.pitest.org)
• Jumble (http://jumble.sourceforge.net/)
• Clover
(https://www.atlassian.com/software/clover/
overview)
• Cobertura
(http://cobertura.github.io/cobertura/)
• EMMA (http://emma.sourceforge.net/)
PIT
• Measures line coverage and mutation
coverage
• Bytecode based mutant generation
• Test selection is automatic – based on line
coverage
• Can be integrated with Ant or Maven based
build systems
• Compatible with most mocking frameworks,
except Powermock and Jmockit
Observations
• TDD does not imply that the tests are perfect
• Test Coverage measurements are relevant to
TDD
• Mutation coverage tells whether something is
really tested
• Tools are available which make it practical to
measure mutation coverage
Future Work
• Collect more data on test coverage in TDD
• Effectiveness of mutation coverage vs. other
coverage metrics
• Comparison between various coverage
measurement tools
• Study effect of mocking frameworks on code
coverage

More Related Content

What's hot

What's hot (20)

Code coverage & tools
Code coverage & toolsCode coverage & tools
Code coverage & tools
 
Improving the accuracy and reliability of data analysis code
Improving the accuracy and reliability of data analysis codeImproving the accuracy and reliability of data analysis code
Improving the accuracy and reliability of data analysis code
 
Code Coverage
Code CoverageCode Coverage
Code Coverage
 
Top 5 Code Coverage Tools in DevOps
Top 5 Code Coverage Tools in DevOpsTop 5 Code Coverage Tools in DevOps
Top 5 Code Coverage Tools in DevOps
 
ABAP Code Retreat Frankfurt 2016: TDD - Test Driven Development
ABAP Code Retreat Frankfurt 2016: TDD - Test Driven DevelopmentABAP Code Retreat Frankfurt 2016: TDD - Test Driven Development
ABAP Code Retreat Frankfurt 2016: TDD - Test Driven Development
 
Code coverage for automation scripts
Code coverage for automation scriptsCode coverage for automation scripts
Code coverage for automation scripts
 
Code coverage
Code coverageCode coverage
Code coverage
 
Case Study: Automated Code Reviews In A Grown SAP Application Landscape At EW...
Case Study: Automated Code Reviews In A Grown SAP Application Landscape At EW...Case Study: Automated Code Reviews In A Grown SAP Application Landscape At EW...
Case Study: Automated Code Reviews In A Grown SAP Application Landscape At EW...
 
ABAPCodeRetreat - TDD Intro by Damir Majer
ABAPCodeRetreat - TDD Intro by Damir MajerABAPCodeRetreat - TDD Intro by Damir Majer
ABAPCodeRetreat - TDD Intro by Damir Majer
 
Elements of a Test Framework
Elements of a Test FrameworkElements of a Test Framework
Elements of a Test Framework
 
Automation and Technical Debt
Automation and Technical DebtAutomation and Technical Debt
Automation and Technical Debt
 
Stc 2015 regional-round-ppt-exlopratory mobile testing with risk analysis
Stc 2015 regional-round-ppt-exlopratory mobile testing with risk analysisStc 2015 regional-round-ppt-exlopratory mobile testing with risk analysis
Stc 2015 regional-round-ppt-exlopratory mobile testing with risk analysis
 
Static analysis tools as the best friend of QA
Static analysis tools as the best friend of QAStatic analysis tools as the best friend of QA
Static analysis tools as the best friend of QA
 
Unit tests benefits
Unit tests benefitsUnit tests benefits
Unit tests benefits
 
[India Merge World Tour] Coverity
[India Merge World Tour] Coverity[India Merge World Tour] Coverity
[India Merge World Tour] Coverity
 
Testing JavaScript Applications
Testing JavaScript ApplicationsTesting JavaScript Applications
Testing JavaScript Applications
 
XP in the full stack
XP in the full stackXP in the full stack
XP in the full stack
 
Continuous Performance Testing with Taurus and Jmeter
Continuous Performance Testing with Taurus and JmeterContinuous Performance Testing with Taurus and Jmeter
Continuous Performance Testing with Taurus and Jmeter
 
JavaScript Unit Testing
JavaScript Unit TestingJavaScript Unit Testing
JavaScript Unit Testing
 
10 Benefits of Automated Testing
10 Benefits of Automated Testing10 Benefits of Automated Testing
10 Benefits of Automated Testing
 

Viewers also liked (6)

Mulesoft http connector
Mulesoft http connectorMulesoft http connector
Mulesoft http connector
 
Bbp change impact analysis sample_2009_v07
Bbp change impact analysis sample_2009_v07Bbp change impact analysis sample_2009_v07
Bbp change impact analysis sample_2009_v07
 
Impact Analysis Template - Enterprise
Impact Analysis Template - EnterpriseImpact Analysis Template - Enterprise
Impact Analysis Template - Enterprise
 
Regression testing
Regression testingRegression testing
Regression testing
 
13 software metrics
13 software metrics13 software metrics
13 software metrics
 
Testing Metrics
Testing MetricsTesting Metrics
Testing Metrics
 

Similar to Utility of Test Coverage Metrics in TDD

Test-Driven Development
Test-Driven DevelopmentTest-Driven Development
Test-Driven Development
Meilan Ou
 
WINSEM2021-22_ITE2004_ETH_VL2021220500452_Reference_Material_I_21-04-2022_TES...
WINSEM2021-22_ITE2004_ETH_VL2021220500452_Reference_Material_I_21-04-2022_TES...WINSEM2021-22_ITE2004_ETH_VL2021220500452_Reference_Material_I_21-04-2022_TES...
WINSEM2021-22_ITE2004_ETH_VL2021220500452_Reference_Material_I_21-04-2022_TES...
madhurpatidar2
 
Quality metrics and angular js applications
Quality metrics and angular js applicationsQuality metrics and angular js applications
Quality metrics and angular js applications
nadeembtech
 

Similar to Utility of Test Coverage Metrics in TDD (20)

Test planning and software's engineering
Test planning and software's engineeringTest planning and software's engineering
Test planning and software's engineering
 
Code coverage
Code coverageCode coverage
Code coverage
 
Test-Driven Development
Test-Driven DevelopmentTest-Driven Development
Test-Driven Development
 
MDD and the Tautology Problem: Discussion Notes.
MDD and the Tautology Problem: Discussion Notes.MDD and the Tautology Problem: Discussion Notes.
MDD and the Tautology Problem: Discussion Notes.
 
Chapter 13 software testing strategies
Chapter 13 software testing strategiesChapter 13 software testing strategies
Chapter 13 software testing strategies
 
Software Productivity Measurement
Software Productivity MeasurementSoftware Productivity Measurement
Software Productivity Measurement
 
MuFinal
MuFinalMuFinal
MuFinal
 
Testing Technique
Testing TechniqueTesting Technique
Testing Technique
 
Software Reliability
Software ReliabilitySoftware Reliability
Software Reliability
 
Questions for successful test automation projects
Questions for successful test automation projectsQuestions for successful test automation projects
Questions for successful test automation projects
 
Software Testing Strategy
Software Testing StrategySoftware Testing Strategy
Software Testing Strategy
 
Software testing
Software testingSoftware testing
Software testing
 
Maturing your path toward DevOps with Continuous Testing
Maturing your path toward DevOps with Continuous TestingMaturing your path toward DevOps with Continuous Testing
Maturing your path toward DevOps with Continuous Testing
 
Capability Building for Cyber Defense: Software Walk through and Screening
Capability Building for Cyber Defense: Software Walk through and Screening Capability Building for Cyber Defense: Software Walk through and Screening
Capability Building for Cyber Defense: Software Walk through and Screening
 
Lec25
Lec25Lec25
Lec25
 
Manual Testing Interview Questions & Answers.docx
Manual Testing Interview Questions & Answers.docxManual Testing Interview Questions & Answers.docx
Manual Testing Interview Questions & Answers.docx
 
QUALITY METRICS OF TEST SUITES IN TESTDRIVEN DESIGNED APPLICATIONS
QUALITY METRICS OF TEST SUITES IN TESTDRIVEN DESIGNED APPLICATIONSQUALITY METRICS OF TEST SUITES IN TESTDRIVEN DESIGNED APPLICATIONS
QUALITY METRICS OF TEST SUITES IN TESTDRIVEN DESIGNED APPLICATIONS
 
White box testing
White box testingWhite box testing
White box testing
 
WINSEM2021-22_ITE2004_ETH_VL2021220500452_Reference_Material_I_21-04-2022_TES...
WINSEM2021-22_ITE2004_ETH_VL2021220500452_Reference_Material_I_21-04-2022_TES...WINSEM2021-22_ITE2004_ETH_VL2021220500452_Reference_Material_I_21-04-2022_TES...
WINSEM2021-22_ITE2004_ETH_VL2021220500452_Reference_Material_I_21-04-2022_TES...
 
Quality metrics and angular js applications
Quality metrics and angular js applicationsQuality metrics and angular js applications
Quality metrics and angular js applications
 

More from XP Conference India

More from XP Conference India (20)

Power of Measurement to Attain True Agility Meetu Arora
Power of Measurement to Attain True Agility Meetu Arora Power of Measurement to Attain True Agility Meetu Arora
Power of Measurement to Attain True Agility Meetu Arora
 
Devops like lance Armstrong by Yahya Poonawala & Siddharth Kulkarni
Devops like lance Armstrong by Yahya Poonawala & Siddharth Kulkarni    Devops like lance Armstrong by Yahya Poonawala & Siddharth Kulkarni
Devops like lance Armstrong by Yahya Poonawala & Siddharth Kulkarni
 
Refactoring for software design smells XP Conference 2016 Ganesh Samarthyam...
Refactoring for software design smells  XP Conference 2016  Ganesh Samarthyam...Refactoring for software design smells  XP Conference 2016  Ganesh Samarthyam...
Refactoring for software design smells XP Conference 2016 Ganesh Samarthyam...
 
Agile Testing Cost Reduction using Pairwise Technique
Agile Testing Cost Reduction using Pairwise Technique Agile Testing Cost Reduction using Pairwise Technique
Agile Testing Cost Reduction using Pairwise Technique
 
Perspectives on Continuous Integration at Scale by Hrishikesh K & Vinaya Mura...
Perspectives on Continuous Integration at Scale by Hrishikesh K & Vinaya Mura...Perspectives on Continuous Integration at Scale by Hrishikesh K & Vinaya Mura...
Perspectives on Continuous Integration at Scale by Hrishikesh K & Vinaya Mura...
 
Building Big Architectures by Ramit Surana
Building Big Architectures by Ramit SuranaBuilding Big Architectures by Ramit Surana
Building Big Architectures by Ramit Surana
 
Journey with XP a case study in embedded domain by Pradeep Kumar NR
Journey with XP a case study in embedded domain  by Pradeep Kumar NRJourney with XP a case study in embedded domain  by Pradeep Kumar NR
Journey with XP a case study in embedded domain by Pradeep Kumar NR
 
Introduction to Docker - Learning containerization XP conference 2016
Introduction to Docker - Learning containerization  XP conference 2016Introduction to Docker - Learning containerization  XP conference 2016
Introduction to Docker - Learning containerization XP conference 2016
 
Feature Toggle XP Conference 2016 Kalpana Gulati
Feature Toggle  XP Conference 2016 Kalpana GulatiFeature Toggle  XP Conference 2016 Kalpana Gulati
Feature Toggle XP Conference 2016 Kalpana Gulati
 
Componentize! by Lancer Kind XP Conference 2016
Componentize! by Lancer Kind XP Conference 2016Componentize! by Lancer Kind XP Conference 2016
Componentize! by Lancer Kind XP Conference 2016
 
Bashing cultural monsters in continuous integration by Vivek Ganesan XP Confe...
Bashing cultural monsters in continuous integration by Vivek Ganesan XP Confe...Bashing cultural monsters in continuous integration by Vivek Ganesan XP Confe...
Bashing cultural monsters in continuous integration by Vivek Ganesan XP Confe...
 
S.O.L.I.D xp
S.O.L.I.D xpS.O.L.I.D xp
S.O.L.I.D xp
 
Xp conf-tbd
Xp conf-tbdXp conf-tbd
Xp conf-tbd
 
Developer 2.0
Developer 2.0  Developer 2.0
Developer 2.0
 
Play2 Java
Play2 JavaPlay2 Java
Play2 Java
 
Pair Programming in Theory and Practice By Garrick West
Pair Programming in Theory and Practice By Garrick WestPair Programming in Theory and Practice By Garrick West
Pair Programming in Theory and Practice By Garrick West
 
Common blind spots on the journey to production vijay raghavan aravamudhan
Common blind spots on the journey to production  vijay raghavan aravamudhanCommon blind spots on the journey to production  vijay raghavan aravamudhan
Common blind spots on the journey to production vijay raghavan aravamudhan
 
Who will test_your_tests_yahya poonawala- priti biyani
Who will test_your_tests_yahya poonawala- priti biyaniWho will test_your_tests_yahya poonawala- priti biyani
Who will test_your_tests_yahya poonawala- priti biyani
 
Adopting agile in an embedded platform Suryakiran Kasturi & Akhil Kumar
Adopting agile in an embedded platform  Suryakiran Kasturi & Akhil KumarAdopting agile in an embedded platform  Suryakiran Kasturi & Akhil Kumar
Adopting agile in an embedded platform Suryakiran Kasturi & Akhil Kumar
 
Nightmare to nightly builds Vijay Bandaru
Nightmare to nightly builds   Vijay BandaruNightmare to nightly builds   Vijay Bandaru
Nightmare to nightly builds Vijay Bandaru
 

Recently uploaded

Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
VictoriaMetrics
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
masabamasaba
 

Recently uploaded (20)

Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
 
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 
WSO2Con2024 - Navigating the Digital Landscape: Transforming Healthcare with ...
WSO2Con2024 - Navigating the Digital Landscape: Transforming Healthcare with ...WSO2Con2024 - Navigating the Digital Landscape: Transforming Healthcare with ...
WSO2Con2024 - Navigating the Digital Landscape: Transforming Healthcare with ...
 
WSO2Con2024 - Organization Management: The Revolution in B2B CIAM
WSO2Con2024 - Organization Management: The Revolution in B2B CIAMWSO2Con2024 - Organization Management: The Revolution in B2B CIAM
WSO2Con2024 - Organization Management: The Revolution in B2B CIAM
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
 
WSO2Con2024 - Unleashing the Financial Potential of 13 Million People
WSO2Con2024 - Unleashing the Financial Potential of 13 Million PeopleWSO2Con2024 - Unleashing the Financial Potential of 13 Million People
WSO2Con2024 - Unleashing the Financial Potential of 13 Million People
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
WSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaSWSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaS
 
WSO2CON 2024 Slides - Unlocking Value with AI
WSO2CON 2024 Slides - Unlocking Value with AIWSO2CON 2024 Slides - Unlocking Value with AI
WSO2CON 2024 Slides - Unlocking Value with AI
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go Platformless
 
AzureNativeQumulo_HPC_Cloud_Native_Benchmarks.pdf
AzureNativeQumulo_HPC_Cloud_Native_Benchmarks.pdfAzureNativeQumulo_HPC_Cloud_Native_Benchmarks.pdf
AzureNativeQumulo_HPC_Cloud_Native_Benchmarks.pdf
 
WSO2CON 2024 - Designing Event-Driven Enterprises: Stories of Transformation
WSO2CON 2024 - Designing Event-Driven Enterprises: Stories of TransformationWSO2CON 2024 - Designing Event-Driven Enterprises: Stories of Transformation
WSO2CON 2024 - Designing Event-Driven Enterprises: Stories of Transformation
 
WSO2Con2024 - Hello Choreo Presentation - Kanchana
WSO2Con2024 - Hello Choreo Presentation - KanchanaWSO2Con2024 - Hello Choreo Presentation - Kanchana
WSO2Con2024 - Hello Choreo Presentation - Kanchana
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 

Utility of Test Coverage Metrics in TDD

  • 1. Utility of Test Coverage Metrics in TDD Virender Kumar TDD Trainer, Consultant vir_kum77@yahoo.com
  • 2. Learning Objectives • TDD Overview • Common Test Coverage Metrics • Significance of Test Coverage Metrics in TDD • Test Coverage Measurement Tools
  • 3. TDD • Software development technique in which tests are written prior to code • If you can’t write test for what you are trying to code, then you should not be thinking about coding • TDD reduces the gap between design and feedback (performance achieved by implementing the design)
  • 4. Test Coverage Metrics • Statement Coverage • Branch Coverage • Condition Coverage • MCDC • Data Flow Coverage • Path Coverage • Mutation Coverage
  • 5. Mutation Coverage • Mutation – small change in program • Apply mutations to program to obtain set of mutants M1, M2 … Mn • Run test suite on each of mutants. Mutant is killed if an error is detected • Mutation Test Coverage = No. of mutants killed / Total no. of mutants • Has to be automated for any reasonable sized program
  • 6. Mutation Coverage • May not be practical to consider all possible mutants • Use mutation operators (rules) to generate mutants • Value mutations – change values to reflect errors in reasoning about programs • Decision mutations – change relational operators or parenthesisation in conditions • Statement mutations – change whole line of code
  • 7. Test Coverage Measurement Tools • PIT (www.pitest.org) • Jumble (http://jumble.sourceforge.net/) • Clover (https://www.atlassian.com/software/clover/ overview) • Cobertura (http://cobertura.github.io/cobertura/) • EMMA (http://emma.sourceforge.net/)
  • 8. PIT • Measures line coverage and mutation coverage • Bytecode based mutant generation • Test selection is automatic – based on line coverage • Can be integrated with Ant or Maven based build systems • Compatible with most mocking frameworks, except Powermock and Jmockit
  • 9. Observations • TDD does not imply that the tests are perfect • Test Coverage measurements are relevant to TDD • Mutation coverage tells whether something is really tested • Tools are available which make it practical to measure mutation coverage
  • 10. Future Work • Collect more data on test coverage in TDD • Effectiveness of mutation coverage vs. other coverage metrics • Comparison between various coverage measurement tools • Study effect of mocking frameworks on code coverage