<!--
{
  "availability" : [

  ],
  "documentType" : "symbol",
  "framework" : "XCTest",
  "identifier" : "/documentation/XCTest/XCTestRun",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "XCTest"
    ],
    "preciseIdentifier" : "c:objc(cs)XCTestRun"
  },
  "title" : "XCTestRun"
}
-->

# XCTestRun

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

```
class XCTestRun
```

## Overview

`XCTestRun` classifies failures in explicit test assertions as *expected*, and failures from unrelated or uncaught exceptions as *unexpected*.

## Topics

### Creating Test Runs

[`-  initWithTest:`](/documentation/XCTest/XCTestRun/init(test:))

Creates a new test run for the provided test.

[`+  testRunWithTest:`](/documentation/XCTest/XCTestRun/testRunWithTest:)

Creates a new [`XCTestRun`](/documentation/XCTest/XCTestRun) for the provided test.

### Performing Test Runs

[`-  start`](/documentation/XCTest/XCTestRun/start())

Starts a test run.

[`-  stop`](/documentation/XCTest/XCTestRun/stop())

Stops a test run.

[`-  recordIssue:`](/documentation/XCTest/XCTestRun/record(_:))

Records an issue during test execution for the test run.

### Tracking Test Durations

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

The date and time when the test run started, or no value if the test hasn’t run.

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

The date and time when the test run stopped, or no value if the test hasn’t run.

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

The number of seconds that elapse between when the run starts and when it stops.

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

The number of seconds that elapse between when the run starts and when it stops.

### Gathering Test Outcomes

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

A Boolean value that returns true if all tests in the run completed without recording any failures; otherwise, false.

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

A Boolean value that indicates a skipped test.

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

The number of test executions during the run.

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

The number of test failures during the run.

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

The number of skipped tests during the run.

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

The test instance for the test run.

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

The number of tests in the run.

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

The number of test failures and uncaught exceptions during the run.

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

The number of uncaught exceptions during the run.

### Deprecated

[`-  recordFailureWithDescription:inFile:atLine:expected:`](/documentation/XCTest/XCTestRun/recordFailure(withDescription:inFile:atLine:expected:))

Records a failure during test execution for the test run.

## Relationships

### Inherited By

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

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

### Conforms To

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`CVarArg`](/documentation/Swift/CVarArg)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`Hashable`](/documentation/Swift/Hashable)

[`Equatable`](/documentation/Swift/Equatable)

### Inherits From

[`NSObject-swift.class`](/documentation/ObjectiveC/NSObject-swift.class)

---

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)