XCTestCase
extension XCTestCase
-
Executes the
testcaseclosure and expects it to produce a specific assertion failure.Declaration
Swift
public func expectAssertionFailure<T: Error>( expectedError: T, timeout: TimeInterval = 2, file: StaticString = #file, line: UInt = #line, testcase: @escaping () -> Void ) where T: EquatableParameters
expectedErrorThe
Erroryou expecttestcaseto pass toassert()orassertionFailure().timeoutHow long to wait for
testcaseto produce its error. Defaults to 2 seconds.fileThe test file. By default, this will be the file from which you’re calling this method.
lineThe line number in
filewhere this is called.testcaseThe closure to run that produces the error.
-
Executes the
testcaseclosure and expects it to produce a specific assertion failure message.Declaration
Swift
public func expectAssertionFailure( expectedMessage message: String, timeout: TimeInterval = 2, file: StaticString = #file, line: UInt = #line, testcase: @escaping () -> Void )Parameters
messageThe
Stringyou expecttestcaseto pass toassert().timeoutHow long to wait for
testcaseto produce its error. Defaults to 2 seconds.fileThe test file. By default, this will be the file from which you’re calling this method.
lineThe line number in
filewhere this is called.testcaseThe closure to run that produces the error.
-
Executes the
testcaseclosure and expects it to produce any assertion failure.Declaration
Swift
public func expectAssertionFailure( timeout: TimeInterval = 2, file: StaticString = #file, line: UInt = #line, testcase: @escaping () -> Void )Parameters
timeoutHow long to wait for
testcaseto produce its error. Defaults to 2 seconds.fileThe test file. By default, this will be the file from which you’re calling this method.
lineThe line number in
filewhere this is called.testcaseThe closure to run that produces the error.
-
Executes the
testcaseclosure and expects it finish without producing any assertion failures.Declaration
Swift
public func expectNoAssertionFailure( timeout: TimeInterval = 2, file: StaticString = #file, line: UInt = #line, testcase: @escaping () -> Void )Parameters
timeoutHow long to wait for
testcaseto finish. Defaults to 2 seconds.fileThe test file. By default, this will be the file from which you’re calling this method.
lineThe line number in
filewhere this is called.testcaseThe closure to run.
-
Executes the
testcaseclosure and expects it to produce a specific fatal error.Declaration
Swift
public func expectFatalError<T: Error>( expectedError: T, timeout: TimeInterval = 2, file: StaticString = #file, line: UInt = #line, testcase: @escaping () -> Void ) where T: EquatableParameters
expectedErrorThe
Erroryou expecttestcaseto pass tofatalError().timeoutHow long to wait for
testcaseto produce its error. defaults to 2 seconds.fileThe test file. By default, this will be the file from which you’re calling this method.
lineThe line number in
filewhere this is called.testcaseThe closure to run that produces the error.
-
Executes the
testcaseclosure and expects it to produce a specific fatal error message.Declaration
Swift
public func expectFatalError( expectedMessage message: String, timeout: TimeInterval = 2, file: StaticString = #file, line: UInt = #line, testcase: @escaping () -> Void )Parameters
messageThe
Stringyou expecttestcaseto pass tofatalError().timeoutHow long to wait for
testcaseto produce its error. defaults to 2 seconds.fileThe test file. By default, this will be the file from which you’re calling this method.
lineThe line number in
filewhere this is called.testcaseThe closure to run that produces the error.
-
Executes the
testcaseclosure and expects it to produce any fatal error.Declaration
Swift
public func expectFatalError( timeout: TimeInterval = 2, in context: StaticString = #function, file: StaticString = #file, line: UInt = #line, testcase: @escaping () -> Void )Parameters
timeoutHow long to wait for
testcaseto produce its error. defaults to 2 seconds.fileThe test file. By default, this will be the file from which you’re calling this method.
lineThe line number in
filewhere this is called.testcaseThe closure to run that produces the error.
-
Executes the
testcaseclosure and expects it execute without producing any fatal errors.Declaration
Swift
public func expectNoFatalError( timeout: TimeInterval = 2, in context: StaticString = #function, file: StaticString = #file, line: UInt = #line, testcase: @escaping () -> Void )Parameters
timeoutHow long to wait for
testcaseto finish. Defaults to 2 seconds.fileThe test file. By default, this will be the file from which you’re calling this method.
lineThe line number in
filewhere this is called.testcaseThe closure to run.
-
Executes the
testcaseclosure and expects it to produce a specific precondition failure.Declaration
Swift
public func expectPreconditionFailure<T: Error>( expectedError: T, timeout: TimeInterval = 2, file: StaticString = #file, line: UInt = #line, testcase: @escaping () -> Void ) where T: EquatableParameters
expectedErrorThe
Erroryou expecttestcaseto pass toprecondition().timeoutHow long to wait for
testcaseto produce its error. defaults to 2 seconds.fileThe test file. By default, this will be the file from which you’re calling this method.
lineThe line number in
filewhere this is called.testcaseThe closure to run that produces the error.
-
Executes the
testcaseclosure and expects it to produce a specific precondition failure message.Declaration
Swift
public func expectPreconditionFailure( expectedMessage message: String, timeout: TimeInterval = 2, file: StaticString = #file, line: UInt = #line, testcase: @escaping () -> Void )Parameters
messageThe
Stringyou expecttestcaseto pass toprecondition().timeoutHow long to wait for
testcaseto produce its error. defaults to 2 seconds.fileThe test file. By default, this will be the file from which you’re calling this method.
lineThe line number in
filewhere this is called.testcaseThe closure to run that produces the error.
-
Executes the
testcaseclosure and expects it to produce any precondition failure.Declaration
Swift
public func expectPreconditionFailure( timeout: TimeInterval = 2, file: StaticString = #file, line: UInt = #line, testcase: @escaping () -> Void )Parameters
timeoutHow long to wait for
testcaseto produce its error. defaults to 2 seconds.fileThe test file. By default, this will be the file from which you’re calling this method.
lineThe line number in
filewhere this is called.testcaseThe closure to run that produces the error.
-
Executes the
testcaseclosure and expects it finish without producing any precondition failures.Declaration
Swift
public func expectNoPreconditionFailure( timeout: TimeInterval = 2, file: StaticString = #file, line: UInt = #line, testcase: @escaping () -> Void )Parameters
timeoutHow long to wait for
testcaseto finish. Defaults to 2 seconds.fileThe test file. By default, this will be the file from which you’re calling this method.
lineThe line number in
filewhere this is called.testcaseThe closure to run.
View on GitHub
XCTestCase Extension Reference