Overview | Package | Class | Deprecated | Index | Help
| Groovy Documentation
| FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.gradle.api.tasks.testing
[Java] Class Test

    java.lang.Object
      org.gradle.api.internal.AbstractTask
          org.gradle.api.DefaultTask
              org.gradle.api.internal.ConventionTask
                  org.gradle.api.tasks.testing.Test

All Implemented Interfaces:
  JavaForkOptions, PatternFilterable, VerificationTask

    public class Test
    extends org.gradle.api.internal.ConventionTask

Executes tests. Supports JUnit (3.8.x or 4.x) or TestNG tests.

An example with a blend of various settings

     apply plugin: 'java' //so that 'test' task is added

     test {
       //configuring a system property for tests
       systemProperty 'some.prop', 'value'

       //tuning the included/excluded tests
       include 'org/foo/**'
       exclude 'org/boo/**'

       //makes the standard streams (err and out) visible at console when running tests
       testLogging.showStandardStreams = true

       //tweaking memory settings for the forked vm that runs tests
       jvmArgs '-Xms128m', '-Xmx512m', '-XX:MaxPermSize=128m'

       //listening to test execution events
       beforeTest { descriptor ->
          logger.lifecycle("Running test: " + descriptor)
       }
       onOutput { descriptor, event ->
          logger.lifecycle("Test: " + descriptor + " produced standard out/err: " + event.message )
       }
     }

Authors:
  Hans Dockter

Field Summary

Fields inherited from class org.gradle.api.internal.ConventionTask
TASK_NAME, TASK_DESCRIPTION, TASK_GROUP, TASK_TYPE, TASK_DEPENDS_ON, TASK_OVERWRITE, TASK_ACTION

Fields inherited from class DefaultTask
TASK_NAME, TASK_DESCRIPTION, TASK_GROUP, TASK_TYPE, TASK_DEPENDS_ON, TASK_OVERWRITE, TASK_ACTION

Constructor Summary
`Test()`

