---
title: XCTExpectedFailure
framework: xctest
role: symbol
role_heading: Class
path: xctest/xctexpectedfailure
---

# XCTExpectedFailure

An object that represents an expected test failure.

## Declaration

```swift
class XCTExpectedFailure
```

## Overview

Overview The test system creates and tracks instances of XCTExpectedFailure when you call one of the XCTExpectFailure functions. Don’t create or use them directly.

## Topics

### Detailing Expected Failure

- [failureReason](xctest/xctexpectedfailure/failurereason.md)
- [issue](xctest/xctexpectedfailure/issue.md)

### Setting Options

- [XCTExpectedFailure.Options](xctest/xctexpectedfailure/options.md)

## Relationships

### Inherits From

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

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSCoding](foundation/nscoding.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)
- [NSSecureCoding](foundation/nssecurecoding.md)

## See Also

### Expected Failures

- [XCTExpectedFailure.Options](xctest/xctexpectedfailure/options.md)
- [XCTExpectFailure(_:options:)](xctest/xctexpectfailure(_:options:).md)
- [XCTExpectFailure(_:enabled:strict:issueMatcher:)](xctest/xctexpectfailure(_:enabled:strict:issuematcher:).md)
- [XCTExpectFailure(_:options:failingBlock:)](xctest/xctexpectfailure(_:options:failingblock:).md)
- [XCTExpectFailure(_:enabled:strict:failingBlock:issueMatcher:)](xctest/xctexpectfailure(_:enabled:strict:failingblock:issuematcher:).md)
