Now I need to figure out which method/branch from each executed class have been executed.
I managed to retrieve numbers about covered methods/branches/statements by analyzing the ExecutionData using a CoverageBuilder. I found also that I can check the name of each method executed and with this I can generate my own list of which of all methods have been executed. Now I need to do the same with branches, but I didn't figure any way to do this. The ideal would be an array containing all possible executable branches and those that were executed, marked with a flag (same mechanism as ExecutionData).
Anyone can provide me some light?
Thanks in advance!
Here is the snippet for the code (keep in mind that it is an experimental code):
for (IClassCoverage classCoverage : coverageBuilder.getClasses())
{
boolean[] branchProbes = new boolean[classCoverage.getBranchCounter().getTotalCount()];
int currentBranchIndex = 0;
if (branchProbes.length != 0)
{
for (int x = 0; x < classCoverage.getLastLine(); x++)
{
ILine line = classCoverage.getLine(x);
if (line.getBranchCounter().getTotalCount() != 0)
{
branchProbes[currentBranchIndex++] = line.getBranchCounter().getCoveredCount() != 0;
}
}
}
I'm sharing in case someone needs it in the future.