Method Summary
`void` | `addTestListener(TestListener listener)` Registers a test listener with this task.
`void` | `addTestOutputListener(TestOutputListener listener)` Registers a output listener with this task.
`void` | `afterSuite(groovy.lang.Closure closure)`
`void` | `afterTest(groovy.lang.Closure closure)` Adds a closure to be notified after a test has executed.
`void` | `beforeSuite(groovy.lang.Closure closure)`
`void` | `beforeTest(groovy.lang.Closure closure)` Adds a closure to be notified before a test is executed.
`Test` | `bootstrapClasspath(java.lang.Object... classpath)` {@inheritDoc}
`Test` | `copyTo(ProcessForkOptions target)` {@inheritDoc}
`Test` | `copyTo(JavaForkOptions target)` {@inheritDoc}
`void` | `disableTestReport()`
`void` | `enableTestReport()`
`Test` | `environment(java.util.Map environmentVariables)` {@inheritDoc}
`Test` | `environment(java.lang.String name, java.lang.Object value)` {@inheritDoc}
`Test` | `exclude(java.lang.String... excludes)` Adds exclude patterns for the files in the test classes directory (e.g. '**F;*Test.class')).
`Test` | `exclude(java.lang.Iterable excludes)` Adds exclude patterns for the files in the test classes directory (e.g. '**F;*Test.class')).
`Test` | `exclude(Spec excludeSpec)` {@inheritDoc}
`Test` | `exclude(groovy.lang.Closure excludeSpec)` {@inheritDoc}
`Test` | `executable(java.lang.Object executable)` {@inheritDoc}
`void` | `executeTests()`
`java.util.List` | `getAllJvmArgs()` {@inheritDoc}
`FileCollection` | `getBootstrapClasspath()` {@inheritDoc}
`FileTree` | `getCandidateClassFiles()` Returns the classes files to scan for test classes.
`FileCollection` | `getClasspath()` Returns the classpath to use to execute the tests.
`boolean` | `getDebug()` {@inheritDoc}
`boolean` | `getEnableAssertions()` {@inheritDoc}
`java.util.Map` | `getEnvironment()` {@inheritDoc}
`java.util.Set` | `getExcludes()` Returns the exclude patterns for test execution.
`java.lang.String` | `getExecutable()` {@inheritDoc}
`long` | `getForkEvery()` Returns the maximum number of test classes to execute in a forked test process.
`java.util.Set` | `getIncludes()` Returns the include patterns for test execution.
`java.util.List` | `getJvmArgs()` {@inheritDoc}
`java.lang.String` | `getMaxHeapSize()` {@inheritDoc}
`int` | `getMaxParallelForks()` Returns the maximum number of forked test processes to execute in parallel.
`TestFrameworkOptions` | `getOptions()`
`java.util.Map` | `getSystemProperties()` {@inheritDoc}
`java.io.File` | `getTestClassesDir()` Returns the root folder for the compiled test sources.
`org.gradle.api.internal.tasks.testing.TestFramework` | `getTestFramework()`
`TestLogging` | `getTestLogging()` Allows configuring the logging of the test execution, for example log eagerly the standard output, etc.
`java.io.File` | `getTestReportDir()` Returns the root folder for the test reports.
`java.io.File` | `getTestResultsDir()` Returns the root folder for the test results.
`java.util.List` | `getTestSrcDirs()` Returns the directories containing the test source.
`java.io.File` | `getWorkingDir()` {@inheritDoc}
`Test` | `include(java.lang.String... includes)` Adds include patterns for the files in the test classes directory (e.g. '**F;*Test.class')).
`Test` | `include(java.lang.Iterable includes)` Adds include patterns for the files in the test classes directory (e.g. '**F;*Test.class')).
`Test` | `include(Spec includeSpec)` {@inheritDoc}
`Test` | `include(groovy.lang.Closure includeSpec)` {@inheritDoc}
`boolean` | `isIgnoreFailures()` {@inheritDoc}
`boolean` | `isScanForTestClasses()` Specifies whether test classes should be detected.
`boolean` | `isTestReport()` Specifies whether the test report should be generated.
`Test` | `jvmArgs(java.lang.Iterable arguments)` {@inheritDoc}
`Test` | `jvmArgs(java.lang.Object... arguments)` {@inheritDoc}
`void` | `onOutput(groovy.lang.Closure closure)` Adds a closure to be notified when output from the test received.
`TestFrameworkOptions` | `options(groovy.lang.Closure testFrameworkConfigure)`
`void` | `removeTestListener(TestListener listener)` Unregisters a test listener with this task.
`void` | `removeTestOutputListener(TestOutputListener listener)` Unregisters a test output listener with this task.
`void` | `setAllJvmArgs(java.lang.Iterable arguments)` {@inheritDoc}
`void` | `setBootstrapClasspath(FileCollection classpath)` {@inheritDoc}
`void` | `setClasspath(FileCollection classpath)`
`void` | `setDebug(boolean enabled)` {@inheritDoc}
`void` | `setEnableAssertions(boolean enabled)` {@inheritDoc}
`void` | `setEnvironment(java.util.Map environmentVariables)` {@inheritDoc}
`Test` | `setExcludes(java.lang.Iterable excludes)` Sets the exclude patterns for test execution.
`void` | `setExecutable(java.lang.Object executable)` {@inheritDoc}
`void` | `setForkEvery(java.lang.Long forkEvery)` Sets the maximum number of test classes to execute in a forked test process.
`Test` | `setIgnoreFailures(boolean ignoreFailures)` {@inheritDoc}
`Test` | `setIncludes(java.lang.Iterable includes)` Sets the include patterns for test execution.
`void` | `setJvmArgs(java.lang.Iterable arguments)` {@inheritDoc}
`void` | `setMaxHeapSize(java.lang.String heapSize)` {@inheritDoc}
`void` | `setMaxParallelForks(int maxParallelForks)` Sets the maximum number of forked test processes to execute in parallel.
`void` | `setScanForTestClasses(boolean scanForTestClasses)`
`void` | `setSystemProperties(java.util.Map properties)` {@inheritDoc}
`void` | `setTestClassesDir(java.io.File testClassesDir)` Sets the root folder for the compiled test sources.
`void` | `setTestReport(boolean testReport)`
`void` | `setTestReportDir(java.io.File testReportDir)` Sets the root folder for the test reports.
`void` | `setTestResultsDir(java.io.File testResultsDir)` Sets the root folder for the test results.
`void` | `setTestSrcDirs(java.util.List testSrcDir)`
`void` | `setWorkingDir(java.lang.Object dir)` {@inheritDoc}
`Test` | `systemProperties(java.util.Map properties)` {@inheritDoc}
`Test` | `systemProperty(java.lang.String name, java.lang.Object value)` {@inheritDoc}
`org.gradle.api.internal.tasks.testing.TestFramework` | `testFramework(groovy.lang.Closure testFrameworkConfigure)`
`void` | `testLogging(groovy.lang.Closure closure)` Allows configuring the logging of the test execution, for example log eagerly the standard output, etc.
`void` | `useJUnit()` Specifies that JUnit should be used to execute the tests.
`void` | `useJUnit(groovy.lang.Closure testFrameworkConfigure)` Specifies that JUnit should be used to execute the tests.
`void` | `useTestNG()` Specifies that TestNG should be used to execute the tests.
`void` | `useTestNG(groovy.lang.Closure testFrameworkConfigure)` Specifies that TestNG should be used to execute the tests.
`Test` | `workingDir(java.lang.Object dir)` {@inheritDoc}

