---
title: XCTContext
framework: xctest
role: symbol
role_heading: Class
path: xctest/xctcontext
---

# XCTContext

A proxy for the current testing context.

## Declaration

```swift
class XCTContext
```

## Mentioned in

Adding Attachments to Tests, Activities, and Issues Grouping Tests into Substeps with Activities

## Overview

Overview XCTContext provides a way for activities (XCTActivity) to run against the current testing context, either directly in a test case or in custom testing utilities. You can break up long test methods in UI tests or integration tests into activities to reuse, and to simplify results in the Xcode test reports. Use runActivity(named:block:) to run a block of code as a named substep in a test. For more information, see Grouping Tests into Substeps with Activities.

## Topics

### Running Activities

- [runActivity(named:block:)](xctest/xctcontext/runactivity(named:block:).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

### Activities

- [Grouping Tests into Substeps with Activities](xctest/grouping-tests-into-substeps-with-activities.md)
- [XCTActivity](xctest/xctactivity.md)
