|
Groovy Documentation | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.gradle.api.internal.ConventionTask org.gradle.api.tasks.testing.Test
public class Test extends ConventionTask
A task for executing JUnit (3.8.x or 4.x) or TestNG tests.
Constructor Summary | |
Test()
|
Method Summary | |
---|---|
void
|
addTestListener(TestListener listener)
Registers a test listener with this task. |
void
|
afterSuite(groovy.lang.Closure closure)
Adds a closure to be notified after a test suite has executed. |
void
|
afterTest(groovy.lang.Closure closure)
Adds a closure to be notified after a test has executed. |
void
|
beforeSuite(groovy.lang.Closure closure)
Adds a closure to be notified before a test suite is executed. |
void
|
beforeTest(groovy.lang.Closure closure)
Adds a closure to be notified before a test is executed. |
Test
|
bootstrapClasspath(java.lang.Object classpath)
{@inheritDoc} |
Test
|
copyTo(ProcessForkOptions target)
{@inheritDoc} |
Test
|
copyTo(JavaForkOptions target)
{@inheritDoc} |
void
|
disableTestReport()
|
void
|
enableTestReport()
|
Test
|
environment(java.util.Map environmentVariables)
{@inheritDoc} |
Test
|
environment(java.lang.String name, java.lang.Object value)
{@inheritDoc} |
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')). |
Test
|
exclude(Spec excludeSpec)
|
Test
|
exclude(groovy.lang.Closure excludeSpec)
|
Test
|
executable(java.lang.Object executable)
{@inheritDoc} |
void
|
executeTests()
|
java.util.List
|
getAllJvmArgs()
{@inheritDoc} |
FileCollection
|
getBootstrapClasspath()
{@inheritDoc} |
FileTree
|
getCandidateClassFiles()
Returns the classes files to scan for test classes. |
FileCollection
|
getClasspath()
|
boolean
|
getDebug()
{@inheritDoc} |
boolean
|
getEnableAssertions()
{@inheritDoc} |
java.util.Map
|
getEnvironment()
{@inheritDoc} |
java.util.Set
|
getExcludes()
Returns the exclude patterns for test execution. |
java.lang.String
|
getExecutable()
{@inheritDoc} |
long
|
getForkEvery()
Returns the maximum number of test classes to execute in a forked test process. |
java.util.Set
|
getIncludes()
Returns the include patterns for test execution. |
java.util.List
|
getJvmArgs()
{@inheritDoc} |
java.lang.String
|
getMaxHeapSize()
{@inheritDoc} |
int
|
getMaxParallelForks()
Returns the maximum number of forked test processes to execute in parallel. |
TestFrameworkOptions
|
getOptions()
Returns the test options options. |
java.util.Map
|
getSystemProperties()
{@inheritDoc} |
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
|
getTestSrcDirs()
|
java.io.File
|
getWorkingDir()
{@inheritDoc} |
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')). |
Test
|
include(Spec includeSpec)
|
Test
|
include(groovy.lang.Closure includeSpec)
|
boolean
|
isIgnoreFailures()
{@inheritDoc} |
boolean
|
isScanForTestClasses()
|
boolean
|
isTestReport()
|
Test
|
jvmArgs(java.lang.Iterable arguments)
{@inheritDoc} |
Test
|
jvmArgs(java.lang.Object arguments)
{@inheritDoc} |
TestFrameworkOptions
|
options(groovy.lang.Closure testFrameworkConfigure)
|
void
|
removeTestListener(TestListener listener)
Unregisters a test listener with this task. |
void
|
setAllJvmArgs(java.lang.Iterable arguments)
{@inheritDoc} |
void
|
setBootstrapClasspath(FileCollection classpath)
{@inheritDoc} |
void
|
setClasspath(FileCollection classpath)
|
void
|
setDebug(boolean enabled)
{@inheritDoc} |
void
|
setEnableAssertions(boolean enabled)
{@inheritDoc} |
void
|
setEnvironment(java.util.Map environmentVariables)
{@inheritDoc} |
Test
|
setExcludes(java.lang.Iterable excludes)
Sets the exclude patterns for test execution. |
void
|
setExecutable(java.lang.Object executable)
{@inheritDoc} |
void
|
setForkEvery(java.lang.Long forkEvery)
Sets the maximum number of test classes to execute in a forked test process. |
Test
|
setIgnoreFailures(boolean ignoreFailures)
{@inheritDoc} |
Test
|
setIncludes(java.lang.Iterable includes)
Sets the include patterns for test execution. |
void
|
setJvmArgs(java.lang.Iterable arguments)
{@inheritDoc} |
void
|
setMaxHeapSize(java.lang.String heapSize)
{@inheritDoc} |
void
|
setMaxParallelForks(int maxParallelForks)
Sets the maximum number of forked test processes to execute in parallel. |
void
|
setScanForTestClasses(boolean scanForTestClasses)
|
void
|
setSystemProperties(java.util.Map properties)
{@inheritDoc} |
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 testSrcDir)
|
void
|
setWorkingDir(java.lang.Object dir)
{@inheritDoc} |
Test
|
systemProperties(java.util.Map properties)
{@inheritDoc} |
Test
|
systemProperty(java.lang.String name, java.lang.Object value)
{@inheritDoc} |
TestFramework
|
testFramework(groovy.lang.Closure testFrameworkConfigure)
|
TestFramework
|
useJUnit()
Specifies that JUnit should be used to execute the tests. |
TestFramework
|
useJUnit(groovy.lang.Closure testFrameworkConfigure)
Specifies that JUnit should be used to execute the tests. |
TestFramework
|
useTestNG()
Specifies that TestNG should be used to execute the tests. |
TestFramework
|
useTestNG(groovy.lang.Closure testFrameworkConfigure)
Specifies that TestNG should be used to execute the tests. |
Test
|
workingDir(java.lang.Object dir)
{@inheritDoc} |
Constructor Detail |
---|
public Test()
Method Detail |
---|
public void addTestListener(TestListener listener)
listener
- The listener to add.
public void afterSuite(groovy.lang.Closure closure)
Adds a closure to be notified after a test suite has executed. A TestDescriptor and TestResult instance are passed to the closure as a parameter.
This method is also called after all test suites are executed. The provided descriptor will have a null parent suite.
closure
- The closure to call.
public void afterTest(groovy.lang.Closure closure)
closure
- The closure to call.
public void beforeSuite(groovy.lang.Closure closure)
Adds a closure to be notified before a test suite is executed. A TestDescriptor instance is passed to the closure as a parameter.
This method is also called before any test suites are executed. The provided descriptor will have a null parent suite.
closure
- The closure to call.
public void beforeTest(groovy.lang.Closure closure)
closure
- The closure to call.
public Test bootstrapClasspath(java.lang.Object classpath)
public Test copyTo(ProcessForkOptions target)
public Test copyTo(JavaForkOptions target)
public void disableTestReport()
public void enableTestReport()
public Test environment(java.util.Map environmentVariables)
public Test environment(java.lang.String name, java.lang.Object value)
public Test exclude(java.lang.String excludes)
public Test exclude(java.lang.Iterable excludes)
public Test exclude(Spec excludeSpec)
public Test exclude(groovy.lang.Closure excludeSpec)
public Test executable(java.lang.Object executable)
@TaskAction public void executeTests()
public java.util.List getAllJvmArgs()
public FileCollection getBootstrapClasspath()
@InputFiles @Input // Also marked as input to force tests to run when the set of candidate class files changes public FileTree getCandidateClassFiles()
@InputFiles public FileCollection getClasspath()
public boolean getDebug()
public boolean getEnableAssertions()
public java.util.Map getEnvironment()
public java.util.Set getExcludes()
public java.lang.String getExecutable()
public long getForkEvery()
public java.util.Set getIncludes()
public java.util.List getJvmArgs()
public java.lang.String getMaxHeapSize()
public int getMaxParallelForks()
@Nested public TestFrameworkOptions getOptions()
Returns the test options options.
Be sure to call the appropriate useJUnit or useTestNG method before using this method.
public java.util.Map getSystemProperties()
public java.io.File getTestClassesDir()
public TestFramework getTestFramework()
@OutputDirectory public java.io.File getTestReportDir()
@OutputDirectory public java.io.File getTestResultsDir()
@InputFiles public java.util.List getTestSrcDirs()
public java.io.File getWorkingDir()
public Test include(java.lang.String includes)
public Test include(java.lang.Iterable includes)
public Test include(Spec includeSpec)
public Test include(groovy.lang.Closure includeSpec)
public boolean isIgnoreFailures()
public boolean isScanForTestClasses()
public boolean isTestReport()
public Test jvmArgs(java.lang.Iterable arguments)
public Test jvmArgs(java.lang.Object arguments)
public TestFrameworkOptions options(groovy.lang.Closure testFrameworkConfigure)
public void removeTestListener(TestListener listener)
listener
- The listener to remove.
public void setAllJvmArgs(java.lang.Iterable arguments)
public void setBootstrapClasspath(FileCollection classpath)
public void setClasspath(FileCollection classpath)
public void setDebug(boolean enabled)
public void setEnableAssertions(boolean enabled)
public void setEnvironment(java.util.Map environmentVariables)
public Test setExcludes(java.lang.Iterable excludes)
excludes
- The patterns list
public void setExecutable(java.lang.Object executable)
public void setForkEvery(java.lang.Long forkEvery)
forkEvery
- The maximum number of test classes. Use null or 0 to specify no maximum.
public Test setIgnoreFailures(boolean ignoreFailures)
public Test setIncludes(java.lang.Iterable includes)
includes
- The patterns list
public void setJvmArgs(java.lang.Iterable arguments)
public void setMaxHeapSize(java.lang.String heapSize)
public void setMaxParallelForks(int maxParallelForks)
maxParallelForks
- The maximum number of forked test processes.
public void setScanForTestClasses(boolean scanForTestClasses)
public void setSystemProperties(java.util.Map properties)
public void setTestClassesDir(java.io.File testClassesDir)
testClassesDir
- The root folder
public void setTestReport(boolean testReport)
public void setTestReportDir(java.io.File testReportDir)
testReportDir
- The root folder
public void setTestResultsDir(java.io.File testResultsDir)
testResultsDir
- The root folder
public void setTestSrcDirs(java.util.List testSrcDir)
public void setWorkingDir(java.lang.Object dir)
public Test systemProperties(java.util.Map properties)
public Test systemProperty(java.lang.String name, java.lang.Object value)
public TestFramework testFramework(groovy.lang.Closure testFrameworkConfigure)
public TestFramework useJUnit()
public TestFramework useJUnit(groovy.lang.Closure testFrameworkConfigure)
testFrameworkConfigure
- A closure used to configure the JUint options. This closure is passed an instance
of type JUnitOptions.
public TestFramework useTestNG()
public TestFramework useTestNG(groovy.lang.Closure testFrameworkConfigure)
testFrameworkConfigure
- A closure used to configure the JUint options. This closure is passed an instance
of type JUnitOptions.
public Test workingDir(java.lang.Object dir)
Groovy Documentation