Methods inherited from class org.gradle.api.internal.ConventionTask
org.gradle.api.internal.ConventionTask#conventionMapping(java.lang.String, org.gradle.api.tasks.ConventionValue), org.gradle.api.internal.ConventionTask#getConventionMapping(), org.gradle.api.internal.ConventionTask#setConventionMapping(org.gradle.api.internal.ConventionMapping), org.gradle.api.internal.ConventionTask#setProperty(java.lang.String, java.lang.Object), org.gradle.api.internal.ConventionTask#toString(), org.gradle.api.internal.ConventionTask#compareTo(org.gradle.api.Task), org.gradle.api.internal.ConventionTask#compareTo(java.lang.Object), org.gradle.api.internal.ConventionTask#getName(), org.gradle.api.internal.ConventionTask#getActions(), org.gradle.api.internal.ConventionTask#setName(java.lang.String), org.gradle.api.internal.ConventionTask#getState(), org.gradle.api.internal.ConventionTask#getPath(), org.gradle.api.internal.ConventionTask#getLogger(), org.gradle.api.internal.ConventionTask#execute(), org.gradle.api.internal.ConventionTask#configure(groovy.lang.Closure), org.gradle.api.internal.ConventionTask#configure(groovy.lang.Closure), org.gradle.api.internal.ConventionTask#getDescription(), org.gradle.api.internal.ConventionTask#isEnabled(), org.gradle.api.internal.ConventionTask#captureStandardOutput(org.gradle.api.logging.LogLevel), org.gradle.api.internal.ConventionTask#disableStandardOutputCapture(), org.gradle.api.internal.ConventionTask#property(java.lang.String), org.gradle.api.internal.ConventionTask#setEnabled(boolean), org.gradle.api.internal.ConventionTask#setDescription(java.lang.String), org.gradle.api.internal.ConventionTask#getProject(), org.gradle.api.internal.ConventionTask#getGroup(), org.gradle.api.internal.ConventionTask#setGroup(java.lang.String), org.gradle.api.internal.ConventionTask#dependsOn([Ljava.lang.Object;), org.gradle.api.internal.ConventionTask#getAnt(), org.gradle.api.internal.ConventionTask#getConvention(), org.gradle.api.internal.ConventionTask#hasProperty(java.lang.String), org.gradle.api.internal.ConventionTask#getLogging(), org.gradle.api.internal.ConventionTask#getExtensions(), org.gradle.api.internal.ConventionTask#executeWithoutThrowingTaskFailure(), org.gradle.api.internal.ConventionTask#setActions(java.util.List), org.gradle.api.internal.ConventionTask#getTaskDependencies(), org.gradle.api.internal.ConventionTask#getTaskDependencies(), org.gradle.api.internal.ConventionTask#getDependsOn(), org.gradle.api.internal.ConventionTask#setDependsOn(java.lang.Iterable), org.gradle.api.internal.ConventionTask#onlyIf(groovy.lang.Closure), org.gradle.api.internal.ConventionTask#onlyIf(org.gradle.api.specs.Spec), org.gradle.api.internal.ConventionTask#setOnlyIf(org.gradle.api.specs.Spec), org.gradle.api.internal.ConventionTask#setOnlyIf(groovy.lang.Closure), org.gradle.api.internal.ConventionTask#setDidWork(boolean), org.gradle.api.internal.ConventionTask#getDidWork(), org.gradle.api.internal.ConventionTask#doFirst(org.gradle.api.Action), org.gradle.api.internal.ConventionTask#doFirst(groovy.lang.Closure), org.gradle.api.internal.ConventionTask#doLast(org.gradle.api.Action), org.gradle.api.internal.ConventionTask#doLast(groovy.lang.Closure), org.gradle.api.internal.ConventionTask#leftShift(groovy.lang.Closure), org.gradle.api.internal.ConventionTask#deleteAllActions(), org.gradle.api.internal.ConventionTask#getEnabled(), org.gradle.api.internal.ConventionTask#dependsOnTaskDidWork(), org.gradle.api.internal.ConventionTask#getInputs(), org.gradle.api.internal.ConventionTask#getOutputs(), org.gradle.api.internal.ConventionTask#getOutputs(), org.gradle.api.internal.ConventionTask#getTemporaryDir(), org.gradle.api.internal.ConventionTask#setProject(org.gradle.api.Project), org.gradle.api.internal.ConventionTask#getStandardOutputCapture(), org.gradle.api.internal.ConventionTask#getAdditionalProperties(), org.gradle.api.internal.ConventionTask#getDynamicObjectHelper(), org.gradle.api.internal.ConventionTask#getAsDynamicObject(), org.gradle.api.internal.ConventionTask#addValidator(org.gradle.api.internal.tasks.execution.TaskValidator), org.gradle.api.internal.ConventionTask#getValidators(), org.gradle.api.internal.ConventionTask#getExecuter(), org.gradle.api.internal.ConventionTask#setExecuter(org.gradle.api.internal.tasks.TaskExecuter), org.gradle.api.internal.ConventionTask#getOnlyIf(), org.gradle.api.internal.ConventionTask#injectIntoNewInstance(org.gradle.api.internal.project.ProjectInternal, java.lang.String, java.util.concurrent.Callable), org.gradle.api.internal.ConventionTask#wait(long), org.gradle.api.internal.ConventionTask#wait(long, int), org.gradle.api.internal.ConventionTask#wait(), org.gradle.api.internal.ConventionTask#equals(java.lang.Object), org.gradle.api.internal.ConventionTask#hashCode(), org.gradle.api.internal.ConventionTask#getClass(), org.gradle.api.internal.ConventionTask#notify(), org.gradle.api.internal.ConventionTask#notifyAll()

