Sunday, March 4, 2018

Code Coverage Tool Analysis

What is a code coverage tool?

Code coverage is a methodology which is used to measure and describe how much source code of the program is executed when a specific test suit runs. It gives a percentage value and the user can determine if the source code is well covered or needs improvements or covered more. If the percentage value is high, the test suit has covered and if its law the coverage should be improved.

There are 03 code coverage test methodologies.
  1. Source Code Instrumentation
  2. Byte Code Instrumentation
  3. Run time Information Collection

Instrumentation is being able to analyze the code coverage that a test suit achieves that it is necessary to compile a version of the application in which statements are inserted that monitor the execution of the source code. 
The generation of such modifies version of the program is called instrumentation.

The most famous of the above 3 are Source Code and Byte Code instrumentation.

Source Code Instrumentation :This approach adds instrumentation statements to the source code and compiles the code with the normal compile tool chain to produce an instrumented assembly.

Byte Code Instrumentation : Bytecode Instrumentation Is A Process Where New Function- Ality Is Added To A Program By Modifying The Bytecode Of A Set Of Classes Before They Are Loaded By The Virtual Machine.

Let me now walk you through the most commonly used code coverage tools in the market.


Open- Clover


Open Clover Report



Jacoco


Jacoco Report


Cobertura 


Cobertura  Report



Among the above 3, most famous is Jacoco and Open Clover. 

Open Clover was put in to the open source market very recently and was a very well known commercial product. The team has now made it a fully opensource product.

Jacoco can be described as an extension of the well famous eclEmma code coverage tool implemented by the Eclipse team. Most of the marker researches recommend Jacoco over the other code coverage tools in the market because of its ability to integrate and instrumentation method.

Most open source code coverage tools use Java as the language where as there are many commercial code coverage tools focusing on .Net or other programming languages. 

Please refer the below link for a better comparison between the code coverage tools.

https://confluence.atlassian.com/clover/comparison-of-code-coverage-tools-681706101.html

So that is a very much what we should know about a code coverage tool in selecting one. Please feel free to comment and share your thoughts.