Contents

fulfillment(of:timeout:enforceOrder:)

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

Declaration

@nonobjc func fulfillment(of expectations: [XCTestExpectation], timeout seconds: TimeInterval = .infinity, enforceOrder enforceOrderOfFulfillment: Bool = false) async

Parameters

  • expectations:

    An array of expectations the test must satisfy.

  • seconds:

    The time, in seconds, the test allows for the fulfillment of the expectations. The default timeout allows the test to run until it reaches its execution time allowance.

  • enforceOrderOfFulfillment:

    If True, the test must satisfy the expectations in the order they appear in the array.

Discussion

Use this concurrency-safe alternative to wait(for:timeout:enforceOrder:) in your Swift code. Expectations can only appear in the array once. The method can return before the timeout if the test fulfills all the expectations you provide.

See Also

Waiting for Expectations