Search in sources :

Example 1 with TestExecutionRequestAction

use of org.gradle.tooling.internal.provider.action.TestExecutionRequestAction in project gradle by gradle.

the class TestExecutionRequestActionRunner method run.

@Override
public Result run(BuildAction action, BuildTreeLifecycleController buildController) {
    if (!(action instanceof TestExecutionRequestAction)) {
        return Result.nothing();
    }
    try {
        TestExecutionRequestAction testExecutionRequestAction = (TestExecutionRequestAction) action;
        TestExecutionResultEvaluator testExecutionResultEvaluator = new TestExecutionResultEvaluator(ancestryTracker, testExecutionRequestAction);
        buildOperationListenerManager.addListener(testExecutionResultEvaluator);
        try {
            doRun(testExecutionRequestAction, buildController);
        } finally {
            buildOperationListenerManager.removeListener(testExecutionResultEvaluator);
        }
        testExecutionResultEvaluator.evaluate();
    } catch (RuntimeException e) {
        Throwable throwable = findRootCause(e);
        if (throwable instanceof TestExecutionException) {
            return Result.failed(e, new InternalTestExecutionException("Error while running test(s)", throwable));
        } else {
            return Result.failed(e);
        }
    }
    return Result.of(null);
}
Also used : TestExecutionRequestAction(org.gradle.tooling.internal.provider.action.TestExecutionRequestAction) TestExecutionException(org.gradle.api.tasks.testing.TestExecutionException) InternalTestExecutionException(org.gradle.tooling.internal.protocol.test.InternalTestExecutionException) InternalTestExecutionException(org.gradle.tooling.internal.protocol.test.InternalTestExecutionException)

Example 2 with TestExecutionRequestAction

use of org.gradle.tooling.internal.provider.action.TestExecutionRequestAction in project gradle by gradle.

the class ProviderConnection method runTests.

public Object runTests(ProviderInternalTestExecutionRequest testExecutionRequest, BuildCancellationToken cancellationToken, ProviderOperationParameters providerParameters) {
    Parameters params = initParams(providerParameters);
    StartParameterInternal startParameter = new ProviderStartParameterConverter().toStartParameter(providerParameters, params.buildLayout, params.properties);
    ProgressListenerConfiguration listenerConfig = ProgressListenerConfiguration.from(providerParameters, consumerVersion);
    TestExecutionRequestAction action = TestExecutionRequestAction.create(listenerConfig.clientSubscriptions, startParameter, testExecutionRequest);
    return run(action, cancellationToken, listenerConfig, listenerConfig.buildEventConsumer, providerParameters, params);
}
Also used : TestExecutionRequestAction(org.gradle.tooling.internal.provider.action.TestExecutionRequestAction) ProviderConnectionParameters(org.gradle.tooling.internal.provider.connection.ProviderConnectionParameters) ProviderOperationParameters(org.gradle.tooling.internal.provider.connection.ProviderOperationParameters) DaemonParameters(org.gradle.launcher.daemon.configuration.DaemonParameters) BuildActionParameters(org.gradle.launcher.exec.BuildActionParameters) StartParameterInternal(org.gradle.api.internal.StartParameterInternal)

Aggregations

TestExecutionRequestAction (org.gradle.tooling.internal.provider.action.TestExecutionRequestAction)2 StartParameterInternal (org.gradle.api.internal.StartParameterInternal)1 TestExecutionException (org.gradle.api.tasks.testing.TestExecutionException)1 DaemonParameters (org.gradle.launcher.daemon.configuration.DaemonParameters)1 BuildActionParameters (org.gradle.launcher.exec.BuildActionParameters)1 InternalTestExecutionException (org.gradle.tooling.internal.protocol.test.InternalTestExecutionException)1 ProviderConnectionParameters (org.gradle.tooling.internal.provider.connection.ProviderConnectionParameters)1 ProviderOperationParameters (org.gradle.tooling.internal.provider.connection.ProviderOperationParameters)1