XCTestRun Class Reference

Inherits from NSObject
Declared in XCTestRun.h

Overview

@class XCTestRun A test run collects information about the execution of a test. Failures in explicit test assertions are classified as “expected”, while failures from unrelated or uncaught exceptions are classified as “unexpected”.

+ testRunWithTest:

@method +testRunWithTest: Class factory method for the XCTestRun class.

+ (instancetype)testRunWithTest:(XCTest *)test

Parameters

test

An XCTest instance.

Return Value

A test run for the provided test.

Declared In

XCTestRun.h

– initWithTest:

@method -initWithTest: Designated initializer for the XCTestRun class.

- (instancetype)initWithTest:(XCTest *)test

Parameters

test

An XCTest instance.

Return Value

A test run for the provided test.

Declared In

XCTestRun.h

  test

@property test The test instance provided when the test run was initialized.

@property (readonly, strong) XCTest *test

Declared In

XCTestRun.h

– start

@method -start Start a test run. Must not be called more than once.

- (void)start

Declared In

XCTestRun.h

– stop

@method -stop Stop a test run. Must not be called unless the run has been started. Must not be called more than once.

- (void)stop

Declared In

XCTestRun.h

  startDate

@property startDate The time at which the test run was started, or nil.

@property (readonly, copy, nullable) NSDate *startDate

Declared In

XCTestRun.h

  stopDate

@property stopDate The time at which the test run was stopped, or nil.

@property (readonly, copy, nullable) NSDate *stopDate

Declared In

XCTestRun.h

  totalDuration

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

@property (readonly) NSTimeInterval totalDuration

Declared In

XCTestRun.h

  testDuration

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

@property (readonly) NSTimeInterval testDuration

Declared In

XCTestRun.h

  testCaseCount

@property testCaseCount The number of tests in the run.

@property (readonly) NSUInteger testCaseCount

Declared In

XCTestRun.h

  executionCount

@property executionCount The number of test executions recorded during the run.

@property (readonly) NSUInteger executionCount

Declared In

XCTestRun.h

  failureCount

@property failureCount The number of test failures recorded during the run.

@property (readonly) NSUInteger failureCount

Declared In

XCTestRun.h

  unexpectedExceptionCount

@property unexpectedExceptionCount The number of uncaught exceptions recorded during the run.

@property (readonly) NSUInteger unexpectedExceptionCount

Declared In

XCTestRun.h

  totalFailureCount

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

@property (readonly) NSUInteger totalFailureCount

Declared In

XCTestRun.h

  hasSucceeded

@property hasSucceeded YES if all tests in the run completed their execution without recording any failures, otherwise NO.

@property (readonly) BOOL hasSucceeded

Declared In

XCTestRun.h

– recordFailureWithDescription:inFile:atLine:expected:

@method -recordFailureWithDescription:inFile:atLine:expected: Records a failure in the execution of the test for this test run. Must not be called unless the run has been started. Must not be called if the test run has been stopped.

- (void)recordFailureWithDescription:(NSString *)description inFile:(nullable NSString *)filePath atLine:(NSUInteger)lineNumber expected:(BOOL)expected

Parameters

description

The description of the failure being reported.

filePath

The file path to the source file where the failure being reported was encountered or nil if unknown.

lineNumber

The line number in the source file at filePath where the failure being reported was encountered.

expected

YES if the failure being reported was the result of a failed assertion, NO if it was the result of an uncaught exception.

Declared In

XCTestRun.h