---
title: XCTestObservationCenter
framework: xctest
role: symbol
role_heading: Class
path: xctest/xctestobservationcenter
---

# XCTestObservationCenter

Provides information about the progress of test runs to registered observers.

## Declaration

```swift
class XCTestObservationCenter
```

## Overview

Overview Observers can be any object that conforms to the XCTestObservation protocol. Register new observers with the addTestObserver(_:) method and remove them with the removeTestObserver(_:) method. If an NSPrincipalClass key is declared in the test bundle’s Info.plist file, XCTest automatically creates a single instance of that class when the test bundle is loaded. You can use this instance as a place to register observers or do other pretesting global setup before testing for that bundle begins. important: Observers must be registered manually. The NSPrincipalClass instance is not automatically registered as an observer even if the class conforms to XCTestObservation.

## Topics

### Accessing the Shared Observation Center

- [shared](xctest/xctestobservationcenter/shared.md)

### Managing Observers

- [addTestObserver(_:)](xctest/xctestobservationcenter/addtestobserver(_:).md)
- [removeTestObserver(_:)](xctest/xctestobservationcenter/removetestobserver(_:).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)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)

## See Also

### Test Observation

- [XCTestObservation](xctest/xctestobservation.md)
