org.gradle.api.tasks.testing
Class Test

java.lang.Object
  extended by ConventionTask
      extended by org.gradle.api.tasks.testing.Test

public class Test
extends ConventionTask

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

Author:
Hans Dockter

Field Summary
protected  ClasspathConverter classpathConverter
           
protected  ExistingDirsFilter existingDirsFilter
           
 
Constructor Summary
Test(Project project, java.lang.String name)
           
 
Method Summary
 Test exclude(java.lang.String... excludes)
          Adds exclude patterns for the files in the test classes directory (e.g.
protected  void executeTests(Task task)
           
 AntJunit getAntJunit()
          Returns the AntJunit instance the test execution is delegated to.
 java.util.List getClasspath()
           
 DependencyManager getDependencyManager()
          Returns the dependency manager used by this task for resolving dependencies.
 java.util.List getExcludes()
          Returns the exclude patterns for test execution.
 java.util.List getIncludes()
          Returns the include patterns for test execution.
 JunitOptions getOptions()
          Returns an JUnit option instance to read or modify.
 java.io.File getTestClassesDir()
          Returns the root folder for the compiled test sources.
 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 getUnmanagedClasspath()
          Returns the unmanaged classpath.
 Test include(java.lang.String... includes)
          Adds include patterns for the files in the test classes directory (e.g.
 boolean isStopAtFailuresOrErrors()
          Returns whether this task should throw an exception in case of test failuer or error.
 void setAntJunit(AntJunit antJunit)
          Sets the AntJunit instance the test execution is delegated to.
 void setDependencyManager(DependencyManager dependencyManager)
          Sets the dependency manager used by this task for resolving dependencies.
 void setExcludes(java.util.List excludes)
          Sets the exclude patterns for test execution.
 void setIncludes(java.util.List includes)
          Sets the include patterns for test execution.
 void setOptions(JunitOptions options)
          Sets a new JUnit options instance.
 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 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 setUnmanagedClasspath(java.util.List unmanagedClasspath)
          Sets the unmanaged classpath.
 Test unmanagedClasspath(java.lang.Object... elements)
          This methode is usually used only internally by Gradle.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

existingDirsFilter

protected ExistingDirsFilter existingDirsFilter

classpathConverter

protected ClasspathConverter classpathConverter
Constructor Detail

Test

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

executeTests

protected void executeTests(Task task)

getClasspath

public java.util.List 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')).

See Also:
setIncludes(java.util.List)

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:
(java.util.List)

unmanagedClasspath

public Test unmanagedClasspath(java.lang.Object... elements)
This methode is usually used only internally by Gradle. A list of files are added to the compile classpath. The files should point to jars or directories containing class files. The files added here are not shared in a multi-project build and are not listed in a dependency descriptor if you upload your library to a repository.

Parameters:
elements - The elements to be added
Returns:
this

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

getOptions

public JunitOptions getOptions()
Returns an JUnit option instance to read or modify.

Returns:

setOptions

public void setOptions(JunitOptions options)
Sets a new JUnit options instance. It is usually not necessary to set a new instance.

Parameters:
options - The new instance

getIncludes

public java.util.List getIncludes()
Returns the include patterns for test execution.

See Also:
include(String[])

setIncludes

public void setIncludes(java.util.List includes)
Sets the include patterns for test execution.

Parameters:
includes - The patterns list
See Also:
include(String[])

getExcludes

public java.util.List getExcludes()
Returns the exclude patterns for test execution.

See Also:
include(String[])

setExcludes

public void setExcludes(java.util.List excludes)
Sets the exclude patterns for test execution.

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 failuer or error.


setStopAtFailuresOrErrors

public void setStopAtFailuresOrErrors(boolean stopAtFailuresOrErrors)
Sets whether this task should throw an exception in case of test failuer or error.


getUnmanagedClasspath

public java.util.List getUnmanagedClasspath()
Returns the unmanaged classpath.

See Also:
unmanagedClasspath(Object[])

setUnmanagedClasspath

public void setUnmanagedClasspath(java.util.List unmanagedClasspath)
Sets the unmanaged classpath.

See Also:
unmanagedClasspath(Object[])

getAntJunit

public AntJunit getAntJunit()
Returns the AntJunit instance the test execution is delegated to.


setAntJunit

public void setAntJunit(AntJunit antJunit)
Sets the AntJunit instance the test execution is delegated to.

Parameters:
antJunit - The new instance

getDependencyManager

public DependencyManager getDependencyManager()
Returns the dependency manager used by this task for resolving dependencies.


setDependencyManager

public void setDependencyManager(DependencyManager dependencyManager)
Sets the dependency manager used by this task for resolving dependencies.

Parameters:
dependencyManager - The new dependency manager