Contents

XCTestObservation

A protocol that defines methods the test runner calls in response to significant events during test runs.

Declaration

protocol XCTestObservation : NSObjectProtocol

Overview

The system calls the notification methods for XCTestObservation in the following sequence for a test bundle:

  1. testBundleWillStart(_:) — exactly once per test bundle

  2. testSuiteWillStart(_:) — exactly once per test suite

  3. testCaseWillStart(_:) — exactly once per test case

  4. testCase(_:didRecord:) — for each test failure, zero or more times per test case at any point between test case start and finish

  5. testCase(_:didRecord:) — for each expected test failure, zero or more times per test case at any point between test case start and finish

  6. testCaseDidFinish(_:) — exactly once per test case

  7. testSuite(_:didRecord:) — for each test failure, zero or more times per test suite at any point between test suite start and finish

  8. testSuite(_:didRecord:) — for each expected test failure, zero or more times per test suite at any point between test suite start and finish

  9. testSuiteDidFinish(_:) — exactly once per test suite

  10. testBundleDidFinish(_:) — exactly once per test bundle

See XCTestObservationCenter for details about registering and removing test observers.

Topics

Observation Methods

See Also

Test Observation