<!--
{
  "availability" : [
    "*: -"
  ],
  "documentType" : "symbol",
  "framework" : "XCTest",
  "identifier" : "/documentation/XCTest/XCTestObserver",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "XCTest"
    ],
    "preciseIdentifier" : "c:objc(cs)XCTestObserver"
  },
  "title" : "XCTestObserver"
}
-->

# XCTestObserver

An object that observes test activity and events.

```
class XCTestObserver
```

## Topics

### Starting and Stopping Test Observation

[`startObserving()`](/documentation/XCTest/XCTestObserver/startObserving())

Starts observing a test.

[`stopObserving()`](/documentation/XCTest/XCTestObserver/stopObserving())

Stops observing a test.

### Monitoring Test Activity

[`testCaseDidFail(_:withDescription:inFile:atLine:)`](/documentation/XCTest/XCTestObserver/testCaseDidFail(_:withDescription:inFile:atLine:))

Notifies the observer when a test case fails.

[`testCaseDidStart(_:)`](/documentation/XCTest/XCTestObserver/testCaseDidStart(_:))

Notifies the observer when a test case starts.

[`testCaseDidStop(_:)`](/documentation/XCTest/XCTestObserver/testCaseDidStop(_:))

Notifies the observer when a test case stops.

[`testSuiteDidStart(_:)`](/documentation/XCTest/XCTestObserver/testSuiteDidStart(_:))

Notifies the observer when a test suite starts.

[`testSuiteDidStop(_:)`](/documentation/XCTest/XCTestObserver/testSuiteDidStop(_:))

Notifies the observer when a test suite stops.



---

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)