Table of Contents
API Documentation: | TestReport |
---|
Generates an HTML test report from the results of one or moreTest
tasks.
Property | Description |
actions | The sequence of |
ant | The |
convention | The |
dependsOn | The dependencies of this task. |
description | The description of this task. |
destinationDir | The directory to write the HTML report to. |
destroyables | The destroyables of this task. |
didWork | Checks if the task actually did any work. Even if a Task executes, it may determine that it has nothing todo. For example, a compilation task may determine that source files have not changed since the last time a thetask was run. |
enabled | Returns if this task is enabled or not. |
extensions | The container of extensions. |
finalizedBy | Returns tasks that finalize this task. |
group | The task group which this task belongs to. The task group is used in reports and user interfaces togroup related tasks together when presenting a list of tasks to the user. |
inputs | The inputs of this task. |
localState | The local state of this task. |
logger | The logger for this task. You can use this in your build file to write log messages. |
logging | The |
mustRunAfter | Returns tasks that this task must run after. |
name | The name of this task. The name uniquely identifies the task within its |
outputs | The outputs of this task. |
path | The path of the task, which is a fully qualified name for the task. The path of a task is the path ofits |
project | The |
state | The execution state of this task. This provides information about the execution of this task, such aswhether it has executed, been skipped, has failed, etc. |
taskDependencies | Returns a |
temporaryDir | Returns a directory which this task can use to write temporary files to. Each task instance is provided with aseparate temporary directory. There are no guarantees that the contents of this directory will be kept beyond theexecution of the task. |
testResultDirs | The set of binary test results to include in the report. |
timeout | Incubating The timeout of this task. |
Method | Description |
dependsOn(paths) | Adds the given dependencies to this task. Seehere for a description of the typesof objects which can be used as task dependencies. |
doFirst(action) | Adds the given closure to the beginning of this task's action list. The closure is passed this task as aparameter when executed. |
doFirst(actionName, action) | Adds the given |
doFirst(action) | Adds the given |
doLast(action) | Adds the given closure to the end of this task's action list. The closure is passed this task as a parameterwhen executed. |
doLast(actionName, action) | Adds the given |
doLast(action) | Adds the given |
finalizedBy(paths) | Adds the given finalizer tasks for this task. |
hasProperty(propertyName) | Determines if this task has the given property. Seehere for details of theproperties which are available for a task. |
mustRunAfter(paths) | Specifies that this task must run after all of the supplied tasks. |
onlyIf(onlyIfClosure) | Execute the task only if the given closure returns true. The closure will be evaluated at task executiontime, not during configuration. The closure will be passed a single parameter, this task. If the closure returnsfalse, the task will be skipped. |
onlyIf(onlyIfSpec) | Execute the task only if the given spec is satisfied. The spec will be evaluated at task execution time, notduring configuration. If the Spec is not satisfied, the task will be skipped. |
property(propertyName) | Returns the value of the given property of this task. This method locates a property as follows: |
reportOn(results) | Adds some results to include in the report. |
setProperty(name, value) | Sets a property of this task. This method searches for a property with the given name in the followinglocations, and sets the property on the first location where it finds the property. |
The sequence ofAction
objects which will be executed by this task, in the order ofexecution.
AntBuilder
ant
(read-only)
TheAntBuilder
for this task. You can use this in your build file to execute anttasks.
Convention
convention
(read-only)
TheConvention
object for this task. APlugin
can use the convention object tocontribute properties and methods to this task.
String
description
The description of this task.
File
destinationDir
The directory to write the HTML report to.
TaskDestroyables
destroyables
(read-only)
The destroyables of this task.
Checks if the task actually did any work. Even if a Task executes, it may determine that it has nothing todo. For example, a compilation task may determine that source files have not changed since the last time a thetask was run.
ExtensionContainer
extensions
(read-only)
The container of extensions.
TaskDependency
finalizedBy
Returns tasks that finalize this task.
String
group
The task group which this task belongs to. The task group is used in reports and user interfaces togroup related tasks together when presenting a list of tasks to the user.
TaskInputs
inputs
(read-only)
The inputs of this task.
TaskLocalState
localState
(read-only)
The local state of this task.
Logger
logger
(read-only)
The logger for this task. You can use this in your build file to write log messages.
LoggingManager
logging
(read-only)
TheLoggingManager
which can be used to receive logging and to control thestandard output/error capture for this task. By default, System.out is redirected to the Gradle logging system atthe QUIET log level, and System.err is redirected at the ERROR log level.
TaskDependency
mustRunAfter
Returns tasks that this task must run after.
String
name
(read-only)
The name of this task. The name uniquely identifies the task within itsProject
.
TaskOutputs
outputs
(read-only)
The outputs of this task.
String
path
(read-only)
The path of the task, which is a fully qualified name for the task. The path of a task is the path ofitsProject
plus the name of the task, separated by:
.
TaskState
state
(read-only)
The execution state of this task. This provides information about the execution of this task, such aswhether it has executed, been skipped, has failed, etc.
TaskDependency
taskDependencies
(read-only)
Returns aTaskDependency
which contains all the tasks that this task depends on.
File
temporaryDir
(read-only)
Returns a directory which this task can use to write temporary files to. Each task instance is provided with aseparate temporary directory. There are no guarantees that the contents of this directory will be kept beyond theexecution of the task.
FileCollection
testResultDirs
The set of binary test results to include in the report.
Note: This property isincubating and may change in a future version of Gradle.
The timeout of this task.
task myTask { timeout = Duration.ofMinutes(10)}
The Thread executing this task will be interrupted if the task takes longer than the specified amount of time to run.In order for a task to work properly with this feature, it needs to react to interrupts and must clean up any resources it opened.
By default, tasks never time out.
Adds the given dependencies to this task. Seehere for a description of the typesof objects which can be used as task dependencies.
Adds the given closure to the beginning of this task's action list. The closure is passed this task as aparameter when executed.
Adds the givenAction
to the beginning of this task's action list.
Adds the givenAction
to the beginning of this task's action list.
Adds the given closure to the end of this task's action list. The closure is passed this task as a parameterwhen executed.
Adds the givenAction
to the end of this task's action list.
Adds the given finalizer tasks for this task.
task taskY { finalizedBy"taskX"}
Seehere for a description of the types of objects which can be used to specifya finalizer task.
boolean
hasProperty
(String
propertyName)
Determines if this task has the given property. Seehere for details of theproperties which are available for a task.
Specifies that this task must run after all of the supplied tasks.
task taskY { mustRunAfter"taskX"}
For each supplied task, this action adds a task 'ordering', and does not specify a 'dependency' between the tasks.As such, it is still possible to execute 'taskY' without first executing the 'taskX' in the example.
Seehere for a description of the types of objects which can be used to specifyan ordering relationship.
void
onlyIf
(Closure
onlyIfClosure)
Execute the task only if the given closure returns true. The closure will be evaluated at task executiontime, not during configuration. The closure will be passed a single parameter, this task. If the closure returnsfalse, the task will be skipped.
You may add multiple such predicates. The task is skipped if any of the predicates return false.
Typical usage:myTask.onlyIf { isProductionEnvironment() }
Execute the task only if the given spec is satisfied. The spec will be evaluated at task execution time, notduring configuration. If the Spec is not satisfied, the task will be skipped.
You may add multiple such predicates. The task is skipped if any of the predicates return false.
Typical usage (from Java):
myTask.onlyIf(new Spec<Task>() {boolean isSatisfiedBy(Task task) {return isProductionEnvironment(); }});
Returns the value of the given property of this task. This method locates a property as follows:
- If this task object has a property with the given name, return the value of the property.
- If this task has an extension with the given name, return the extension.
- If this task's convention object has a property with the given name, return the value of the property.
- If this task has an extra property with the given name, return the value of the property.
- If not found, throw
MissingPropertyException
void
reportOn
(Object
...
results)
Object
...Adds some results to include in the report.
This method accepts any parameter of the given types:
- A
Test
task instance. The results from the test task are included in the report. The test task is automatically addedas a dependency of this task. - Anything that can be converted to a set of
File
instances as perProject.files(java.lang.Object[])
. These mustpoint to the binary test results directory generated by aTest
task instance. - An
Iterable
. The contents of the iterable are converted recursively.
Sets a property of this task. This method searches for a property with the given name in the followinglocations, and sets the property on the first location where it finds the property.
- The task object itself. For example, the
enabled
project property. - The task's convention object.
- The task's extra properties.
If the property is not found, aMissingPropertyException
is thrown.