Methods inherited from class DefaultTask
setProperty, toString, compareTo, compareTo, getName, getActions, setName, getState, getPath, getLogger, execute, configure, configure, getDescription, isEnabled, captureStandardOutput, disableStandardOutputCapture, property, setEnabled, setDescription, getProject, getGroup, setGroup, dependsOn, getAnt, getConvention, hasProperty, getLogging, getExtensions, executeWithoutThrowingTaskFailure, setActions, getTaskDependencies, getTaskDependencies, getDependsOn, setDependsOn, onlyIf, onlyIf, setOnlyIf, setOnlyIf, setDidWork, getDidWork, doFirst, doFirst, doLast, doLast, leftShift, deleteAllActions, getEnabled, dependsOnTaskDidWork, getInputs, getOutputs, getOutputs, getTemporaryDir, setProject, getStandardOutputCapture, getAdditionalProperties, getDynamicObjectHelper, getAsDynamicObject, addValidator, getValidators, getExecuter, setExecuter, getOnlyIf, injectIntoNewInstance, wait, wait, wait, equals, hashCode, getClass, notify, notifyAll

Constructor Detail

### Test

    public Test()

Method Detail

### addTestListener

    public void addTestListener(TestListener listener)

  Registers a test listener with this task. Consider also the following handy methods for quicker hooking into test execution: beforeTest(groovy.lang.Closure), afterTest(groovy.lang.Closure), beforeSuite(groovy.lang.Closure), afterSuite(groovy.lang.Closure)

  This listener will NOT be notified of tests executed by other tasks. To get that behavior, use Gradle.addListener.

  Parameters:
    `listener` - The listener to add.

### addTestOutputListener

    public void addTestOutputListener(TestOutputListener listener)

  Registers a output listener with this task. Quicker way of hooking into output events is using the onOutput(groovy.lang.Closure) method.
  Parameters:
    `listener` - The listener to add.

