@Incubating public interface TestLauncher extends ConfigurableLauncher<TestLauncher>
TestLauncher
allows you to execute tests in a Gradle build.Modifier and Type | Method and Description |
---|---|
void |
run()
Executes the build, blocking until it is complete.
|
void |
run(ResultHandler<? super Void> handler)
Launches the build.
|
TestLauncher |
withJvmTestClasses(Iterable<String> testClasses)
Adds tests to be executed declared by class name.
|
TestLauncher |
withJvmTestClasses(String... testClasses)
Adds tests to be executed declared by class name.
|
TestLauncher |
withTests(Iterable<? extends TestOperationDescriptor> descriptors)
Adds tests to be executed by passing test descriptors received from a previously Gradle Run.
|
TestLauncher |
withTests(TestOperationDescriptor... descriptors)
Adds tests to be executed by passing test descriptors received from a previously Gradle Run.
|
addProgressListener, addProgressListener, addProgressListener, addProgressListener, setColorOutput, setJavaHome, setJvmArguments, setJvmArguments, setStandardError, setStandardInput, setStandardOutput, withArguments, withArguments, withCancellationToken
TestLauncher withTests(TestOperationDescriptor... descriptors)
descriptors
- The OperationDescriptor defining one or more tests.TestLauncher withTests(Iterable<? extends TestOperationDescriptor> descriptors)
descriptors
- The OperationDescriptor defining one or more tests.TestLauncher withJvmTestClasses(String... testClasses)
testClasses
- The class names of the tests to be executed.TestLauncher withJvmTestClasses(Iterable<String> testClasses)
testClasses
- The class names of the tests to be executed.void run() throws TestExecutionException
TestExecutionException
- when no tests for execution declared or can be found.UnsupportedVersionException
- When the target Gradle version does not support test execution.UnsupportedBuildArgumentException
- When there is a problem with build arguments provided by ConfigurableLauncher.withArguments(String...)
.UnsupportedOperationConfigurationException
- When the target Gradle version does not support some requested configuration option.BuildException
- On some failure while executing the tests in the Gradle build.BuildCancelledException
- When the operation was cancelled before it completed successfully.GradleConnectionException
- On some other failure using the connection.IllegalStateException
- When the connection has been closed or is closing.void run(ResultHandler<? super Void> handler)
If the operation fails, the handler's ResultHandler.onFailure(GradleConnectionException)
method is called with the appropriate exception. See run()
for a description of the various exceptions that the operation may fail with.
handler
- The handler to supply the result to.IllegalStateException
- When the connection has been closed or is closing.