Map the test case and the API used in program under code coverage

Nov 8, 2016 at 12:23 PM
I run the OpenCPPCoverage with following scenario:
The program I run is a Test suite which has say 3 Tests:
  1. TestA
  2. TestB
  3. TestC
This program loads the module DLL for which I want the code coverage. Say the module has a CXX file with 3 APIs:
  1. FunctA()
  2. FuncB()
  3. FunctC()
The TestA covers the FunctA(), TestB covers the FunctB() and TestC covers all three functions.

How can I generate this mapping of which test covers which API?
FunctA : TestA
FunctB : TestB
FunctC : TestA,TestB,TestC

I understand that the OpenCPPCoverage does line coverage. However, is it possible to enhance the OpenCPPCoverage to generate such mapping file? If it is possible, I can think of doing such enhancement.
Nov 14, 2016 at 12:44 PM

Now, the only solution is to run the 3 test cases one by one.

It should be possible to store the location of the first caller for each line.
Storing multiple callers is equivalent to count the number of times a line is executed. I am afraid this will slow down a lot the covered application.

Anyway, this is an interesting feature but I already have a lot of things planned. Perhaps I will work on it after.

You can try to do it yourself but it is not easy to compile OpenCppCoverage (One thing I plan to work on). You can check CodeCoverageRunner::OnBreakPoint. This function is called the first time a line is executed.

I hope this will help,

Marked as answer by OpenCppCoverage on 1/15/2017 at 6:11 AM