<!--
{
  "availability" : [

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

# XCTSkipUnless(_:_:file:line:)

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

```
func XCTSkipUnless(_ 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 `false`, 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)