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
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:
  PatternFilterable

    class Test
    extends ConventionTask

A task for executing Junit 3.8.x and Junit 4 tests.

author:
  Hans Dockter

Field Summary
`static java.lang.String` | `FAILURES_OR_ERRORS_PROPERTY`
`static java.lang.String` | `TEST_FRAMEWORK_DEFAULT_PROPERTY`
`protected ExistingDirsFilter` | `existingDirsFilter`

Constructor Summary
`Test(Project project, java.lang.String name)`

Method Summary
`void` | `disableTestReport()`
`void` | `enableTestReport()`
`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')).
`protected void` | `executeTests()`
`List` | `getClasspath()`
`FileCollection` | `getConfiguration()`
`Set` | `getExcludes()` Returns the exclude patterns for test execution.
`Set` | `getIncludes()` Returns the include patterns for test execution.
`java.lang.Object` | `getOptions()` Backwards compatible access to the TestFramework options.
`File` | `getTestClassesDir()` Returns the root folder for the compiled test sources.
`TestFramework` | `getTestFramework()`
`File` | `getTestReportDir()` Returns the root folder for the test reports.
`File` | `getTestResultsDir()` Returns the root folder for the test results.
`List` | `getTestSrcDirs()`
`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')).
`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(Closure testFrameworkConfigure)`
`void` | `setConfiguration(FileCollection configuration)`
`Test` | `setExcludes(java.lang.Iterable excludes)` Sets the exclude patterns for test execution.
`Test` | `setIncludes(java.lang.Iterable 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(File testClassesDir)` Sets the root folder for the compiled test sources.
`void` | `setTestReport(boolean testReport)`
`void` | `setTestReportDir(File testReportDir)` Sets the root folder for the test reports.
`void` | `setTestResultsDir(File testResultsDir)` Sets the root folder for the test results.
`void` | `setTestSrcDirs(List testSrcDir)`
`TestFramework` | `testFramework(Closure testFrameworkConfigure)`
`TestFramework` | `useDefaultTestFramework(Closure testFrameworkConfigure)`
`TestFramework` | `useJUnit()`
`TestFramework` | `useJUnit(Closure testFrameworkConfigure)`
`TestFramework` | `useTestFramework(TestFramework testFramework)`
`TestFramework` | `useTestFramework(TestFramework testFramework, Closure testFrameworkConfigure)`
`TestFramework` | `useTestNG()`
`TestFramework` | `useTestNG(Closure testFrameworkConfigure)`

Methods inherited from class ConventionTask
conv, conventionMapping, conventionMapping, conventionProperty, getConventionAwareHelper, getConventionMapping, setConventionAwareHelper, setConventionMapping

Methods inherited from class DefaultTask
leftShift, methodMissing, propertyMissing

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

Methods inherited from class java.lang.Object
hashCode, getClass, equals, toString, wait, wait, wait, notify, notifyAll

Field Detail

### FAILURES_OR_ERRORS_PROPERTY

    static final java.lang.String FAILURES_OR_ERRORS_PROPERTY

### TEST_FRAMEWORK_DEFAULT_PROPERTY

    static final java.lang.String TEST_FRAMEWORK_DEFAULT_PROPERTY

### existingDirsFilter

    protected ExistingDirsFilter existingDirsFilter

Constructor Detail

### Test

    public Test(Project project, java.lang.String name)

Method Detail

### disableTestReport

    public void disableTestReport()

### enableTestReport

    public void enableTestReport()

### 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:
    #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:
    #setExcludes(Iterable)

### executeTests

    protected void executeTests()

### getClasspath

    public List getClasspath()

### getConfiguration

    public FileCollection getConfiguration()

### getExcludes

    public Set getExcludes()

  Returns the exclude patterns for test execution.
  see:
    #include(String[])

### getIncludes

    public Set getIncludes()

  Returns the include patterns for test execution.
  see:
    #include(String[])

### 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.
  return:
    The testframework options.

### getTestClassesDir

    public File getTestClassesDir()

  Returns the root folder for the compiled test sources.

### getTestFramework

    public TestFramework getTestFramework()

### getTestReportDir

    public File getTestReportDir()

  Returns the root folder for the test reports.

### getTestResultsDir

    public File getTestResultsDir()

  Returns the root folder for the test results.

### getTestSrcDirs

    public List getTestSrcDirs()

### 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:
    #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:
    #setIncludes(Iterable)

### isScanForTestClasses

    public boolean isScanForTestClasses()

### isStopAtFailuresOrErrors

    public boolean isStopAtFailuresOrErrors()

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

### isTestReport

    public boolean isTestReport()

### options

    public java.lang.Object options(Closure testFrameworkConfigure)

### setConfiguration

    public void setConfiguration(FileCollection configuration)

### setExcludes

    public Test setExcludes(java.lang.Iterable excludes)

  Sets the exclude patterns for test execution.
  param:
    excludes The patterns list
  see:
    #exclude(String[])

### setIncludes

    public Test setIncludes(java.lang.Iterable includes)

  Sets the include patterns for test execution.
  param:
    includes The patterns list
  see:
    #include(String[])

### setScanForTestClasses

    public void setScanForTestClasses(boolean scanForTestClasses)

### setStopAtFailuresOrErrors

    public void setStopAtFailuresOrErrors(boolean stopAtFailuresOrErrors)

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

### setTestClassesDir

    public void setTestClassesDir(File testClassesDir)

  Sets the root folder for the compiled test sources.
  param:
    testClassesDir The root folder

### setTestReport

    public void setTestReport(boolean testReport)

### setTestReportDir

    public void setTestReportDir(File testReportDir)

  Sets the root folder for the test reports.
  param:
    testReportDir The root folder

### setTestResultsDir

    public void setTestResultsDir(File testResultsDir)

  Sets the root folder for the test results.
  param:
    testResultsDir The root folder

### setTestSrcDirs

    public void setTestSrcDirs(List testSrcDir)

### testFramework

    public TestFramework testFramework(Closure testFrameworkConfigure)

### useDefaultTestFramework

    public TestFramework useDefaultTestFramework(Closure testFrameworkConfigure)

### useJUnit

    public TestFramework useJUnit()

### useJUnit

    public TestFramework useJUnit(Closure testFrameworkConfigure)

### useTestFramework

    public TestFramework useTestFramework(TestFramework testFramework)

### useTestFramework

    public TestFramework useTestFramework(TestFramework testFramework, Closure testFrameworkConfigure)

### useTestNG

    public TestFramework useTestNG()

### useTestNG

    public TestFramework useTestNG(Closure testFrameworkConfigure)

Groovy Documentation