<!--
{
  "availability" : [

  ],
  "documentType" : "symbol",
  "framework" : "XCTest",
  "identifier" : "/documentation/XCTest/XCTSkipIf(_:_:file:line:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "XCTest"
    ],
    "preciseIdentifier" : "s:6XCTest9XCTSkipIf__4file4lineySbyKXK_SSSgyXKs12StaticStringVSutKF"
  },
  "title" : "XCTSkipIf(_:_:file:line:)"
}
-->

# XCTSkipIf(_:_:file:line:)

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

```
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.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)