CtrlK
BlogDocsLog inGet started
Tessl Logo

testland/xctest-mac-desktop

Authors and runs XCTest UI + unit tests for macOS desktop apps - the Apple-first-party test framework that ships with Xcode. Covers the `XCTestCase` subclass + `test*` method-naming convention, `XCUIApplication` / `XCUIElement` / `XCUIElementQuery` for UI tests, accessibility-identifier-based locators (the stable replacement for label-based queries), `XCTAssert*` macros, `measureBlock:` for performance regressions, and `xcodebuild test` for CI execution. Use when the macOS app is built with Xcode and the test target is in-tree alongside the app - for cross-OS sharing see Appium Mac2 driver as a separate path.

70

Quality

88%

Does it follow best practices?

Run evals on this skill

Adds up to 20 points to the overall score

View guide

SecuritybySnyk

High

Do not use without reviewing

Overview
Quality
Evals
Security
Files

ci-and-results.mdreferences/

xctest-mac-desktop - results parsing and CI

Results parsing and the CI workflow, kept out of the SKILL spine. See SKILL.md for authoring and running XCTest UI tests.

Parsing results

The .xcresult bundle is queryable via xcrun xcresulttool:

# JSON summary of the result bundle
xcrun xcresulttool get --path build/result.xcresult --format json

# Extract a specific failure's screenshot attachment
xcrun xcresulttool get --path build/result.xcresult \
  --id <attachment-id> --output failure.png

For CI dashboards that expect JUnit XML, the open-source xcresultparser project converts .xcresult -> JUnit XML; pair downstream with junit-xml-analysis.

CI integration

Hosted macOS runners on GitHub-hosted are interactive sessions, so XCUIApplication launches work without extra display setup. Self-hosted headless Mac setups need an attached console or VNC session; XCTest UI cannot run under launchd alone.

# .github/workflows/macos-xctest.yml
jobs:
  test:
    runs-on: macos-14   # Apple Silicon
    steps:
      - uses: actions/checkout@v5
      - uses: maxim-lobanov/setup-xcode@v1
        with: { xcode-version: '15.4' }
      - name: Build + test
        run: |
          xcodebuild test \
            -project MyApp.xcodeproj \
            -scheme MyApp \
            -destination 'platform=macOS' \
            -resultBundlePath build/result.xcresult \
            -enableCodeCoverage YES
      - uses: actions/upload-artifact@v4
        if: always()
        with:
          name: xcresult
          path: build/result.xcresult

SKILL.md

tile.json