Dismiss
InnovationQ will be updated on Sunday, Oct. 22, from 10am ET - noon. You may experience brief service interruptions during that time.
Browse Prior Art Database

Method of Calculating Unit Test Coverage for Changed Code

IP.com Disclosure Number: IPCOM000238000D
Publication Date: 2014-Jul-25
Document File: 3 page(s) / 72K

Publishing Venue

The IP.com Prior Art Database

Abstract

This disclosure presents a method about how to calculate Unit Test coverage for changed code.

This text was extracted from a PDF file.
This is the abbreviated version, containing approximately 57% of the total text.

Page 01 of 3

Method of Calculating Unit Test Coverage for Changed Code

Problem statement and background

It's common for a software product to change source code regardless a bug fix or feature enhancement. So code coverage becomes critical to ensure the quality of code changes.

It's quite challenging for existing code coverage tools to accurately get the coverage of code changes only. So this disclosure introduces a brand new method which laser focuses the accurate coverage for code changes.

Core Ideas and Claims

This disclosure describes an approach or method on how to get the Unit Test code coverage of code changes . Regarding the execution results of existing coverage tool, the pure coverage of code changes can be calculated only through the following formula:

Detailed Description

The detailed method process illustrated as below:
1. Get changed code line number information
Firstly, generate a file name list based on the changed files.

Then use text compare tool to compare the new-old code files directory.

-r new old > diff.txt

diff.txt will contain the line changed method to show the difference between the new code and the old code . For example:

-r c:\new\test\test1.cpp c:\old\test\test1.cpp 33,34d32

0

38d35

0

51,54c48,49

changed_code_coverage=len(line_executed)/len(line_changed)

1


Page 02 of 3

... 100,114c95,96


2.Retrieve UT coverage data of the system with changed code


Test coverage data is generated by using coverage tool. The coverage data can identify the code execut...