What's CoverageInfo

CoverageInfo uses ProfileInfo's information to account execution coverage and categorize programs to check coverage compliance.

Sample Code

The box below shows the Java code used to account coverage:

CoverageInfo sample code
import net.cordova.justus.progressparser.*;
import net.cordova.justus.coverage.*;
import java.io.*;

public class MyTest implements CommandListener {
	public static void main(String args[]) {
	    File profFile  = new File(args[0]); // Profiler's result file
	    File sourceDir = new File(args[1]); // Profiler's output source code directory (dbg_* files)
	    File categories = new File(args[2]); // Categories configuration - XML File
	    // Uses ProfileInfo to account execution
	    HashMap<Integer, ExecutionProgram> profileInfo;
	    profileInfo = ProfileLoader.loadProfile(profFile, sourceDir);
	    ArrayList<ExecutionProgram> programs = new ArrayList<ExecutionProgram>(profileInfo.values());

		// Loads Categories configuration file
		Document doc = null;
		try {
			doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(categories);
		catch(Exception e) {
			throw new BuildException("Coverage Configuration file corrupted: " + this.coverageConfig);

		// Loads Categories
		ArrayList<Category> catList = Category.loadCategories(doc);
	    // Uses CoverageInfo to account coverage by category.
		CoverageInfo info = CoverageInfo.processCoverage(catList, programs);