Code Coverage Metric that measures value of your

  • Slides: 12
Download presentation
Code Coverage- Metric that measures value of your tests Sandeep Gaikwad, Section Manager Abhijit

Code Coverage- Metric that measures value of your tests Sandeep Gaikwad, Section Manager Abhijit Wavhal- Senior QA specialist PTC Softwares India Pvt. Ltd. Pune. 1

Agenda: – – – – – What is Code Coverage Benefits of Code Coverage

Agenda: – – – – – What is Code Coverage Benefits of Code Coverage Criteria’s Basic Coverage Criteria’s Code Coverage Analysis process Code Coverage using Ja. Co Code Coverage Reports Code Coverage Tools References & Appendix 2

– Code coverage is a measure used to describe the degree to which the

– Code coverage is a measure used to describe the degree to which the source code of a program is executed when a particular test suite runs – Code Coverage is classified as a White box testing 3

Benefits of Code Coverage: Identify untested part of codebase Improve the Quality by improved

Benefits of Code Coverage: Identify untested part of codebase Improve the Quality by improved test coverage Identify testing gaps or missing tests Identify the redundant/dead Code 4

Coverage Criteria’s: • To measure what percentage of code has been exercised by a

Coverage Criteria’s: • To measure what percentage of code has been exercised by a test suite, one or more coverage criteria are used Instructions Coverage Statements Coverage Branch Coverage Method Coverage Class Coverage Basic Coverage Criteria’s 5

Code Coverage- Brief Summary: Method coverage Branch coverage Statement coverage Path coverage 7

Code Coverage- Brief Summary: Method coverage Branch coverage Statement coverage Path coverage 7

Code Coverage Analysis Process: Writing test cases and execute them Finding areas of code

Code Coverage Analysis Process: Writing test cases and execute them Finding areas of code not covered using Code Coverage Tool Creating additional tests for identified gaps to increase test coverage Determining a quantitative measure of code coverage 8

Code Coverage Using Ja. Co: Ja. Co is an open source code coverage Tool

Code Coverage Using Ja. Co: Ja. Co is an open source code coverage Tool for Java, which has been created by the Ecl. Emma team Configure Ja. Co agent with JVM of your system to instrument java classes. EXEC file gets generated while the test cases are executed on the system Generate Code Coverage report using ant (in different formats) The agent jacocoagent. jar is part of the Ja. Co distribution and includes all required dependencies. A Java agent can be activated with the following JVM option: javaagent: [yourpath/]jacocoagent. jar=[option 1]=[value 1], [option 2]=[value 2] Examplejava -jar-<Jar> -javaagent: <Jacoco location path>/jacocoagent. jar=destfile=<Jacoco location>/jacoco. exec 9

Code Coverage Using Ja. Co : • Ja. Co offers instructions, line, branch, class

Code Coverage Using Ja. Co : • Ja. Co offers instructions, line, branch, class and package coverage 10

Tools Available for Code coverage: – – – – Cobertura Atlassian Clover Dev. Partner

Tools Available for Code coverage: – – – – Cobertura Atlassian Clover Dev. Partner JTest Bullseye for C++ Sonar Kalistick 11

References & Appendix – https: //en. wikipedia. org/wiki/Code_coverage – https: //en. wikipedia. org/wiki/White-box_testing –

References & Appendix – https: //en. wikipedia. org/wiki/Code_coverage – https: //en. wikipedia. org/wiki/White-box_testing – http: //www. eclemma. org/jacoco/ – http: //www. jacoco. org/jacoco/trunk/doc/ – https: //www. atlassian. com/software/clover 12

Thank You!!! 13

Thank You!!! 13