<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.0.0 -",
    "tvOS: 13.0.0 -",
    "watchOS: 6.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "XCTest",
  "identifier" : "/documentation/XCTest/XCTWaiter/fulfillment(of:timeout:enforceOrder:)-swift.type.method",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "XCTest"
    ],
    "preciseIdentifier" : "s:So9XCTWaiterC6XCTestE11fulfillment2of7timeout12enforceOrderSo0A6ResultVSaySo0B11ExpectationCG_SdSbtYaFZ"
  },
  "title" : "fulfillment(of:timeout:enforceOrder:)"
}
-->

# fulfillment(of:timeout:enforceOrder:)

Creates a waiter that waits on group of expectations for up to the specified timeout, optionally enforcing their order of fulfillment.

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

## Parameters

`expectations`

An array of expectations the test must satisfy.

`seconds`

The time, in seconds, the test allows for the fulfillment of the expectations.

`enforceOrderOfFulfillment`

If <doc://com.apple.documentation/documentation/Swift/true>, the test must satisfy the expectations in the order they appear in the array.

## Return Value

A value describing the outcome of waiting for `expectations`.

## Discussion

Use this Concurrency safe alternative to [`wait(for:timeout:enforceOrder:)`](/documentation/XCTest/XCTWaiter/wait(for:timeout:enforceOrder:)-swift.type.method) in your Swift code. A call to [`wait(for:timeout:enforceOrder:)`](/documentation/XCTest/XCTWaiter/wait(for:timeout:enforceOrder:)-swift.type.method) runs synchronously and blocks the calling thread, which can cause deadlocks or priority inversion.

Expectations can only appear in the array once. The call may return before the timeout if the test fulfills all the expectations you provide.

> Note:
> If you don’t specify a timeout when calling this function, enable test timeouts to prevent unfulfilled expectation from hanging the test.

The test discards the waiter after the wait completes.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)