Asynchronous Tests and Expectations

Perform long-running or background tasks and wait for them to satisfy expected conditions.

Topics

First Steps

Testing Asynchronous Operations with Expectations

Verify that asynchronous operations behave as expected.

class XCTestExpectation

An expected outcome in an asynchronous test.

Key Value Observing Expectations

class XCTKVOExpectation

An expectation that is fulfilled when a Key Value Observing (KVO) condition is met.

Notification-Based Expectations

class XCTNSNotificationExpectation

An expectation that is fulfilled when an expected NSNotification is received.

class XCTDarwinNotificationExpectation

An expectation that is fulfilled when an expected Darwin notification is received.

Predicate-Based Expectations

class XCTNSPredicateExpectation

An expectation that is fulfilled when an NSPredicate is satisfied.

Waiting for Expectations

class XCTWaiter

Waits for a group of expectations to be fulfilled.