<!--
{
  "documentType" : "article",
  "framework" : "XCTest",
  "identifier" : "/documentation/XCTest/methods-for-skipping-tests",
  "metadataVersion" : "0.1.0",
  "role" : "collectionGroup",
  "title" : "Methods for Skipping Tests"
}
-->

# Methods for Skipping Tests

Skip tests when meeting specified conditions.

## Discussion

Use `XCTSkipIf()` or `XCTSkipUnless()` when you have a Boolean condition that you can use to evaluate when to skip tests.

In Swift, throw an `XCTSkip` error when you have other circumstances that result in skipped tests. In Objective-C use `XCTSkip`. For example:

```objc
- (void)testSomethingNew {
    if (@available(macOS <#VersionNumber#>, *)) {
        // perform test using <#VersionNumber#> APIs...
    } else {
        XCTSkip(@"Required API is not available for this test.");
    }
}
```

## Topics

### Methods for Skipping Tests

[`XCTSkipIf(_:_:file:line:)`](/documentation/XCTest/XCTSkipIf(_:_:file:line:))

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

[`XCTSkipUnless(_:_:file:line:)`](/documentation/XCTest/XCTSkipUnless(_:_:file:line:))

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

[`XCTSkip`](/documentation/XCTest/XCTSkip-swift.struct)

An error that causes the current test to cease executing and the test runner to mark the test as skipped when the test throws the error.

[`XCTSkipIf`](/documentation/XCTest/XCTSkipIf)

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

[`XCTSkipUnless`](/documentation/XCTest/XCTSkipUnless)

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

[`XCTSkip`](/documentation/XCTest/XCTSkip-c.macro)

Throws an exception that causes the test runner to cease executing the current test and mark the test skipped.



---

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)