Skip to content
CAI
Software that uses CAICheck a score

swiftlang/swift-corelibs-xctest

52.1

Adequate · 1 October 2026

4.8k

lines of production code

Swift

with Python

1

measurement over time

CAI band scale
CAI lens gauges

What this system is

This system is a non-Apple implementation of the XCTest framework for Swift, enabling unit testing on Linux and other supported platforms. It provides core testing capabilities including synchronous and asynchronous execution, floating-point accuracy assertions, and performance measurement. The library also supports test skipping, command-line filtering, and interoperability with the Swift Testing library.

How it got here

2015–2016 — XCTest core implementation and expansion

27 changes.

This period focused on the initial release and rapid expansion of the corelibs-xctest library for non-Apple platforms, introducing core testing infrastructure alongside advanced features like asynchronous expectations and performance measurement. The work involved restructuring the public and private APIs to align with Darwin's XCTest framework while significantly broadening functional test coverage to validate lifecycle, error handling, and output formatting.

2019–2026 — XCTest interoperability and concurrency support

13 changes.

This period focused on integrating XCTest with Swift Testing through a new interop mechanism that allows cross-framework issue reporting and assertion handling. Significant effort was also dedicated to enhancing support for Swift concurrency, including comprehensive functional tests for async test methods, actors, and expectation safety. Additionally, CMake build integration was improved to facilitate easier installation and linking of the XCTest library.

Features

Add shared Xcode schemes for SwiftXCTest and functional tests

New shared scheme files (SwiftXCTest.xcscheme and SwiftXCTestFunctionalTests.xcscheme) are added to the project, enabling consistent build, test, and launch configurations for the SwiftXCTest framework and its functional tests across the team. These schemes configure the build actions to include SwiftFoundation and SwiftXCTest, set up LLDB debugging, and define test targets, ensuring that developers can run and debug the test suite directly from Xcode without manual scheme setup.

XCTest.xcodeproj/xcshareddata · high confidence

Added XCTest workspace configuration

The repository now includes an XCTest workspace that groups the main XCTest project with the swift-corelibs-foundation project, enabling developers to build and test the framework alongside its dependencies in a single Xcode workspace.

XCTest.xcworkspace · high confidence

Implement asynchronous testing APIs (XCTWaiter, XCTestExpectation)

This change introduces the core asynchronous testing infrastructure for Swift XCTest, adding the \XCTWaiter\ class to manage waiting for multiple expectations, the \XCTestExpectation\ class to define those expectations, and convenience extensions on \XCTestCase\ such as \waitForExpectations(timeout:handler:)\ and \expectation(forNotification:handler:)\. It also includes specific expectation types like \XCTNSNotificationExpectation\ and \XCTNSPredicateExpectation\, along with validation logic to handle timeout, ordering constraints, and inverted expectations.

Sources/XCTest/Public/Asynchronous · high confidence

Initial release of the corelibs-xctest library

This change introduces the initial implementation of the XCTest library for non-Apple platforms, providing a framework for writing and running unit tests in Swift. It includes the core source files for test cases, assertions, and asynchronous testing, along with a CMake build system, a Python build script, and documentation to enable building and testing on Linux and other supported environments.

(repo-wide) · high confidence

XCTest framework public API restructuring and new test capabilities

The public XCTest API has been reorganized into separate source files (XCAbstractTest, XCTestCase, XCTestCaseRun, etc.) to mirror Apple's design, introducing an abstract XCTest base class. New capabilities include test skipping via the XCTSkip error and XCTSkipIf/XCTSkipUnless functions, async setup/teardown methods (setUp/tearDown async throws) for macOS 12.0+, and an async variant of XCTMain() when the DISABLE\_XCTWAITER flag is enabled. The framework now supports interop with other test libraries by recording failures via a fallback event handler when not the active test library, and performance metrics are exposed via the XCTPerformanceMetric enum with wall-clock time measurement.

Sources/XCTest/Public · high confidence

XCTest project restructured with new APIs and documentation

The XCTest project has been significantly reorganized to support a larger codebase and new testing capabilities. The source tree is now split into Public and Private groups, and the main entry point file has been renamed from XCTest.swift to XCTestMain.swift. New testing features are included, such as asynchronous support (XCTWaiter, XCTestExpectation), performance measurement APIs, and the ability to skip tests (XCTSkip). The project also adds documentation files (README, CONTRIBUTING, LICENSE) and links against SwiftFoundation.framework.

XCTest.xcodeproj · high confidence

Behavioural changes

Align XCTest failure handling and assertion behavior with Darwin

The XCTest implementation now matches the behavior of the Darwin XCTest framework in two key areas: the \continueAfterFailure\ property defaults to \true\ (previously \false\), allowing test execution to proceed after a failure, and \XCTAssertEqualWithAccuracy\ now uses the correct distance calculation for floating-point comparisons, fixing previous inaccuracies.

XCTest · high confidence

Improved CMake integration for XCTest installation and export

