Contents

XCTSkipIf(_:_:file:line:)

Skips remaining tests in a test method if the specified condition is met.

Declaration

func XCTSkipIf(_ expression: @autoclosure () throws -> Bool, _ message: @autoclosure () -> String? = nil, file: StaticString = #filePath, line: UInt = #line) throws

Parameters

  • expression:

    A Boolean expression.

  • message:

    An optional description of the skip.

  • file:

    The file where the skip occurs. The default is the filename of the test case where you call this function.

  • line:

    The line number where the skip occurs. The default is the line number where you call this function.

Discussion

Call this method to skip any remaining code and assertions in the test method when expression evaluates to true, and mark the test method as skipped. If a test failure occurs in the test method before the skip, the test runner marks the test method as failed.

See Also

Methods for Skipping Tests