<!--
{
  "documentType" : "article",
  "framework" : "XCTest",
  "identifier" : "/documentation/XCTest/test-execution-and-observation",
  "metadataVersion" : "0.1.0",
  "role" : "collectionGroup",
  "title" : "Test Execution and Observation"
}
-->

# Test Execution and Observation

Observe, introspect, and customize the test execution flow.

## Topics

### Test Failures

Capture test failures with `XCTIssue` and related classes that associate source code locations and call stacks with failures.

[`struct XCTIssue`](/documentation/XCTest/XCTIssue-swift.struct)

An object that represents a test failure, and includes source code call stacks for test reporting and investigation.

[`class XCTIssueReference`](/documentation/XCTest/XCTIssueReference)

An object that represents a test failure, and includes source code call stacks for test reporting and investigation.

[`class XCTMutableIssue`](/documentation/XCTest/XCTMutableIssue)

A mutable object that represents a test failure, and includes source code call stacks for test reporting and investigation.

[`class XCTSourceCodeContext`](/documentation/XCTest/XCTSourceCodeContext)

An object that contains call stack and source code location details to provide context for a point of execution in a test.

[`class XCTSourceCodeFrame`](/documentation/XCTest/XCTSourceCodeFrame)

An object that represents a single frame in a call stack that supports retrieval of symbol information for the address.

[`class XCTSourceCodeLocation`](/documentation/XCTest/XCTSourceCodeLocation)

An object that contains a file URL and line number that represents a distinct location in source code.

[`class XCTSourceCodeSymbolInfo`](/documentation/XCTest/XCTSourceCodeSymbolInfo)

An object that contains symbolication information for a specified frame in a call stack.

### Test Runs

[`class XCTestCaseRun`](/documentation/XCTest/XCTestCaseRun)

An object that collects information about a specific execution of a test case.

[`class XCTestSuiteRun`](/documentation/XCTest/XCTestSuiteRun)

An object that collects information about a specific execution of a test suite.

[`class XCTestRun`](/documentation/XCTest/XCTestRun)

A base class for collecting information about a specific execution of a test.

### Test Observation

[`protocol XCTestObservation`](/documentation/XCTest/XCTestObservation)

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

[`class XCTestObservationCenter`](/documentation/XCTest/XCTestObservationCenter)

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

### Test Suites

[`class XCTestSuite`](/documentation/XCTest/XCTestSuite)

A collection of test cases to manage as a test suite.



---

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)