### afterSuite

    public void afterSuite(groovy.lang.Closure closure)

  Adds a closure to be notified after a test suite has executed. A TestDescriptor and TestResult instance are passed to the closure as a parameter.

  This method is also called after all test suites are executed. The provided descriptor will have a null parent suite.

  Parameters:
    `closure` - The closure to call.

### afterTest

    public void afterTest(groovy.lang.Closure closure)

  Adds a closure to be notified after a test has executed. A TestDescriptor and TestResult instance are passed to the closure as a parameter.
  Parameters:
    `closure` - The closure to call.

### beforeSuite

    public void beforeSuite(groovy.lang.Closure closure)

  Adds a closure to be notified before a test suite is executed. A TestDescriptor instance is passed to the closure as a parameter.

  This method is also called before any test suites are executed. The provided descriptor will have a null parent suite.

  Parameters:
    `closure` - The closure to call.

### beforeTest

    public void beforeTest(groovy.lang.Closure closure)

  Adds a closure to be notified before a test is executed. A TestDescriptor instance is passed to the closure as a parameter.
  Parameters:
    `closure` - The closure to call.

### bootstrapClasspath

    public Test bootstrapClasspath(java.lang.Object... classpath)

  {@inheritDoc}

### copyTo

    public Test copyTo(ProcessForkOptions target)

  {@inheritDoc}

### copyTo

    public Test copyTo(JavaForkOptions target)

  {@inheritDoc}

### disableTestReport

    public void disableTestReport()

### enableTestReport

    public void enableTestReport()

### environment

    public Test environment(java.util.Map environmentVariables)

  {@inheritDoc}

### environment

    public Test environment(java.lang.String name, java.lang.Object value)

  {@inheritDoc}

### exclude

    public Test exclude(java.lang.String... excludes)

  Adds exclude patterns for the files in the test classes directory (e.g. '**F;*Test.class')).
  See Also:
    setExcludes(Iterable)

### exclude

    public Test exclude(java.lang.Iterable excludes)

  Adds exclude patterns for the files in the test classes directory (e.g. '**F;*Test.class')).
  See Also:
    setExcludes(Iterable)

### exclude

    public Test exclude(Spec excludeSpec)

  {@inheritDoc}

### exclude

    public Test exclude(groovy.lang.Closure excludeSpec)

  {@inheritDoc}

### executable

    public Test executable(java.lang.Object executable)

  {@inheritDoc}

### executeTests

    @TaskAction
    public void executeTests()

### getAllJvmArgs

    public java.util.List getAllJvmArgs()

  {@inheritDoc}

### getBootstrapClasspath

    @Input
    public FileCollection getBootstrapClasspath()

  {@inheritDoc}

### getCandidateClassFiles

    @InputFiles
    @Input // Also marked as input to force tests to run when the set of candidate class files changes
    public FileTree getCandidateClassFiles()

  Returns the classes files to scan for test classes.
  Returns:
    The candidate class files.

### getClasspath

    @InputFiles
    public FileCollection getClasspath()

  Returns the classpath to use to execute the tests.

### getDebug

    public boolean getDebug()

  {@inheritDoc}

### getEnableAssertions

    @Input
    public boolean getEnableAssertions()

  {@inheritDoc}

### getEnvironment

    public java.util.Map getEnvironment()

  {@inheritDoc}

### getExcludes

    public java.util.Set getExcludes()

  Returns the exclude patterns for test execution.
  See Also:
    exclude(String...)

### getExecutable

    @Input
    public java.lang.String getExecutable()

  {@inheritDoc}

### getForkEvery

    public long getForkEvery()

  Returns the maximum number of test classes to execute in a forked test process. The forked test process will be restarted when this limit is reached. The default value is 0 (no maximum).
  Returns:
    The maximum number of test classes. Returns 0 when there is no maximum.

### getIncludes

    public java.util.Set getIncludes()

  Returns the include patterns for test execution.
  See Also:
    include(String...)

### getJvmArgs

    @Input
    public java.util.List getJvmArgs()

  {@inheritDoc}

### getMaxHeapSize

    public java.lang.String getMaxHeapSize()

  {@inheritDoc}

### getMaxParallelForks

    public int getMaxParallelForks()

  Returns the maximum number of forked test processes to execute in parallel. The default value is 1 (no parallel test execution).
  Returns:
    The maximum number of forked test processes.

