Class

XCTWaiter

Waits for a group of expectations to be fulfilled.

Declaration

@interface XCTWaiter : NSObject

Overview

Waiters can be used with or without a delegate to respond to events such as completion, timeout, or invalid expectation fulfillment. XCTestCase automatically conforms to the XCTWaiterDelegate protocol and will automatically report timeouts and other unexpected events as test failures.

Waiters can be used without a delegate or any association with a test case instance. This allows test support libraries to provide convenience methods for waiting without having to pass test cases through those APIs.

Topics

Creating a Waiter

- initWithDelegate:

Creates a new waiter with the specified delegate.

Waiting for Expectations

- waitForExpectations:timeout:

Waits on a group of expectations for up to the specified timeout.

- waitForExpectations:timeout:enforceOrder:

Waits on a group of expectations for up to the specified timeout, optionally enforcing their order of fulfillment.

+ waitForExpectations:timeout:

Creates a waiter that waits on a group of expectations for up to the specified timeout.

+ waitForExpectations:timeout:enforceOrder:

Creates a waiter that waits on a group of expectations for up to the specified timeout, optionally enforcing their order of fulfillment.

XCTWaiterResult

Result states returned by a waiter when it completes, times out, fails, or is interrupted.

Responding to Expectation Fulfilment

delegate

The delegate to which expectation fulfillment events will be reported.

XCTWaiterDelegate

Defines methods that are called when XCTWaiter expectations are fulfilled correctly or incorrectly.

fulfilledExpectations

An array of expectations that were fulfilled, in order, up until the waiter stopped waiting.

Relationships

Inherits From