Instance Method

expectationWithDescription:

Creates a new expectation with an associated description.

Declaration

- (XCTestExpectation *)expectationWithDescription:(NSString *)description;

Parameters

description

A string to display in the test log for this expectation, to help diagnose failures.

Discussion

Use this method to create XCTestExpectation instances that can be fulfilled when asynchronous tasks in your tests complete.

To fulfill an expectation that was created with expectationWithDescription:, call the expectation's fulfill method when the asynchronous task in your test has completed.

See Also

Creating Asynchronous Test Expectations

- expectationForPredicate:evaluatedWithObject:handler:

Creates an expectation that is fulfilled if the predicate returns YES when evaluated with the given object.

- expectationForNotification:object:handler:

Creates an expectation that is fulfilled when a specific NSNotification is received for a given object.

- keyValueObservingExpectationForObject:keyPath:expectedValue:

Creates an expectation that uses Key Value Observing to observe a value until it matches an expected value.

- keyValueObservingExpectationForObject:keyPath:handler:

Creates an expectation that uses Key Value Observing to observe a value and respond to changes in that value by calling a provided handler.