Table of Contents
| API Documentation: | XCTest |
|---|
Note: This class is incubating and may change in a future version of Gradle.
Executes XCTest tests. Test are always run in a single execution.
| Property | Description |
binResultsDir | Incubating Replaced The root folder for the test results in internal binary format. |
ignoreFailures | Specifies whether the build should break when the verifications performed by this task fail. |
reports | The reports that this task potentially produces. |
runScriptFile | Incubating Returns test suite bundle or executable location |
testInstallDirectory | Incubating The test suite bundle or executable location |
workingDirectory | Incubating The working directory property for this test. |
| Method | Description |
addTestListener(listener) | Registers a test listener with this task. Consider also the following handy methods for quicker hooking into test execution: |
addTestOutputListener(listener) | Registers a output listener with this task. Quicker way of hooking into output events is using the |
afterSuite(closure) | Adds a closure to be notified after a test suite has executed. A |
afterTest(closure) | Adds a closure to be notified after a test has executed. A |
beforeSuite(closure) | Adds a closure to be notified before a test suite is executed. A |
beforeTest(closure) | Adds a closure to be notified before a test is executed. A |
onOutput(closure) | Adds a closure to be notified when output from the test received. A |
removeTestListener(listener) | Unregisters a test listener with this task. This method will only remove listeners that were added by calling |
removeTestOutputListener(listener) | Unregisters a test output listener with this task. This method will only remove listeners that were added by calling |
reports(configureAction) | Configures the reports that this task potentially produces. |
setTestNameIncludePatterns(testNamePattern) | Incubating Sets the test name patterns to be included in execution.
Classes or method names are supported, wildcard '*' is supported.
For more information see the user guide chapter on testing.
For more information on supported patterns see |
File binResultsDir
Note: This property is incubating and may change in a future version of Gradle.
Note: This property has been replaced by binaryResultsDirectory.
The root folder for the test results in internal binary format.
- Default:
project.testResultsDir/binary/task.name
Specifies whether the build should break when the verifications performed by this task fail.
TestTaskReports reports (read-only)
The reports that this task potentially produces.
RegularFileProperty runScriptFile
Note: This property is incubating and may change in a future version of Gradle.
Returns test suite bundle or executable location
DirectoryProperty testInstallDirectory
Note: This property is incubating and may change in a future version of Gradle.
The test suite bundle or executable location
DirectoryProperty workingDirectory
Note: This property is incubating and may change in a future version of Gradle.
The working directory property for this test.
void addTestListener(TestListener listener)
Registers a test listener with this task. Consider also the following handy methods for quicker hooking into test execution: AbstractTestTask.beforeTest(groovy.lang.Closure), AbstractTestTask.afterTest(groovy.lang.Closure), AbstractTestTask.beforeSuite(groovy.lang.Closure), AbstractTestTask.afterSuite(groovy.lang.Closure)
This listener will NOT be notified of tests executed by other tasks. To
get that behavior, use Gradle.addListener(java.lang.Object).
void addTestOutputListener(TestOutputListener listener)
Registers a output listener with this task. Quicker way of hooking into output events is using the AbstractTestTask.onOutput(groovy.lang.Closure) method.
void afterSuite(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.
void afterTest(Closure closure)
Adds a closure to be notified after a test has executed. A TestDescriptor and TestResult instance are passed to the closure as a parameter.
void beforeSuite(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.
void beforeTest(Closure closure)
Adds a closure to be notified before a test is executed. A TestDescriptor instance is passed to the closure as a parameter.
void onOutput(Closure closure)
Adds a closure to be notified when output from the test received. A TestDescriptor and TestOutputEvent instance are
passed to the closure as a parameter.
apply plugin: 'java' test { onOutput { descriptor, event -> if (event.destination == TestOutputEvent.Destination.StdErr) { logger.error("Test: " + descriptor + ", error: " + event.message) } } }
void removeTestListener(TestListener listener)
Unregisters a test listener with this task. This method will only remove listeners that were added by calling AbstractTestTask.addTestListener(org.gradle.api.tasks.testing.TestListener) on this task. If the listener was
registered with Gradle using Gradle.addListener(java.lang.Object) this method will not do anything. Instead, use Gradle.removeListener(java.lang.Object).
void removeTestOutputListener(TestOutputListener listener)
Unregisters a test output listener with this task. This method will only remove listeners that were added by calling AbstractTestTask.addTestOutputListener(org.gradle.api.tasks.testing.TestOutputListener) on this task. If the
listener was registered with Gradle using Gradle.addListener(java.lang.Object) this method will not do anything. Instead, use Gradle.removeListener(java.lang.Object).
TestTaskReports reports(Action<? super TestTaskReports> configureAction)
Action<? super TestTaskReports>Configures the reports that this task potentially produces.
AbstractTestTask setTestNameIncludePatterns(List<String> testNamePattern)
List<String>Note: This method is incubating and may change in a future version of Gradle.
Sets the test name patterns to be included in execution.
Classes or method names are supported, wildcard '*' is supported.
For more information see the user guide chapter on testing.
For more information on supported patterns see TestFilter