---
title: "fulfillment(of:timeout:enforceOrder:)"
framework: xctest
role: symbol
role_heading: Type Method
path: "xctest/xctwaiter/fulfillment(of:timeout:enforceorder:)-swift.type.method"
---

# 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.

## Declaration

```swift
@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

Return Value A value describing the outcome of waiting for expectations.

## Discussion

Discussion Use this Concurrency safe alternative to wait(for:timeout:enforceOrder:) in your Swift code. A call to wait(for:timeout:enforceOrder:) 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.

## See Also

### Waiting for Expectations

- [fulfillment(of:timeout:enforceOrder:)](xctest/xctwaiter/fulfillment(of:timeout:enforceorder:)-swift.method.md)
- [wait(for:)](xctest/xctwaiter/wait(for:)-swift.method.md)
- [wait(for:enforceOrder:)](xctest/xctwaiter/wait(for:enforceorder:)-swift.method.md)
- [wait(for:timeout:)](xctest/xctwaiter/wait(for:timeout:)-swift.method.md)
- [wait(for:timeout:enforceOrder:)](xctest/xctwaiter/wait(for:timeout:enforceorder:)-swift.method.md)
- [wait(for:)](xctest/xctwaiter/wait(for:)-swift.type.method.md)
- [wait(for:enforceOrder:)](xctest/xctwaiter/wait(for:enforceorder:)-swift.type.method.md)
- [wait(for:timeout:)](xctest/xctwaiter/wait(for:timeout:)-swift.type.method.md)
- [wait(for:timeout:enforceOrder:)](xctest/xctwaiter/wait(for:timeout:enforceorder:)-swift.type.method.md)
- [XCTWaiter.Result](xctest/xctwaiter/result.md)
