Search in sources :

Example 1 with TestExecutorRequest

use of com.teamscale.test_impacted.engine.executor.TestExecutorRequest 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);
}
Also used : AvailableTests(com.teamscale.test_impacted.engine.executor.AvailableTests) TestExecution(com.teamscale.report.testwise.model.TestExecution) ArrayList(java.util.ArrayList) TestExecutorRequest(com.teamscale.test_impacted.engine.executor.TestExecutorRequest) TestEngine(org.junit.platform.engine.TestEngine) TestDetails(com.teamscale.client.TestDetails) TestDescriptor(org.junit.platform.engine.TestDescriptor)

Aggregations

TestDetails (com.teamscale.client.TestDetails)1 TestExecution (com.teamscale.report.testwise.model.TestExecution)1 AvailableTests (com.teamscale.test_impacted.engine.executor.AvailableTests)1 TestExecutorRequest (com.teamscale.test_impacted.engine.executor.TestExecutorRequest)1 ArrayList (java.util.ArrayList)1 TestDescriptor (org.junit.platform.engine.TestDescriptor)1 TestEngine (org.junit.platform.engine.TestEngine)1