Contents

expectation(description:)

Creates a new expectation with an associated description.

Declaration

func expectation(description: String) -> XCTestExpectation

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 expectation(description:), call the expectation’s fulfill() method when the asynchronous task in your test has completed.

See Also

Creating Asynchronous Test Expectations