Class

XCTestRun

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

Declaration

class XCTestRun : NSObject

Overview

Failures in explicit test assertions are classified as "expected", while failures from unrelated or uncaught exceptions are classified as "unexpected".

Topics

Creating Test Runs

init(test: XCTest)

Creates a new XCTestRun for the provided test.

Performing Test Runs

func start()

Starts a test run.

func stop()

Stops a test run.

func recordFailure(withDescription: String, inFile: String?, atLine: Int, expected: Bool)

Records a failure in the execution of the test for this test run.

Test Duration

var startDate: Date?

The time at which the test run was started, or nil if the test has not yet run.

var stopDate: Date?

The time at which the test run was stopped, or nil if the test has not yet run.

var testDuration: TimeInterval

The number of seconds that elapsed between when the run was started and when it was stopped.

var totalDuration: TimeInterval

The number of seconds that elapsed between when the run was started and when it was stopped.

Test Outcomes

var hasSucceeded: Bool

true if all tests in the run completed their execution without recording any failures, otherwise false.

var executionCount: Int

The number of test executions recorded during the run.

var failureCount: Int

The number of test failures recorded during the run.

var test: XCTest

The test instance provided when the test run was initialized.

var testCaseCount: Int

The number of tests in the run.

var totalFailureCount: Int

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

var unexpectedExceptionCount: Int

The number of uncaught exceptions recorded during the run.

Relationships

Inherits From

Conforms To

See Also

Test Runs

class XCTestCaseRun

Collects information about a specific execution of an XCTestCase.

class XCTestSuiteRun

Collects information about a specific execution of an XCTestSuite.