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.

XCTestExpectation

An expected outcome in an asynchronous test.

Key Value Observing Expectations

XCTKVOExpectation

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

Notification-Based Expectations

XCTNSNotificationExpectation

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

XCTDarwinNotificationExpectation

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

Predicate-Based Expectations

XCTNSPredicateExpectation

An expectation that is fulfilled when an NSPredicate is satisfied.

Waiting for Expectations

XCTWaiter

Waits for a group of expectations to be fulfilled.