---
title: XCTestExpectation
framework: xctest
role: symbol
role_heading: Class
path: xctest/xctestexpectation
---

# XCTestExpectation

An expected outcome in an asynchronous test.

## Declaration

```swift
class XCTestExpectation
```

## Topics

### Creating Expectations

- [init(description:)](xctest/xctestexpectation/init(description:).md)
- [expectationDescription](xctest/xctestexpectation/expectationdescription.md)

### Fulfilling Expectations

- [fulfill()](xctest/xctestexpectation/fulfill().md)

### Fulfillment Count

- [expectedFulfillmentCount](xctest/xctestexpectation/expectedfulfillmentcount.md)
- [assertForOverFulfill](xctest/xctestexpectation/assertforoverfulfill.md)

### Unintended Expectations

- [isInverted](xctest/xctestexpectation/isinverted.md)

## Relationships

### Inherits From

- [NSObject](objectivec/nsobject-swift.class.md)

### Inherited By

- [XCTDarwinNotificationExpectation](xctest/xctdarwinnotificationexpectation.md)
- [XCTKVOExpectation](xctest/xctkvoexpectation.md)
- [XCTKeyPathExpectation](xctest/xctkeypathexpectation.md)
- [XCTNSNotificationExpectation](xctest/xctnsnotificationexpectation.md)
- [XCTNSPredicateExpectation](xctest/xctnspredicateexpectation.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)
- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)
