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

Nov 8, 2016 at 11:23 AM
Hi,
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:
Source.cxx
  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?
i.e.
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.
Coordinator
Nov 14, 2016 at 11:44 AM
Hello,

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,

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