Search in sources :

Example 1 with InternalTestExecutionException

use of org.gradle.tooling.internal.protocol.test.InternalTestExecutionException in project gradle by gradle.

the class TestExecutionRequestActionRunner method run.

@Override
public void run(BuildAction action, BuildController buildController) {
    if (!(action instanceof TestExecutionRequestAction)) {
        return;
    }
    GradleInternal gradle = buildController.getGradle();
    try {
        TestExecutionRequestAction testExecutionRequestAction = (TestExecutionRequestAction) action;
        TestExecutionResultEvaluator testExecutionResultEvaluator = new TestExecutionResultEvaluator(testExecutionRequestAction);
        buildOperationService.addListener(testExecutionResultEvaluator);
        try {
            doRun(testExecutionRequestAction, buildController);
        } finally {
            buildOperationService.removeListener(testExecutionResultEvaluator);
        }
        testExecutionResultEvaluator.evaluate();
    } catch (RuntimeException rex) {
        Throwable throwable = findRootCause(rex);
        if (throwable instanceof TestExecutionException) {
            throw new InternalTestExecutionException("Error while running test(s)", throwable);
        } else {
            throw rex;
        }
    }
    PayloadSerializer payloadSerializer = gradle.getServices().get(PayloadSerializer.class);
    buildController.setResult(new BuildActionResult(payloadSerializer.serialize(null), null));
}
Also used : TestExecutionRequestAction(org.gradle.tooling.internal.provider.TestExecutionRequestAction) GradleInternal(org.gradle.api.internal.GradleInternal) PayloadSerializer(org.gradle.tooling.internal.provider.serialization.PayloadSerializer) TestExecutionException(org.gradle.api.tasks.testing.TestExecutionException) InternalTestExecutionException(org.gradle.tooling.internal.protocol.test.InternalTestExecutionException) BuildActionResult(org.gradle.tooling.internal.provider.BuildActionResult) InternalTestExecutionException(org.gradle.tooling.internal.protocol.test.InternalTestExecutionException)

Aggregations

GradleInternal (org.gradle.api.internal.GradleInternal)1 TestExecutionException (org.gradle.api.tasks.testing.TestExecutionException)1 InternalTestExecutionException (org.gradle.tooling.internal.protocol.test.InternalTestExecutionException)1 BuildActionResult (org.gradle.tooling.internal.provider.BuildActionResult)1 TestExecutionRequestAction (org.gradle.tooling.internal.provider.TestExecutionRequestAction)1 PayloadSerializer (org.gradle.tooling.internal.provider.serialization.PayloadSerializer)1