### getOptions

    @Nested
    public TestFrameworkOptions getOptions()

  Returns the test options options.

  Be sure to call the appropriate useJUnit() or useTestNG() method before using this method.

  Returns:
    The testframework options.

### getSystemProperties

    @Input
    public java.util.Map getSystemProperties()

  {@inheritDoc}

### getTestClassesDir

    public java.io.File getTestClassesDir()

  Returns the root folder for the compiled test sources.
  Returns:
    All test class directories to be used.

### getTestFramework

    public org.gradle.api.internal.tasks.testing.TestFramework getTestFramework()

### getTestLogging

    public TestLogging getTestLogging()

  Allows configuring the logging of the test execution, for example log eagerly the standard output, etc.

       apply plugin: 'java'

       //makes the standard streams (err and out) visible at console when running tests
       test.testLogging.showStandardStreams = true

  Returns:
    test logging configuration

### getTestReportDir

    @OutputDirectory
    public java.io.File getTestReportDir()

  Returns the root folder for the test reports.
  Returns:
    the test report directory, containing the test report mostly in HTML form.

### getTestResultsDir

    @OutputDirectory
    public java.io.File getTestResultsDir()

  Returns the root folder for the test results.
  Returns:
    the test result directory, containing the internal test results, mostly in xml form.

### getTestSrcDirs

    @InputFiles
    public java.util.List getTestSrcDirs()

  Returns the directories containing the test source.

### getWorkingDir

    @Input
    public java.io.File getWorkingDir()

  {@inheritDoc}

### include

    public Test include(java.lang.String... includes)

  Adds include patterns for the files in the test classes directory (e.g. '**F;*Test.class')).
  See Also:
    setIncludes(Iterable)

### include

    public Test include(java.lang.Iterable includes)

  Adds include patterns for the files in the test classes directory (e.g. '**F;*Test.class')).
  See Also:
    setIncludes(Iterable)

### include

    public Test include(Spec includeSpec)

  {@inheritDoc}

### include

    public Test include(groovy.lang.Closure includeSpec)

  {@inheritDoc}

### isIgnoreFailures

    @Input
    public boolean isIgnoreFailures()

  {@inheritDoc}

### isScanForTestClasses

    @Input
    public boolean isScanForTestClasses()

  Specifies whether test classes should be detected. When `true` the classes which match the include and exclude patterns are scanned for test classes, and any found are executed. When `false` the classes which match the include and exclude patterns are executed.

### isTestReport

    @Input
    public boolean isTestReport()

  Specifies whether the test report should be generated.

### jvmArgs

    public Test jvmArgs(java.lang.Iterable arguments)

  {@inheritDoc}

### jvmArgs

    public Test jvmArgs(java.lang.Object... arguments)

  {@inheritDoc}

### onOutput

    public void onOutput(groovy.lang.Closure closure)

  Adds a closure to be notified when output from the test received. A TestDescriptor and TestOutputEvent instance are passed to the closure as a parameter.

       apply plugin: 'java'

       test {
         onOutput { descriptor, event ->
           if (event.destination == TestOutputEvent.Destination.StdErr) {
             logger.error("Test: " + descriptor + ", error: " + event.message)
           }
         }
       }

  Parameters:
    `closure` - The closure to call.

### options

    public TestFrameworkOptions options(groovy.lang.Closure testFrameworkConfigure)

### removeTestListener

    public void removeTestListener(TestListener listener)

  Unregisters a test listener with this task. This method will only remove listeners that were added by calling addTestListener(org.gradle.api.tasks.testing.TestListener) on this task. If the listener was registered with Gradle using Gradle.addListener this method will not do anything. Instead, use Gradle.removeListener.
  Parameters:
    `listener` - The listener to remove.

### removeTestOutputListener

    public void removeTestOutputListener(TestOutputListener listener)

  Unregisters a test output listener with this task. This method will only remove listeners that were added by calling addTestOutputListener(org.gradle.api.tasks.testing.TestOutputListener) on this task. If the listener was registered with Gradle using Gradle.addListener this method will not do anything. Instead, use Gradle.removeListener.
  Parameters:
    `listener` - The listener to remove.

### setAllJvmArgs

    public void setAllJvmArgs(java.lang.Iterable arguments)

  {@inheritDoc}

### setBootstrapClasspath

    public void setBootstrapClasspath(FileCollection classpath)

  {@inheritDoc}

