---
title: XCTestError
framework: xctest
role: symbol
role_heading: Structure
path: xctest/xctesterror
---

# XCTestError

A type of error that can occur while the test waits to fulfill expectations.

## Declaration

```swift
struct XCTestError
```

## Topics

### Classifying Errors with Codes

- [timeoutWhileWaiting](xctest/xctesterror/timeoutwhilewaiting.md)
- [failureWhileWaiting](xctest/xctesterror/failurewhilewaiting.md)
- [XCTestError.Code](xctest/xctesterror/code.md)

### Classifying Errors by Domain

- [XCTestErrorDomain](xctest/xctesterrordomain.md)

### Type Properties

- [errorDomain](xctest/xctesterror/errordomain.md)

## Relationships

### Conforms To

- [CustomNSError](foundation/customnserror.md)
- [Equatable](swift/equatable.md)
- [Error](swift/error.md)
- [Hashable](swift/hashable.md)
- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)

## See Also

### Waiting for Expectations

- [fulfillment(of:timeout:enforceOrder:)](xctest/xctestcase/fulfillment(of:timeout:enforceorder:).md)
- [wait(for:)](xctest/xctestcase/wait(for:).md)
- [wait(for:enforceOrder:)](xctest/xctestcase/wait(for:enforceorder:).md)
- [wait(for:timeout:)](xctest/xctestcase/wait(for:timeout:).md)
- [wait(for:timeout:enforceOrder:)](xctest/xctestcase/wait(for:timeout:enforceorder:).md)
- [waitForExpectations(timeout:handler:)](xctest/xctestcase/waitforexpectations(timeout:handler:).md)
- [XCWaitCompletionHandler](xctest/xcwaitcompletionhandler.md)
- [XCTestError.Code](xctest/xctesterror/code.md)
- [XCTestErrorDomain](xctest/xctesterrordomain.md)
