<!--
{
  "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/XCTestCase/fulfillment(of:timeout:enforceOrder:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "XCTest"
    ],
    "preciseIdentifier" : "s:So10XCTestCaseC0A0E11fulfillment2of7timeout12enforceOrderySaySo0A11ExpectationCG_SdSbtYaF"
  },
  "title" : "fulfillment(of:timeout:enforceOrder:)"
}
-->

# fulfillment(of:timeout:enforceOrder:)

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

```
@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 <doc://com.apple.documentation/documentation/Swift/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:)`](/documentation/XCTest/XCTestCase/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.

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

---

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)