The build system now generates and exports CMake targets for XCTest, allowing other projects to easily find and link against the library via standard CMake find\_package mechanisms. Additionally, the installation layout is restructured to correctly place Swift module, documentation, and interface files into platform-specific subdirectories (based on the detected module triple, platform, and architecture), ensuring that installed artifacts are organized correctly for different host environments.

cmake · high confidence

XCTest now reports issues from Swift Testing via interop fallback handler

XCTest introduces a new interop mechanism that allows it to receive and record test issues originating from other testing libraries, such as Swift Testing. When XCTest assertions fail within a Swift Testing context, the failure is serialized into a JSON event and passed to XCTest's fallback event handler, which then records the issue in the current test case. This enables mixed-framework test suites to report XCTest-based assertions as part of the overall test results, although some details (like whether a failure was expected) may be lost during the conversion.

Sources/XCTest/Private/Interop · high confidence

XCTest private implementation restructured with new internal utilities

The XCTest private source files have been reorganized and expanded to support new testing capabilities and internal improvements. This includes a new ArgumentParser for handling command-line options like --list-tests and --help, a TestFiltering module for selecting specific tests, and a TestListing module for outputting test suites in human-readable or JSON formats. Internal infrastructure has been added via ObjectWrapper for Hashable identity, SourceLocation for tracking file/line info, and IgnoredErrors for custom error handling during test execution. The WaiterManager has been introduced to manage nested XCTWaiter instances with watchdog timeouts, while the TeardownBlocksState now supports both synchronous and asynchronous teardown blocks. Additionally, the PrintObserver has been enhanced to report test skips and performance measurement results, and XCTestCaseSuite has been simplified by removing unnecessary Optionals.

Sources/XCTest/Private · high confidence

Test coverage

Add functional tests for XCTest observation events; Added concurrency safety test for XCTestExpectation; Added functional test for XCTestObservation suite lifecycle events; Added functional test for multiple XCTest observers; Added functional test for single failing test case; Added functional test harness for ArgumentParser; Added functional test infrastructure for xctest\_checker; Added functional test suite for verifying XCTest output formatting; Added functional tests for XCTest and Swift Testing interoperability; Added functional tests for XCTest failure messages; Added functional tests for XCTest performance measurement APIs; Added functional tests for XCTestCase lifecycle and teardown blocks; Added functional tests for async XCTest support; Added functional tests for asynchronous expectation handling; Added functional tests for asynchronous expectations and XCTWaiter; Added functional tests for equality with accuracy assertions; Added functional tests for error-handling assertions; Added functional tests for notification expectations and handlers; Added functional tests for test skipping capabilities; Added functional tests for the test-listing command-line interface; Added lit test for interop opt-out with mode = none; Added test for expectation cleanup before test run completion; Added test for non-isolated expectation fulfillment; Added test for teardown block misuse crash; Added tests for NSPredicate expectation handlers; Added tests for asynchronous expectation misuse scenarios; Added tests for predicate-based asynchronous expectations; Added tests for selective test execution; Added unit tests for xctest\_checker comparison logic.

Dependencies

Add Swift Package Manager manifest for XCTest

Introduces a Package.swift manifest to enable building the XCTest library via the Swift Package Manager. The package defines a dynamic XCTest library target and configures compiler and linker settings to enable experimental interop features (linking \_TestingInterop) only when compiling with Swift 6.3 or later, ensuring backward compatibility with older toolchains.

(dependencies) · high confidence

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

How this codebase got here

Score

  • CAI 55 → 52 (-2.9)
  • Rubric changed (rubric-2026.09.11 → rubric-2026.09.18) — scores are not directly comparable.

Lenses

  • Code Health 98 → 98 (+0.0)
  • Architecture 100 → 100 (+0.0)
  • Maturity 50 → 50 (+0.0)
  • Readiness 33 → 27 (-6.2)
  • Security 98 → 98 (+0.0)

Resolved (3)

  • Dependency hygiene PARTLY measured — SwiftPM pinning read, dependency currency NOT established
  • Documentation: no architecture or design documentation (README.md)
  • Off-boarding risk: anonymized user #1

New (4)

  • Coverage not measured — Swift suite
  • Documentation: no installation or build instructions (README.md)
  • Documentation: no usage examples (README.md)
  • Off-boarding risk: anonymized user #1

Changes since last survey

  • 2 commits — 1 feature/other, 1 fixes

By area

  • (root) — 2 commits

Notable commits

  • fix: Revert "Update minimum CMake version to 3.29 (#553)" (#554)
  • change: Update minimum CMake version to 3.29 (#553)

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

Survey your own repository

swiftlang/swift-corelibs-xctest was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.

About this page

  • The score is its most recent published measurement, taken on 1 October 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit 80a3f9545d26c43d50ed1e0f377504ae00e759d2 — the exact code this score is about.
  • Scored under rubric-2026.09.18 — the same rubric and the same method as every other entry in this index.
  • Measured by watchdog.canine.dev using codehealth-analyzer preprod-e569280dd5e2.