### setClasspath

    public void setClasspath(FileCollection classpath)

### setDebug

    public void setDebug(boolean enabled)

  {@inheritDoc}

### setEnableAssertions

    public void setEnableAssertions(boolean enabled)

  {@inheritDoc}

### setEnvironment

    public void setEnvironment(java.util.Map environmentVariables)

  {@inheritDoc}

### setExcludes

    public Test setExcludes(java.lang.Iterable excludes)

  Sets the exclude patterns for test execution.
  Parameters:
    `excludes` - The patterns list
  See Also:
    exclude(String...)

### setExecutable

    public void setExecutable(java.lang.Object executable)

  {@inheritDoc}

### setForkEvery

    public void setForkEvery(java.lang.Long forkEvery)

  Sets the maximum number of test classes to execute in a forked test process. Use null or 0 to use no maximum.
  Parameters:
    `forkEvery` - The maximum number of test classes. Use null or 0 to specify no maximum.

### setIgnoreFailures

    public Test setIgnoreFailures(boolean ignoreFailures)

  {@inheritDoc}

### setIncludes

    public Test setIncludes(java.lang.Iterable includes)

  Sets the include patterns for test execution.
  Parameters:
    `includes` - The patterns list
  See Also:
    include(String...)

### setJvmArgs

    public void setJvmArgs(java.lang.Iterable arguments)

  {@inheritDoc}

### setMaxHeapSize

    public void setMaxHeapSize(java.lang.String heapSize)

  {@inheritDoc}

### setMaxParallelForks

    public void setMaxParallelForks(int maxParallelForks)

  Sets the maximum number of forked test processes to execute in parallel. Set to 1 to disable parallel test execution.
  Parameters:
    `maxParallelForks` - The maximum number of forked test processes.

### setScanForTestClasses

    public void setScanForTestClasses(boolean scanForTestClasses)

### setSystemProperties

    public void setSystemProperties(java.util.Map properties)

  {@inheritDoc}

### setTestClassesDir

    public void setTestClassesDir(java.io.File testClassesDir)

  Sets the root folder for the compiled test sources.
  Parameters:
    `testClassesDir` - The root folder

### setTestReport

    public void setTestReport(boolean testReport)

### setTestReportDir

    public void setTestReportDir(java.io.File testReportDir)

  Sets the root folder for the test reports.
  Parameters:
    `testReportDir` - The root folder

### setTestResultsDir

    public void setTestResultsDir(java.io.File testResultsDir)

  Sets the root folder for the test results.
  Parameters:
    `testResultsDir` - The root folder

### setTestSrcDirs

    public void setTestSrcDirs(java.util.List testSrcDir)

### setWorkingDir

    public void setWorkingDir(java.lang.Object dir)

  {@inheritDoc}

### systemProperties

    public Test systemProperties(java.util.Map properties)

  {@inheritDoc}

### systemProperty

    public Test systemProperty(java.lang.String name, java.lang.Object value)

  {@inheritDoc}

### testFramework

    public org.gradle.api.internal.tasks.testing.TestFramework testFramework(groovy.lang.Closure testFrameworkConfigure)

### testLogging

    public void testLogging(groovy.lang.Closure closure)

  Allows configuring the logging of the test execution, for example log eagerly the standard output, etc.

       apply plugin: 'java'

       //makes the standard streams (err and out) visible at console when running tests
       test.testLogging {
         showStandardStreams = true
       }

  Parameters:
    `closure` - configure closure

### useJUnit

    public void useJUnit()

  Specifies that JUnit should be used to execute the tests.

### useJUnit

    public void useJUnit(groovy.lang.Closure testFrameworkConfigure)

  Specifies that JUnit should be used to execute the tests.
  Parameters:
    `testFrameworkConfigure` - A closure used to configure the JUint options. This closure is passed an instance of type JUnitOptions.

### useTestNG

    public void useTestNG()

  Specifies that TestNG should be used to execute the tests.

### useTestNG

    public void useTestNG(groovy.lang.Closure testFrameworkConfigure)

  Specifies that TestNG should be used to execute the tests.
  Parameters:
    `testFrameworkConfigure` - A closure used to configure the JUint options. This closure is passed an instance of type JUnitOptions.

### workingDir

    public Test workingDir(java.lang.Object dir)

  {@inheritDoc}

Groovy Documentation