Contents

XCTestObservationCenter

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

Declaration

class XCTestObservationCenter

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.

Topics

Accessing the Shared Observation Center

Managing Observers

See Also

Test Observation