use of com.teamscale.test_impacted.engine.executor.AvailableTests in project teamscale-jacoco-agent by cqse.
the class TestDescriptorUtils method getAvailableTests.
/**
* Returns the {@link AvailableTests} contained within the root {@link TestDescriptor}.
*/
public static AvailableTests getAvailableTests(TestEngine testEngine, TestDescriptor rootTestDescriptor) {
AvailableTests availableTests = new AvailableTests();
ITestDescriptorResolver testDescriptorResolver = TestDescriptorResolverRegistry.getTestDescriptorResolver(testEngine);
TestDescriptorUtils.streamTestRepresentatives(rootTestDescriptor).forEach(testDescriptor -> {
Optional<String> clusterId = testDescriptorResolver.getClusterId(testDescriptor);
Optional<String> uniformPath = testDescriptorResolver.getUniformPath(testDescriptor);
String source = TestDescriptorUtils.getSource(testDescriptor);
if (!uniformPath.isPresent()) {
LOGGER.error(() -> "Unable to determine uniform path for test descriptor: " + testDescriptor);
return;
}
if (!clusterId.isPresent()) {
LOGGER.error(() -> "Unable to determine cluster id path for test descriptor: " + testDescriptor);
return;
}
ClusteredTestDetails testDetails = new ClusteredTestDetails(uniformPath.get(), source, null, clusterId.get());
availableTests.add(testDescriptor.getUniqueId(), testDetails);
});
return availableTests;
}
use of com.teamscale.test_impacted.engine.executor.AvailableTests 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