use of com.teamscale.client.TestDetails 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);
}
}
}
}
use of com.teamscale.client.TestDetails in project teamscale-jacoco-agent by cqse.
the class InternalImpactedTestEngine method runTestExecutor.
private void runTestExecutor(ExecutionRequest request) {
List<TestDetails> availableTests = new ArrayList<>();
List<TestExecution> testExecutions = new ArrayList<>();
for (TestDescriptor engineTestDescriptor : request.getRootTestDescriptor().getChildren()) {
Optional<String> engineId = engineTestDescriptor.getUniqueId().getEngineId();
if (!engineId.isPresent()) {
LOGGER.error(() -> "Engine id for test descriptor " + engineTestDescriptor + " not present. Skipping execution of the engine.");
continue;
}
TestEngine testEngine = testEngineRegistry.getTestEngine(engineId.get());
AvailableTests availableTestsForEngine = TestDescriptorUtils.getAvailableTests(testEngine, engineTestDescriptor);
TestExecutorRequest testExecutorRequest = new TestExecutorRequest(testEngine, engineTestDescriptor, request.getEngineExecutionListener(), request.getConfigurationParameters());
List<TestExecution> testExecutionsOfEngine = testExecutor.execute(testExecutorRequest);
testExecutions.addAll(testExecutionsOfEngine);
availableTests.addAll(availableTestsForEngine.getTestList());
}
testDataWriter.dumpTestDetails(availableTests);
testDataWriter.dumpTestExecutions(testExecutions);
}
Aggregations