Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.gradle.api.tasks.testing
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:
  groovy.lang.GroovyObject, java.lang.Comparable<Task>, org.gradle.api.internal.DynamicObjectAware, org.gradle.api.internal.IConventionAware, org.gradle.api.internal.TaskInternal, Task, PatternFilterable

    public class Test

extends org.gradle.api.internal.ConventionTask
implements PatternFilterable

A task for executing JUnit (3.8.x or 4) or TestNG tests.

Field Summary
`static java.lang.String` | `FAILURES_OR_ERRORS_PROPERTY`
`static java.lang.String` | `TEST_FRAMEWORK_DEFAULT_PROPERTY`

Fields inherited from interface org.gradle.api.Task
`AUTOSKIP_PROPERTY_PREFIX, TASK_ACTION, TASK_DEPENDS_ON, TASK_DESCRIPTION, TASK_NAME, TASK_OVERWRITE, TASK_TYPE`

Constructor Summary
`Test()`

Method Summary
`void` | `disableTestReport()`
`void` | `enableTestReport()`
`Test` | `exclude(java.lang.Iterable<java.lang.String> excludes)` Adds exclude patterns for the files in the test classes directory (e.g.
`Test` | `exclude(java.lang.String... excludes)` Adds exclude patterns for the files in the test classes directory (e.g.
`protected void` | `executeTests()`
`FileCollection` | `getClasspath()`
`java.util.Set<java.lang.String>` | `getExcludes()` Returns the exclude patterns for test execution.
`java.util.Set<java.lang.String>` | `getIncludes()` Returns the include patterns for test execution.
`java.lang.Object` | `getOptions()` Backwards compatible access to the TestFramework options.
`java.io.File` | `getTestClassesDir()` Returns the root folder for the compiled test sources.
`TestFramework` | `getTestFramework()`
`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<java.io.File>` | `getTestSrcDirs()`
`Test` | `include(java.lang.Iterable<java.lang.String> includes)` Adds include patterns for the files in the test classes directory (e.g.
`Test` | `include(java.lang.String... includes)` Adds include patterns for the files in the test classes directory (e.g.
`boolean` | `isScanForTestClasses()`
`boolean` | `isStopAtFailuresOrErrors()` Returns whether this task should throw an exception in case of test failure or error.
`boolean` | `isTestReport()`
`java.lang.Object` | `options(groovy.lang.Closure testFrameworkConfigure)`
`void` | `setClasspath(FileCollection configuration)`
`Test` | `setExcludes(java.lang.Iterable<java.lang.String> excludes)` Sets the exclude patterns for test execution.
`Test` | `setIncludes(java.lang.Iterable<java.lang.String> includes)` Sets the include patterns for test execution.
`void` | `setScanForTestClasses(boolean scanForTestClasses)`
`void` | `setStopAtFailuresOrErrors(boolean stopAtFailuresOrErrors)` Sets whether this task should throw an exception in case of test failuer or error.
`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<java.io.File> testSrcDir)`
`TestFramework` | `testFramework(groovy.lang.Closure testFrameworkConfigure)`
`TestFramework` | `useDefaultTestFramework(groovy.lang.Closure testFrameworkConfigure)`
`TestFramework` | `useJUnit()`
`TestFramework` | `useJUnit(groovy.lang.Closure testFrameworkConfigure)`
`TestFramework` | `useTestFramework(TestFramework testFramework)`
`TestFramework` | `useTestFramework(TestFramework testFramework, groovy.lang.Closure testFrameworkConfigure)`
`TestFramework` | `useTestNG()`
`TestFramework` | `useTestNG(groovy.lang.Closure testFrameworkConfigure)`

Methods inherited from class org.gradle.api.internal.ConventionTask
`conventionMapping, getConventionMapping, setConventionMapping`

Methods inherited from class org.gradle.api.DefaultTask
`configure, doFirst, doLast, leftShift`

Methods inherited from class org.gradle.api.internal.AbstractTask
`captureStandardOutput, compareTo, defineProperty, deleteAllActions, dependsOn, dependsOnTaskDidWork, disableStandardOutputCapture, doFirst, doLast, equals, execute, getActions, getAdditionalProperties, getAnt, getAsDynamicObject, getConvention, getDependsOn, getDescription, getDidWork, getDynamicObjectHelper, getEnabled, getExecuted, getLogger, getName, getOutput, getPath, getProject, getStandardOutputCapture, getTaskDependencies, hashCode, hasProperty, injectIntoNextInstance, isDidWork, isEnabled, isExecuted, onlyIf, onlyIf, property, setActions, setAdditionalProperties, setConvention, setDependsOn, setDescription, setDidWork, setEnabled, setExecuted, setName, setOutputHandler, setProject, setProperty, setStandardOutputCapture, toString`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Methods inherited from interface groovy.lang.GroovyObject
`getMetaClass, getProperty, invokeMethod, setMetaClass, setProperty`

Field Detail

### FAILURES_OR_ERRORS_PROPERTY

    public static final java.lang.String FAILURES_OR_ERRORS_PROPERTY

See Also:
  Constant Field Values

### TEST_FRAMEWORK_DEFAULT_PROPERTY

    public static final java.lang.String TEST_FRAMEWORK_DEFAULT_PROPERTY

See Also:
  Constant Field Values

Constructor Detail

### Test

    public Test()

Method Detail

### executeTests

    protected void executeTests()

### include

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

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

  Specified by:
    `include` in interface `PatternFilterable`
  Parameters:
    `includes` - a vararg list of include patterns
  See Also:
    `setIncludes(Iterable)`

### include

    public Test include(java.lang.Iterable<java.lang.String> includes)

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

  Specified by:
    `include` in interface `PatternFilterable`
  Parameters:
    `includes` - a Iterable providing more include patterns
  See Also:
    `setIncludes(Iterable)`

### exclude

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

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

  Specified by:
    `exclude` in interface `PatternFilterable`
  Parameters:
    `excludes` - a vararg list of exclude patterns
  See Also:
    `setExcludes(Iterable)`

### exclude

    public Test exclude(java.lang.Iterable<java.lang.String> excludes)

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

  Specified by:
    `exclude` in interface `PatternFilterable`
  Parameters:
    `excludes` - a Iterable providing new exclude patterns
  See Also:
    `setExcludes(Iterable)`

### getTestClassesDir

    public java.io.File getTestClassesDir()

  Returns the root folder for the compiled test sources.

### setTestClassesDir

    public void setTestClassesDir(java.io.File testClassesDir)

  Sets the root folder for the compiled test sources.

  Parameters:
    `testClassesDir` - The root folder

### getTestResultsDir

    public java.io.File getTestResultsDir()

  Returns the root folder for the test results.

### setTestResultsDir

    public void setTestResultsDir(java.io.File testResultsDir)

  Sets the root folder for the test results.

  Parameters:
    `testResultsDir` - The root folder

### getTestReportDir

    public java.io.File getTestReportDir()

  Returns the root folder for the test reports.

### setTestReportDir

    public void setTestReportDir(java.io.File testReportDir)

  Sets the root folder for the test reports.

  Parameters:
    `testReportDir` - The root folder

### getIncludes

    public java.util.Set<java.lang.String> getIncludes()

  Returns the include patterns for test execution.

  Specified by:
    `getIncludes` in interface `PatternFilterable`
  See Also:
    `include(String...)`

### setIncludes

    public Test setIncludes(java.lang.Iterable<java.lang.String> includes)

  Sets the include patterns for test execution.

  Specified by:
    `setIncludes` in interface `PatternFilterable`
  Parameters:
    `includes` - The patterns list
  See Also:
    `include(String...)`

### getExcludes

    public java.util.Set<java.lang.String> getExcludes()

  Returns the exclude patterns for test execution.

  Specified by:
    `getExcludes` in interface `PatternFilterable`
  See Also:
    `exclude(String...)`

### setExcludes

    public Test setExcludes(java.lang.Iterable<java.lang.String> excludes)

  Sets the exclude patterns for test execution.

  Specified by:
    `setExcludes` in interface `PatternFilterable`
  Parameters:
    `excludes` - The patterns list
  See Also:
    `exclude(String...)`

### isStopAtFailuresOrErrors

    public boolean isStopAtFailuresOrErrors()

  Returns whether this task should throw an exception in case of test failure or error.

### setStopAtFailuresOrErrors

    public void setStopAtFailuresOrErrors(boolean stopAtFailuresOrErrors)

  Sets whether this task should throw an exception in case of test failuer or error.

### getTestFramework

    public TestFramework getTestFramework()

### testFramework

    public TestFramework testFramework(groovy.lang.Closure testFrameworkConfigure)

### getOptions

    public java.lang.Object getOptions()

  Backwards compatible access to the TestFramework options. Be sure to call the appropriate useJUnit/useTestNG/useTestFramework function or set the default before using this function.

  Returns:
    The testframework options.

### options

    public java.lang.Object options(groovy.lang.Closure testFrameworkConfigure)

### useTestFramework

    public TestFramework useTestFramework(TestFramework testFramework)

### useTestFramework

    public TestFramework useTestFramework(TestFramework testFramework,
                                          groovy.lang.Closure testFrameworkConfigure)

### useJUnit

    public TestFramework useJUnit()

### useJUnit

    public TestFramework useJUnit(groovy.lang.Closure testFrameworkConfigure)

### useTestNG

    public TestFramework useTestNG()

### useTestNG

    public TestFramework useTestNG(groovy.lang.Closure testFrameworkConfigure)

### useDefaultTestFramework

    public TestFramework useDefaultTestFramework(groovy.lang.Closure testFrameworkConfigure)

### getClasspath

    public FileCollection getClasspath()

### setClasspath

    public void setClasspath(FileCollection configuration)

### isTestReport

    public boolean isTestReport()

### setTestReport

    public void setTestReport(boolean testReport)

### enableTestReport

    public void enableTestReport()

### disableTestReport

    public void disableTestReport()

### getTestSrcDirs

    public java.util.List<java.io.File> getTestSrcDirs()

### setTestSrcDirs

    public void setTestSrcDirs(java.util.List<java.io.File> testSrcDir)

### isScanForTestClasses

    public boolean isScanForTestClasses()

### setScanForTestClasses

    public void setScanForTestClasses(boolean scanForTestClasses)

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD