api / org.gradle.nativeplatform.test.xctest.tasks / XCTest

XCTest

@Incubating open class XCTest : AbstractTestTask

Executes XCTest tests. Test are always run in a single execution.

Since
4.5

Constructors

<init>

XCTest()

Executes XCTest tests. Test are always run in a single execution.

Functions

getRunScriptFile

open fun getRunScriptFile(): RegularFileProperty

Returns test suite bundle or executable location

getTestInstallDirectory

open fun getTestInstallDirectory(): DirectoryProperty

Sets the test suite bundle or executable location

getWorkingDirectory

open fun getWorkingDirectory(): DirectoryProperty

Returns the working directory property for this test.

setTestNameIncludePatterns

open fun setTestNameIncludePatterns(testNamePattern: MutableList<String>): XCTest

{@inheritDoc}

Inherited Functions

addTestListener

open fun addTestListener(listener: TestListener): Unit

Registers a test listener with this task. Consider also the following handy methods for quicker hooking into test execution: #beforeTest(groovy.lang.Closure), , #beforeSuite(groovy.lang.Closure), #afterSuite(groovy.lang.Closure)

This listener will NOT be notified of tests executed by other tasks. To get that behavior, use org.gradle.api.invocation.Gradle#addListener(Object).

addTestOutputListener

open fun addTestOutputListener(listener: TestOutputListener): Unit

Registers a output listener with this task. Quicker way of hooking into output events is using the #onOutput(groovy.lang.Closure) method.

afterSuite

open fun afterSuite(closure: Closure<Any>): Unit

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.

afterTest

open fun afterTest(closure: Closure<Any>): Unit

Adds a closure to be notified after a test has executed. A TestDescriptor and TestResult instance are passed to the closure as a parameter.

beforeSuite

open fun beforeSuite(closure: Closure<Any>): Unit

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.

beforeTest

open fun beforeTest(closure: Closure<Any>): Unit

Adds a closure to be notified before a test is executed. A TestDescriptor instance is passed to the closure as a parameter.

executeTests

open fun executeTests(): Unit

getBinResultsDir

open fun getBinResultsDir(): File

Returns the root folder for the test results in internal binary format.

getBinaryResultsDirectory

open fun getBinaryResultsDirectory(): DirectoryProperty

Returns the root directory property for the test results in internal binary format.

getFilter

open fun getFilter(): TestFilter

Allows filtering tests for execution.

getIgnoreFailures

open fun getIgnoreFailures(): Boolean

{@inheritDoc}

getReports

open fun getReports(): TestTaskReports

The reports that this task potentially produces.

getTestLogging

open fun getTestLogging(): TestLoggingContainer

Allows to set options related to which test events are logged to the console, and on which detail level. For example, to show more information about exceptions use:

 apply plugin: 'java' test.testLogging { exceptionFormat "full" } 
For further information see TestLoggingContainer.

onOutput

open fun onOutput(closure: Closure<Any>): Unit

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) } } } 

removeTestListener

open fun removeTestListener(listener: TestListener): Unit

Unregisters a test listener with this task. This method will only remove listeners that were added by calling #addTestListener(TestListener) on this task. If the listener was registered with Gradle using org.gradle.api.invocation.Gradle#addListener(Object) this method will not do anything. Instead, use .

removeTestOutputListener

open fun removeTestOutputListener(listener: TestOutputListener): Unit

Unregisters a test output listener with this task. This method will only remove listeners that were added by calling #addTestOutputListener(TestOutputListener) on this task. If the listener was registered with Gradle using org.gradle.api.invocation.Gradle#addListener(Object) this method will not do anything. Instead, use .

reports

open fun reports(closure: Closure<Any>): TestTaskReports
open fun reports(configureAction: Action<in TestTaskReports>): TestTaskReports

Configures the reports that this task potentially produces.

setBinResultsDir

open fun setBinResultsDir(binResultsDir: File): Unit

Sets the root folder for the test results in internal binary format.

setIgnoreFailures

open fun setIgnoreFailures(ignoreFailures: Boolean): Unit

{@inheritDoc}

testLogging

open fun testLogging(closure: Closure<Any>): Unit
open fun testLogging(action: Action<in TestLoggingContainer>): Unit

Allows configuring the logging of the test execution, for example log eagerly the standard output, etc.

 apply plugin: 'java' // makes the standard streams (err and out) visible at console when running tests test.testLogging { showStandardStreams = true }