<!--
{
  "availability" : [

  ],
  "documentType" : "symbol",
  "framework" : "XCTest",
  "identifier" : "/documentation/XCTest/XCTestError",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "XCTest"
    ],
    "preciseIdentifier" : "s:SC15XCTestErrorCodeLeV"
  },
  "title" : "XCTestError"
}
-->

# XCTestError

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

```
struct XCTestError
```

## Topics

### Getting Error Information

### Classifying Errors with Codes

[`static var timeoutWhileWaiting: XCTestError.Code`](/documentation/XCTest/XCTestError/timeoutWhileWaiting)

A code that represents a timeout the test encountered while waiting to fulfill expectations.

[`static var failureWhileWaiting: XCTestError.Code`](/documentation/XCTest/XCTestError/failureWhileWaiting)

A code that represents a test failure the test encountered while waiting to fulfill expectations.

[`enum Code`](/documentation/XCTest/XCTestError/Code)

Error codes for errors that can occur while the test is waiting to fulfill expectations.

### Classifying Errors by Domain

[`let XCTestErrorDomain: String`](/documentation/XCTest/XCTestErrorDomain)

The error domain for errors that can occur while the test is waiting to fulfill expectations.

### Comparing Errors

### Type Properties

[`static var errorDomain: String`](/documentation/XCTest/XCTestError/errorDomain)

The error domain for errors that can occur while the test is waiting to fulfill expectations.

## Relationships

### Conforms To

[`Equatable`](/documentation/Swift/Equatable)

[`CustomNSError`](/documentation/Foundation/CustomNSError)

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`Error`](/documentation/Swift/Error)

[`Sendable`](/documentation/Swift/Sendable)

[`Hashable`](/documentation/Swift/Hashable)

---

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)