use of com.teamscale.report.testwise.jacoco.JaCoCoTestwiseReportGenerator in project teamscale-jacoco-agent by cqse.
the class Converter method runTestwiseCoverageReportGeneration.
/**
* Converts one .exec binary coverage file, test details and test execution files to JSON testwise coverage.
*/
public void runTestwiseCoverageReportGeneration() throws IOException, CoverageGenerationException, AgentOptionParseException {
List<TestDetails> testDetails = ReportUtils.readObjects(ETestArtifactFormat.TEST_LIST, TestDetails[].class, arguments.getInputFiles());
List<TestExecution> testExecutions = ReportUtils.readObjects(ETestArtifactFormat.TEST_EXECUTION, TestExecution[].class, arguments.getInputFiles());
List<File> jacocoExecutionDataList = ReportUtils.listFiles(ETestArtifactFormat.JACOCO, arguments.getInputFiles());
ILogger logger = new CommandLineLogger();
JaCoCoTestwiseReportGenerator generator = new JaCoCoTestwiseReportGenerator(arguments.getClassDirectoriesOrZips(), getWildcardIncludeExcludeFilter(), arguments.getDuplicateClassFileBehavior(), logger);
TestInfoFactory testInfoFactory = new TestInfoFactory(testDetails, testExecutions);
try (Benchmark benchmark = new Benchmark("Generating the testwise coverage report")) {
logger.info("Writing report with " + testDetails.size() + " Details/" + testExecutions.size() + " Results");
try (TestwiseCoverageReportWriter coverageWriter = new TestwiseCoverageReportWriter(testInfoFactory, arguments.getOutputFile(), arguments.getSplitAfter())) {
for (File executionDataFile : jacocoExecutionDataList) {
generator.convertAndConsume(executionDataFile, coverageWriter);
}
}
}
}
Aggregations