Class

XCTest

An abstract base class for creating, managing, and executing tests.

Declaration

@interface XCTest : NSObject

Overview

The XCTest class provides shared functionality used by XCTestCase and XCTestSuite for creating, managing, and executing tests. In most cases, you should subclass XCTestCase directly when defining tests in your project.

Topics

Test Properties

name

The name of the test.

testCaseCount

The number of test cases in this test.

testRun

The XCTestRun object that executed the test.

testRunClass

The XCTestRun subclass to instantiate when the test is run, to hold the test’s results.

Setup and Teardown

- setUp

Provides an opportunity to reset state before each test method in a test case is called.

- tearDown

Provides an opportunity to perform cleanup after each test method in a test case ends.

Running Tests

- performTest:

Executes a specific test.

- runTest

Creates an instance of the class specified by testRunClass and passes it as a parameter to the performTest: method.

Relationships

Inherits From

See Also

Test Cases and Test Methods

Defining Test Cases and Test Methods

Add test cases and test methods to a test target to confirm that your code behaves as expected.

XCTestCase

The primary class for defining test cases, test methods, and performance tests.