Protocol

XCTestObservation

The XCTestObservation protocol defines methods that are called in response to significant events in the progress of test runs.

Declaration

@protocol XCTestObservation

Overview

See XCTestObservationCenter for details on registering and removing test observers.

The notification methods for XCTestObservation are called in the following sequence for a test bundle:

  1. testBundleWillStart: is called exactly once per test bundle

  2. testSuiteWillStart: is called exactly once per test suite

  3. testCaseWillStart: is called exactly once per test case

  4. testCase:didFailWithDescription:inFile:atLine: is called zero or more times per test case, at any point between test case start and finish

  5. testCaseDidFinish: is called exactly once per test case

  6. testSuite:didFailWithDescription:inFile:atLine: is called zero or more times per test suite, at any point between test suite start and finish

  7. testSuiteDidFinish: is called exactly once per test suite

  8. testBundleDidFinish: is called exactly once per test bundle

Topics

Observation Methods

- testBundleWillStart:

Called immediately before any tests in a test bundle begin.

- testSuiteWillStart:

Called immediately before a test suite starts executing.

- testCaseWillStart:

Called immediately before a test case starts executing.

- testCase:didFailWithDescription:inFile:atLine:

Called when a test case reports a failure.

- testCaseDidFinish:

Called immediately after a test case finishes executing.

- testSuite:didFailWithDescription:inFile:atLine:

Called when a test suite reports a failure.

- testSuiteDidFinish:

Called immediately after a test suite finishes executing.

- testBundleDidFinish:

Called immediately after all tests in a test bundle have finished executing.

Relationships

Inherits From

See Also

Test Observation

XCTestObservationCenter

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