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.ConventionTask
          org.gradle.api.tasks.testing.Test

All Implemented Interfaces:
  PatternFilterable

    class Test
    extends ConventionTask

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

author:
  Hans Dockter

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

Constructor Summary
`Test()`

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()`
`FileCollection` | `getClasspath()`
`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` | `setClasspath(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)`

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

Constructor Detail

### Test

    Test()

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

    @TaskAction
    protected void executeTests()

### getClasspath

    @InputFiles
    public FileCollection getClasspath()

### getExcludes

    public Set getExcludes()

  Returns the exclude patterns for test execution.
  see:
    #exclude(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

    @InputDirectory
    @SkipWhenEmpty
    public File getTestClassesDir()

  Returns the root folder for the compiled test sources.

### getTestFramework

    public TestFramework getTestFramework()

### getTestReportDir

    @OutputDirectory
    public File getTestReportDir()

  Returns the root folder for the test reports.

### getTestResultsDir

    @OutputDirectory
    public File getTestResultsDir()

  Returns the root folder for the test results.

### getTestSrcDirs

    @InputFiles
    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)

### setClasspath

    public void setClasspath(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