# XCTest

> Create and run unit tests, performance tests, and UI tests for your Xcode project

Source: https://talira.ai/catalog/xctest-wh9w9xts
Every listing: https://talira.ai/catalog.md

- Kind: Open source
- Types: Library
- Categories: [developer tools / testing / frameworks](https://talira.ai/categories/developer-tools/testing/frameworks), [languages / swift](https://talira.ai/categories/languages/swift)
- Platforms: macos, ios, linux, windows[^2]
- Licence: Apache-2.0 WITH Swift-exception[^3]
- Pricing: Free[^2]
- Pricing notes: Comes with Xcode, free on the Mac App Store; swift-corelibs-xctest is open source.
- Free tier: yes[^2]
- Self-hostable: yes[^2]
- Backed by: [Apple](https://talira.ai/orgs/apple.md)
- Funding: public company (NASDAQ:AAPL)[^4]

XCTest is Apple's testing framework for [Swift](https://talira.ai/catalog/swift-05qrpmw7.md) and Objective-C, built into [Xcode](https://talira.ai/catalog/xcode-yrayr0fd.md) and its testing workflow. Tests are `XCTestCase` subclasses whose `test` methods make assertions and record failures; it also supports asynchronous tests with expectations, performance tests that measure blocks of code to catch regressions, and UI tests that drive an app through accessibility to check user flows, with activities and attachments in test reports. On Apple platforms it ships with Xcode as a closed framework; the open source swift-corelibs-xctest (Apache-2.0) implements most of the same APIs so the same tests run with `swift test` on Linux, Windows and every other platform Swift supports. Apple's newer Swift Testing framework sits beside it.

## Links

- Website: https://developer.apple.com/documentation/xctest
- GitHub: https://github.com/swiftlang/swift-corelibs-xctest

## Problems it solves

- write unit tests for my iOS or macOS app in Swift
- test asynchronous code that completes later, with expectations and timeouts
- automate UI tests that tap through my iPhone app
- catch performance regressions by measuring how long code takes in tests
- run my Swift package's tests on Linux in CI with swift test
- attach screenshots and logs to test results in Xcode

## Features

- XCTestCase test classes with setUp and tearDown
- assertions that record failures with optional messages
- asynchronous tests with expectations
- performance tests that measure blocks of code
- UI tests that drive an app's interface (XCUIApplication)
- activities and attachments in test reports
- integrated with Xcode's test navigator and xcodebuild
- swift-corelibs-xctest runs the same tests on Linux, Windows and other Swift platforms through swift test

## Ways to run it

### XCTest in Xcode

You run it, under a commercial licence. Price: free with Xcode.[^1]

Only in this edition:

- UI tests[^1]
- performance tests[^1]
- integration with Xcode's test navigator and reports[^1]

You arrange:

- a Mac with Xcode[^1]

Self-hosting docs: https://developer.apple.com/documentation/xctest

### swift-corelibs-xctest

You run it, Apache-2.0 WITH Swift-exception. Price: free.[^2]

Only in this edition:

- runs on Linux, Windows and other platforms Swift supports[^2]

Not included:

- parts of the Xcode XCTest API: it implements the majority of the unit testing APIs from Xcode 7 and later[^2]

Self-hosting docs: https://github.com/swiftlang/swift-corelibs-xctest
Code: https://github.com/swiftlang/swift-corelibs-xctest

## Capabilities

- Has official SDKs: plan not known

## Trust

Overall: 0.37 out of 1.
Signals: backing 0.55, extensibility 0.00.

- backed by Apple
- funding: public company (NASDAQ:AAPL)

Warnings:

- GitHub activity not fetched yet

## Related

- Works with [Xcode](https://talira.ai/catalog/xcode-yrayr0fd.md)

## Alternatives

- [Swift Testing](https://talira.ai/catalog/swift-testing-r271e6c6.md): Expressive and intuitive APIs that make testing your Swift code a breeze

## Sources

[^1]: https://developer.apple.com/documentation/xctest (checked 24 Nov 2026)
[^2]: https://github.com/swiftlang/swift-corelibs-xctest (checked 24 Nov 2026)
[^3]: https://github.com/swiftlang/swift-corelibs-xctest/blob/main/LICENSE (checked 24 Nov 2026)
[^4]: https://data.sec.gov/submissions/CIK0000320193.json (checked 20 Nov 2026)
