org.gradle.api.tasks.testing
Class Test

java.lang.Object
  extended by org.gradle.api.internal.AbstractTask
      extended by org.gradle.api.DefaultTask
          extended by org.gradle.api.internal.ConventionTask
              extended by org.gradle.api.tasks.testing.Test
All Implemented Interfaces:
groovy.lang.GroovyObject, java.lang.Comparable<Task>, 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 and Junit 4 tests.


Field Summary
protected  ExistingDirsFilter existingDirsFilter
           
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(Project project, java.lang.String name)
           
 
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()
           
 java.util.List<java.io.File> getClasspath()
           
 FileCollection getConfiguration()
           
 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 setConfiguration(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
conv, conventionMapping, conventionMapping, conventionProperty, getConventionAwareHelper, getConventionMapping, setConventionAwareHelper, setConventionMapping
 
Methods inherited from class org.gradle.api.DefaultTask
configure, doFirst, doLast, leftShift, methodMissing, propertyMissing, setProperty
 
Methods inherited from class org.gradle.api.internal.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, hashCode, hasProperty, isDidWork, isEnabled, isExecuted, onlyIf, onlyIf, property, setActions, setAdditionalProperties, setDependsOn, setDescription, setDidWork, setEnabled, setExecuted, setName, setProject, setSkipProperties, 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
 

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

existingDirsFilter

protected ExistingDirsFilter existingDirsFilter
Constructor Detail

Test

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

executeTests

protected void executeTests()

getClasspath

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

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
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
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
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
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:
include(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)

getConfiguration

public FileCollection getConfiguration()

setConfiguration

public void setConfiguration(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)