XCTest
import XCTest
Module information
- Declarations
- 205
- Symbols
- 217
import XCTest
let XCTestErrorDomain: String
The domain used by errors produced by the XCTest library.
func XCTAssert(_ expression: @autoclosure () throws -> Bool, _ message: @autoclosure () -> String = "", file: StaticString = #file, line: UInt = #line)
This function emits a test failure if the general Boolean
expression passed to it evaluates to false
.
func XCTAssertEqual<T>(_ expression1: @autoclosure () throws -> T, _ expression2: @autoclosure () throws -> T, _ message: @autoclosure () -> String = "", file: StaticString = #file, line: UInt = #line) where T : Equatable
func XCTAssertEqual<T>(_ expression1: @autoclosure () throws -> T, _ expression2: @autoclosure () throws -> T, accuracy: T, _ message: @autoclosure () -> String = "", file: StaticString = #file, line: UInt = #line) where T : FloatingPoint
func XCTAssertEqual<T>(_ expression1: @autoclosure () throws -> T, _ expression2: @autoclosure () throws -> T, accuracy: T, _ message: @autoclosure () -> String = "", file: StaticString = #file, line: UInt = #line) where T : Numeric
func XCTAssertFalse(_ expression: @autoclosure () throws -> Bool, _ message: @autoclosure () -> String = "", file: StaticString = #file, line: UInt = #line)
func XCTAssertGreaterThan<T>(_ expression1: @autoclosure () throws -> T, _ expression2: @autoclosure () throws -> T, _ message: @autoclosure () -> String = "", file: StaticString = #file, line: UInt = #line) where T : Comparable
func XCTAssertGreaterThanOrEqual<T>(_ expression1: @autoclosure () throws -> T, _ expression2: @autoclosure () throws -> T, _ message: @autoclosure () -> String = "", file: StaticString = #file, line: UInt = #line) where T : Comparable
func XCTAssertIdentical(_ expression1: @autoclosure () throws -> AnyObject?, _ expression2: @autoclosure () throws -> AnyObject?, _ message: @autoclosure () -> String = "", file: StaticString = #file, line: UInt = #line)
Asserts that two values are identical.
func XCTAssertLessThan<T>(_ expression1: @autoclosure () throws -> T, _ expression2: @autoclosure () throws -> T, _ message: @autoclosure () -> String = "", file: StaticString = #file, line: UInt = #line) where T : Comparable
func XCTAssertLessThanOrEqual<T>(_ expression1: @autoclosure () throws -> T, _ expression2: @autoclosure () throws -> T, _ message: @autoclosure () -> String = "", file: StaticString = #file, line: UInt = #line) where T : Comparable
func XCTAssertNil(_ expression: @autoclosure () throws -> Any?, _ message: @autoclosure () -> String = "", file: StaticString = #file, line: UInt = #line)
func XCTAssertNoThrow<T>(_ expression: @autoclosure () throws -> T, _ message: @autoclosure () -> String = "", file: StaticString = #file, line: UInt = #line)
func XCTAssertNotEqual<T>(_ expression1: @autoclosure () throws -> T, _ expression2: @autoclosure () throws -> T, _ message: @autoclosure () -> String = "", file: StaticString = #file, line: UInt = #line) where T : Equatable
func XCTAssertNotEqual<T>(_ expression1: @autoclosure () throws -> T, _ expression2: @autoclosure () throws -> T, accuracy: T, _ message: @autoclosure () -> String = "", file: StaticString = #file, line: UInt = #line) where T : FloatingPoint
func XCTAssertNotEqual<T>(_ expression1: @autoclosure () throws -> T, _ expression2: @autoclosure () throws -> T, accuracy: T, _ message: @autoclosure () -> String = "", file: StaticString = #file, line: UInt = #line) where T : Numeric
func XCTAssertNotIdentical(_ expression1: @autoclosure () throws -> AnyObject?, _ expression2: @autoclosure () throws -> AnyObject?, _ message: @autoclosure () -> String = "", file: StaticString = #file, line: UInt = #line)
Asserts that two values aren’t identical.
func XCTAssertNotNil(_ expression: @autoclosure () throws -> Any?, _ message: @autoclosure () -> String = "", file: StaticString = #file, line: UInt = #line)
func XCTAssertThrowsError<T>(_ expression: @autoclosure () throws -> T, _ message: @autoclosure () -> String = "", file: StaticString = #file, line: UInt = #line, _ errorHandler: (any Error) throws -> Void = { _ in }) rethrows
func XCTAssertThrowsError<T>(_ expression: @autoclosure () throws -> T, _ message: @autoclosure () -> String = "", file: StaticString = #file, line: UInt = #line, _ errorHandler: (any Error) -> Void = { _ in })
func XCTAssertTrue(_ expression: @autoclosure () throws -> Bool, _ message: @autoclosure () -> String = "", file: StaticString = #file, line: UInt = #line)
func XCTFail(_ message: String = "", file: StaticString = #file, line: UInt = #line)
func XCTMain(_ testCases: [XCTestCaseEntry]) -> Never
func XCTMain(_ testCases: [XCTestCaseEntry], arguments: [String]) -> Never
func XCTMain(_ testCases: [XCTestCaseEntry], arguments: [String] = CommandLine.arguments, observers: [any XCTestObservation]? = nil) -> CInt
func XCTMain(_ testCases: [XCTestCaseEntry], arguments: [String], observers: [any XCTestObservation]) -> Never
func XCTSkipIf(_ expression: @autoclosure () throws -> Bool, _ message: @autoclosure () -> String? = nil, file: StaticString = #file, line: UInt = #line) 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(_ expression: @autoclosure () throws -> Bool, _ message: @autoclosure () -> String? = nil, file: StaticString = #file, line: UInt = #line) 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>(_ expression: @autoclosure () throws -> T?, _ message: @autoclosure () -> String = "", file: StaticString = #file, line: UInt = #line) throws -> T
Asserts that an expression is not nil
, and returns its unwrapped value.
func asyncTest<T>(_ testClosureGenerator: @escaping (T) -> () async throws -> Void) -> (T) -> () throws -> Void where T : XCTestCase
func testCase<T>(_ allTests: [(String, (T) -> () throws -> Void)]) -> XCTestCaseEntry where T : XCTestCase
Wrapper function allowing an array of static test case methods to fit the signature required by XCTMain
func testCase<T>(_ allTests: [(String, (T) -> () -> Void)]) -> XCTestCaseEntry where T : XCTestCase
Wrapper function for the non-throwing variant of tests.
protocol XCTWaiterDelegate : AnyObject
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 : AnyObject
XCTestObservation
provides hooks for being notified about progress during a test run.
final 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
and XCTestSuite
extend XCTest
to provide for creating, managing, and executing tests. Most developers will not need to subclass XCTest
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
protocol
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”.
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
.
typealias XCTestCaseClosure = (XCTestCase) throws -> Void
A block with the test code to be invoked when the test runs.
typealias XCTestCaseEntry = (testCaseClass: XCTestCase.Type, allTests: [(String, XCTestCaseClosure)])
This is a compound type used by XCTMain
to represent tests to run. It combines an XCTestCase
subclass type with the list of test case methods to invoke on the class. This type is intended to be produced by the testCase
helper function.
typealias XCWaitCompletionHandler = ((any Error)?) -> ()
A block to be invoked when a call to wait times out or has had all associated expectations fulfilled.
func XCTAssertEqualWithAccuracy<T>(_ expression1: @autoclosure () throws -> T, _ expression2: @autoclosure () throws -> T, accuracy: T, _ message: @autoclosure () -> String = "", file: StaticString = #file, line: UInt = #line) where T : FloatingPoint
func XCTAssertNotEqualWithAccuracy<T>(_ expression1: @autoclosure () throws -> T, _ expression2: @autoclosure () throws -> T, _ accuracy: T, _ message: @autoclosure () -> String = "", file: StaticString = #file, line: UInt = #line) where T : FloatingPoint
typealias XCNotificationExpectationHandler = XCTNSNotificationExpectation.Handler
A closure to be invoked when a notification specified by the expectation is observed.
typealias XCPredicateExpectationHandler = XCTNSPredicateExpectation.Handler
A closure to be invoked whenever evaluating the predicate against the object returns true.
import Cxx
import Dispatch
import DispatchIntrospection
import Distributed
import Foundation
import FoundationNetworking
import FoundationXML
import RegexBuilder
import Swift
import _Concurrency
import _Differentiation
import _RegexParser
import _StringProcessing