Class DefaultTestLauncher
- java.lang.Object
-
- org.gradle.tooling.internal.consumer.AbstractLongRunningOperation<DefaultTestLauncher>
-
- org.gradle.tooling.internal.consumer.DefaultTestLauncher
-
- All Implemented Interfaces:
ConfigurableLauncher<TestLauncher>
,LongRunningOperation
,TestLauncher
public class DefaultTestLauncher extends AbstractLongRunningOperation<DefaultTestLauncher> implements TestLauncher
-
-
Field Summary
-
Fields inherited from class org.gradle.tooling.internal.consumer.AbstractLongRunningOperation
connectionParameters, operationParamsBuilder
-
-
Constructor Summary
Constructors Constructor Description DefaultTestLauncher(AsyncConsumerActionExecutor connection, ConnectionParameters parameters)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TestLauncher
debugTestsOn(int port)
Configures test JVM to run in debug mode.protected DefaultTestLauncher
getThis()
void
run()
Executes the tests, blocking until complete.void
run(ResultHandler<? super java.lang.Void> handler)
Starts executing the tests.TestLauncher
withJvmTestClasses(java.lang.Iterable<java.lang.String> testClasses)
Adds tests to be executed declared by class name.TestLauncher
withJvmTestClasses(java.lang.String... classNames)
Adds tests to be executed declared by class name.TestLauncher
withJvmTestMethods(java.lang.String testClass, java.lang.Iterable<java.lang.String> methods)
Adds tests to be executed declared by class and methods name.TestLauncher
withJvmTestMethods(java.lang.String testClass, java.lang.String... methods)
Adds tests to be executed declared by class and method name.TestLauncher
withTaskAndTestClasses(java.lang.String task, java.lang.Iterable<java.lang.String> testClasses)
Adds tests to be executed declared by the container task and the class name.TestLauncher
withTaskAndTestMethods(java.lang.String task, java.lang.String testClass, java.lang.Iterable<java.lang.String> methods)
Adds tests to be executed declared by the container task, class and method name.TestLauncher
withTests(java.lang.Iterable<? extends TestOperationDescriptor> descriptors)
Adds tests to be executed by passing test descriptors received from a previous Gradle Run.TestLauncher
withTests(TestOperationDescriptor... testDescriptors)
Adds tests to be executed by passing test descriptors received from a previous Gradle Run.-
Methods inherited from class org.gradle.tooling.internal.consumer.AbstractLongRunningOperation
addArguments, addArguments, addJvmArguments, addJvmArguments, addProgressListener, addProgressListener, addProgressListener, addProgressListener, copyFrom, getConsumerOperationParameters, rationalizeInput, rationalizeInput, setColorOutput, setEnvironmentVariables, setJavaHome, setJvmArguments, setJvmArguments, setStandardError, setStandardInput, setStandardOutput, withArguments, withArguments, withCancellationToken, withInjectedClassPath
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.gradle.tooling.ConfigurableLauncher
addArguments, addArguments, addJvmArguments, addJvmArguments, addProgressListener, addProgressListener, addProgressListener, addProgressListener, setColorOutput, setEnvironmentVariables, setJavaHome, setJvmArguments, setJvmArguments, setStandardError, setStandardInput, setStandardOutput, withArguments, withArguments, withCancellationToken
-
-
-
-
Constructor Detail
-
DefaultTestLauncher
public DefaultTestLauncher(AsyncConsumerActionExecutor connection, ConnectionParameters parameters)
-
-
Method Detail
-
getThis
protected DefaultTestLauncher getThis()
- Specified by:
getThis
in classAbstractLongRunningOperation<DefaultTestLauncher>
-
withTests
public TestLauncher withTests(TestOperationDescriptor... testDescriptors)
Description copied from interface:TestLauncher
Adds tests to be executed by passing test descriptors received from a previous Gradle Run.- Specified by:
withTests
in interfaceTestLauncher
- Parameters:
testDescriptors
- The OperationDescriptor defining one or more tests.- Returns:
- this
-
withTests
public TestLauncher withTests(java.lang.Iterable<? extends TestOperationDescriptor> descriptors)
Description copied from interface:TestLauncher
Adds tests to be executed by passing test descriptors received from a previous Gradle Run.- Specified by:
withTests
in interfaceTestLauncher
- Parameters:
descriptors
- The OperationDescriptor defining one or more tests.- Returns:
- this
-
withJvmTestClasses
public TestLauncher withJvmTestClasses(java.lang.String... classNames)
Description copied from interface:TestLauncher
Adds tests to be executed declared by class name.
This method ignores tests defined in included builds.
- Specified by:
withJvmTestClasses
in interfaceTestLauncher
- Parameters:
classNames
- The class names of the tests to be executed.- Returns:
- this
-
withJvmTestClasses
public TestLauncher withJvmTestClasses(java.lang.Iterable<java.lang.String> testClasses)
Description copied from interface:TestLauncher
Adds tests to be executed declared by class name.
This method ignores tests defined in included builds.
- Specified by:
withJvmTestClasses
in interfaceTestLauncher
- Parameters:
testClasses
- The class names of the tests to be executed.- Returns:
- this
-
withJvmTestMethods
public TestLauncher withJvmTestMethods(java.lang.String testClass, java.lang.String... methods)
Description copied from interface:TestLauncher
Adds tests to be executed declared by class and method name.
This method ignores tests defined in included builds.
- Specified by:
withJvmTestMethods
in interfaceTestLauncher
- Parameters:
testClass
- The name of the class containing the methods to execute.methods
- The names of the test methods to be executed.- Returns:
- this
-
withJvmTestMethods
public TestLauncher withJvmTestMethods(java.lang.String testClass, java.lang.Iterable<java.lang.String> methods)
Description copied from interface:TestLauncher
Adds tests to be executed declared by class and methods name.
This method ignores tests defined in included builds.
- Specified by:
withJvmTestMethods
in interfaceTestLauncher
- Parameters:
testClass
- The name of the class containing the methods to execute.methods
- The names of the test methods to be executed.- Returns:
- this
-
withTaskAndTestClasses
public TestLauncher withTaskAndTestClasses(java.lang.String task, java.lang.Iterable<java.lang.String> testClasses)
Description copied from interface:TestLauncher
Adds tests to be executed declared by the container task and the class name.Note: These tests are ignored for target Gradle version earlier than 6.1
- Specified by:
withTaskAndTestClasses
in interfaceTestLauncher
- Parameters:
task
- The path of the target task.testClasses
- The class names of the tests to be executed.- Returns:
- this
-
withTaskAndTestMethods
public TestLauncher withTaskAndTestMethods(java.lang.String task, java.lang.String testClass, java.lang.Iterable<java.lang.String> methods)
Description copied from interface:TestLauncher
Adds tests to be executed declared by the container task, class and method name.Note: These tests are ignored for target Gradle version earlier than 6.1
- Specified by:
withTaskAndTestMethods
in interfaceTestLauncher
- Parameters:
task
- The path of the target task.testClass
- The name of the class containing the methods to execute.methods
- The names of the test methods to be executed.- Returns:
- this
-
debugTestsOn
public TestLauncher debugTestsOn(int port)
Description copied from interface:TestLauncher
Configures test JVM to run in debug mode.When called, the forked test JVM is launched with the following argument:
-agentlib:jdwp=transport=dt_socket,server=n,suspend=n,address=localhost:<port>
This means the test JVM expects a debugger at the specified port that uses a socket listening connector. If the debugger is not present then the test execution will fail.Invoking this method adjusts the test task to launch only one JVM. More specifically, the parallel execution gets disabled and the
forkEvery
property is set to 0.- Specified by:
debugTestsOn
in interfaceTestLauncher
- Parameters:
port
- the target port where the test JVM expects the debugger- Returns:
- this
-
run
public void run()
Description copied from interface:TestLauncher
Executes the tests, blocking until complete.- Specified by:
run
in interfaceTestLauncher
-
run
public void run(ResultHandler<? super java.lang.Void> handler)
Description copied from interface:TestLauncher
Starts executing the tests. This method returns immediately, and the result is later passed to the given handler.If the operation fails, the handler's
ResultHandler.onFailure(GradleConnectionException)
method is called with the appropriate exception. SeeTestLauncher.run()
for a description of the various exceptions that the operation may fail with.- Specified by:
run
in interfaceTestLauncher
- Parameters:
handler
- The handler to supply the result to.
-
-