Binary Moduleswift 5.10.0XCTest
XCTest
import XCTest
Module information
- Declarations
- 204
- Symbols
- 222
Uncategorized
Protocols
protocol XCTWaiterDelegate
Events are reported to the waiter’s delegate via these methods. XCTestCase conforms to this protocol and will automatically report timeouts and other unexpected events as test failures.
protocol XCTestObservation
XCTestObservation
provides hooks for being notified about progress during a test run.
Types
class PerformanceMeter
class XCTNSNotificationExpectation
Expectation subclass for waiting on a condition defined by a Foundation Notification instance.
class XCTNSPredicateExpectation
Expectation subclass for waiting on a condition defined by an NSPredicate and an optional object.
struct XCTPerformanceMetric
struct XCTSkip
An error which causes the current test to cease executing and be marked as skipped when it is thrown.
class XCTWaiter
Manages waiting - pausing the current execution context - for an array of XCTestExpectations. Waiters can be used with or without a delegate to respond to events such as completion, timeout, or invalid expectation fulfillment. XCTestCase conforms to the delegate protocol and will automatically report timeouts and other unexpected events as test failures.
class XCTest
An abstract base class for testing.
XCTestCase
andXCTestSuite
extendXCTest
to provide for creating, managing, and executing tests. Most developers will not need to subclassXCTest
directly.class XCTestCase
An instance of this class represents an individual test case which can be run by the framework. This class is normally subclassed and extended with methods containing the tests to run.
class XCTestCaseRun
A test run for an
XCTestCase
.struct XCTestError
Describes an error in the XCTestErrorDomain.
class XCTestExpectation
Expectations represent specific conditions in asynchronous testing.
class XCTestObservationCenter
Provides a registry for objects wishing to be informed about progress during the course of a test run. Observers must implement the
XCTestObservation
protocolclass 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”.
class XCTestSuite
A subclass of XCTest, XCTestSuite is a collection of test cases. Based on what’s passed into XCTMain(), a hierarchy of suites is built up, but XCTestSuite can also be instantiated and manipulated directly:
class XCTestSuiteRun
A test run for an
XCTestSuite
.
Typealiases
typealias XCTestCaseClosure
A block with the test code to be invoked when the test runs.
typealias XCTestCaseEntry
This is a compound type used by
XCTMain
to represent tests to run. It combines anXCTestCase
subclass type with the list of test case methods to invoke on the class. This type is intended to be produced by thetestCase
helper function.typealias XCWaitCompletionHandler
A block to be invoked when a call to wait times out or has had all associated expectations fulfilled.
Show obsolete interfaces (2)
Hide obsolete interfaces
typealias XCNotificationExpectationHandler
A closure to be invoked when a notification specified by the expectation is observed.
typealias XCPredicateExpectationHandler
A closure to be invoked whenever evaluating the predicate against the object returns true.
Globals
let XCTestErrorDomain: String
The domain used by errors produced by the XCTest library.
func XCTAssert(@autoclosure () throws -> Bool, @autoclosure () -> String, file: StaticString, line: UInt
) This function emits a test failure if the general
Boolean
expression passed to it evaluates tofalse
.func XCTAssertEqual<T>(@autoclosure () throws -> T, @autoclosure () throws -> T, @autoclosure () -> String, file: StaticString, line: UInt
) func XCTAssertEqual<T>(@autoclosure () throws -> T, @autoclosure () throws -> T, accuracy: T, @autoclosure () -> String, file: StaticString, line: UInt
) func XCTAssertEqual<T>(@autoclosure () throws -> T, @autoclosure () throws -> T, accuracy: T, @autoclosure () -> String, file: StaticString, line: UInt
) func XCTAssertFalse(@autoclosure () throws -> Bool, @autoclosure () -> String, file: StaticString, line: UInt
) func XCTAssertGreaterThan<T>(@autoclosure () throws -> T, @autoclosure () throws -> T, @autoclosure () -> String, file: StaticString, line: UInt
) func XCTAssertGreaterThanOrEqual<T>(@autoclosure () throws -> T, @autoclosure () throws -> T, @autoclosure () -> String, file: StaticString, line: UInt
) func XCTAssertIdentical(@autoclosure () throws -> AnyObject?, @autoclosure () throws -> AnyObject?, @autoclosure () -> String, file: StaticString, line: UInt
) Asserts that two values are identical.
func XCTAssertLessThan<T>(@autoclosure () throws -> T, @autoclosure () throws -> T, @autoclosure () -> String, file: StaticString, line: UInt
) func XCTAssertLessThanOrEqual<T>(@autoclosure () throws -> T, @autoclosure () throws -> T, @autoclosure () -> String, file: StaticString, line: UInt
) func XCTAssertNil(@autoclosure () throws -> Any?, @autoclosure () -> String, file: StaticString, line: UInt
) func XCTAssertNoThrow<T>(@autoclosure () throws -> T, @autoclosure () -> String, file: StaticString, line: UInt
) func XCTAssertNotEqual<T>(@autoclosure () throws -> T, @autoclosure () throws -> T, @autoclosure () -> String, file: StaticString, line: UInt
) func XCTAssertNotEqual<T>(@autoclosure () throws -> T, @autoclosure () throws -> T, accuracy: T, @autoclosure () -> String, file: StaticString, line: UInt
) func XCTAssertNotEqual<T>(@autoclosure () throws -> T, @autoclosure () throws -> T, accuracy: T, @autoclosure () -> String, file: StaticString, line: UInt
) func XCTAssertNotIdentical(@autoclosure () throws -> AnyObject?, @autoclosure () throws -> AnyObject?, @autoclosure () -> String, file: StaticString, line: UInt
) Asserts that two values aren’t identical.
func XCTAssertNotNil(@autoclosure () throws -> Any?, @autoclosure () -> String, file: StaticString, line: UInt
) func XCTAssertThrowsError<T>(@autoclosure () throws -> T, @autoclosure () -> String, file: StaticString, line: UInt, (any Error) throws -> Void
) rethrows func XCTAssertThrowsError<T>(@autoclosure () throws -> T, @autoclosure () -> String, file: StaticString, line: UInt, (any Error) -> Void
) func XCTAssertTrue(@autoclosure () throws -> Bool, @autoclosure () -> String, file: StaticString, line: UInt
) func XCTFail(String, file: StaticString, line: UInt
) func XCTMain([XCTestCaseEntry]
) -> Never Starts a test run for the specified test cases.
func XCTMain([XCTestCaseEntry], arguments: [String]
) -> Never func XCTMain([XCTestCaseEntry], arguments: [String], observers: [any XCTestObservation]
) -> Never func XCTSkipIf(@autoclosure () throws -> Bool, @autoclosure () -> String?, file: StaticString, line: UInt
) throws Evaluates a boolean expression and, if it is true, throws an error which causes the current test to cease executing and be marked as skipped.
func XCTSkipUnless(@autoclosure () throws -> Bool, @autoclosure () -> String?, file: StaticString, line: UInt
) throws Evaluates a boolean expression and, if it is false, throws an error which causes the current test to cease executing and be marked as skipped.
func XCTUnwrap<T>(@autoclosure () throws -> T?, @autoclosure () -> String, file: StaticString, line: UInt
) throws -> T Asserts that an expression is not
nil
, and returns its unwrapped value.func asyncTest<T>(@escaping (T) -> () async throws -> Void
) -> (T) -> () throws -> Void func testCase<T>([(String, (T) -> () throws -> Void)]
) -> XCTestCaseEntry Wrapper function allowing an array of static test case methods to fit the signature required by
XCTMain
func testCase<T>([(String, (T) -> () -> Void)]
) -> XCTestCaseEntry Wrapper function for the non-throwing variant of tests.
Show obsolete interfaces (2)
Hide obsolete interfaces
func XCTAssertEqualWithAccuracy<T>(@autoclosure () throws -> T, @autoclosure () throws -> T, accuracy: T, @autoclosure () -> String, file: StaticString, line: UInt
) func XCTAssertNotEqualWithAccuracy<T>(@autoclosure () throws -> T, @autoclosure () throws -> T, T, @autoclosure () -> String, file: StaticString, line: UInt
)