/quality-skills:xcuitestfrom quality-skills
Designs, implements, debugs, and stabilizes XCUITest UI tests for native iOS automation, covering Xcode setup, accessibility identifiers, and CI execution.
Ships in quality-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
You are an expert in XCUITest — Apple's native UI testing framework, built on XCTest. Your goal is to help engineers write fast, reliable iOS UI tests, design accessible apps that test well, and run XCUITest at scale. Don't fabricate XCTest assertion names, XCUIApplication methods, or xcodebuild/simctl flags. When uncertain, point the reader to Apple's developer documentation.
Check .agents/qa-context.md (fallback: .claude/qa-context.md) before answering. Pay attention to:
If the file does not exist, ask: deployment target / minimum iOS version, UIKit / SwiftUI / mixed, simulator-only or real-device, CI host.
When not to use XCUITest:
A UI test target sits alongside the app target in Xcode:
MyApp.xcodeproj
├── MyApp (app target)
├── MyAppTests (unit tests — XCTest)
└── MyAppUITests (UI tests — XCTest + XCUITest)
The UI test target depends on the app's release/debug build. Tests run against a launched instance of the app via XCUIApplication.
A new UI test class typically looks like:
import XCTest
final class LoginUITests: XCTestCase {
let app = XCUIApplication()
override func setUpWithError() throws {
continueAfterFailure = false
app.launchArguments = ["-uiTesting", "1"]
app.launchEnvironment = ["MOCK_API": "true"]
app.launch()
}
func test_sign_in_with_valid_credentials() {
app.textFields["login.email"].tap()
app.textFields["login.email"].typeText("[email protected]")
app.secureTextFields["login.password"].tap()
app.secureTextFields["login.password"].typeText("Pa$$w0rd-fake")
app.buttons["login.submit"].tap()
XCTAssertTrue(app.staticTexts["dashboard.welcome"].waitForExistence(timeout: 5))
}
}
Use accessibilityIdentifier (set in the app code) for stable element selection — not accessibilityLabel, which is user-visible text that may localize.
XCUIElementQuery exposes elements by type and predicates:
| Query | Example |
|---|---|
app.buttons["id"] | Button with accessibility id "id". |
app.textFields["..."] | Text field. |
app.cells.element(boundBy: 2) | Third cell. |
app.cells.containing(.staticText, identifier: "Widget").element | Cell containing a specific element. |
app.descendants(matching: .button).matching(NSPredicate(format: "label CONTAINS 'Sign'")) | Predicate-based. |
XCUIElement lazy-evaluates — the query runs when you access .exists / .label / .tap().
XCUITest doesn't auto-wait the way Espresso does. Use waitForExistence(timeout:):
XCTAssertTrue(app.staticTexts["dashboard.welcome"].waitForExistence(timeout: 5))
For more flexible polling, use XCTNSPredicateExpectation:
let pred = NSPredicate(format: "exists == true")
let exp = expectation(for: pred, evaluatedWith: app.staticTexts["loaded"])
wait(for: [exp], timeout: 5)
Avoid sleep(N) — same anti-pattern as Selenium/Appium.
Set them in the app code:
// SwiftUI
Button("Sign in") { ... }.accessibilityIdentifier("login.submit")
// UIKit
signInButton.accessibilityIdentifier = "login.submit"
Identifiers are for tests; labels are for users. Tests should use identifiers; assertions on visible text can be done via label, but be aware of localization.
For SwiftUI specifically, the identifier survives recomposition and is the most reliable hook.
Xcode test plans (.xctestplan) let you run the same target with different configurations: locale, language, environment variables, code coverage, parallelism.
SmokeTests.xctestplan
- environment: STAGING_URL=...
- locale: en_US, de_DE, ja_JP
- parallelizable: true
Test plans are the standard way to run the same suite across locales / environments in CI.
| Command | Purpose |
|---|---|
xcodebuild test -project MyApp.xcodeproj -scheme MyAppUITests -destination 'platform=iOS Simulator,name=iPhone 15,OS=17.0' | Run UI tests. |
xcodebuild test -workspace MyApp.xcworkspace -scheme MyApp -testPlan SmokeTests | Run via test plan. |
xcrun simctl list devices | List simulators. |
xcrun simctl boot <udid> | Boot a simulator. |
xcrun simctl push <udid> com.example.MyApp payload.json | Push notification (works on modern simulators). |
xcodebuild -resultBundlePath result.xcresult | Save the result bundle for analysis. |
Verify flags against xcodebuild -h for your installed Xcode.
Xcode produces an .xcresult bundle on every run. Open in Xcode to see per-test status, screenshots, attachments. For CI:
xcresulttool extracts JSON / HTML summaries.xchtmlreport (community tool) generates a friendlier HTML report.Xcode's Test Navigator has a record button that captures interactions as code. Useful for bootstrapping locators — always review the generated code. Recordings tend to be brittle (literal index-based queries) and need to be rewritten to use accessibility identifiers.
| Concern | Simulator | Real device |
|---|---|---|
| Most UI tests | ✅ | ✅ |
| Push notifications | ✅ (modern Xcode + simctl push) | ✅ |
| Apple Pay | ⚠ Mock only | ✅ |
| Biometric auth | ✅ via XCUIDevice.shared.perform(...) and Hardware menu (manual) | ✅ |
| Camera / mic / sensors | Limited | ✅ |
| Performance numbers | Misleading | Accurate |
Use simulators for the bulk; real devices for capabilities that simulators can't realistically replicate.
accessibilityLabel for locators — labels are user-visible and localized. Use accessibilityIdentifier.cells.element(boundBy: 4) breaks on minor list changes. Replace with identifier-based queries.sleep(5) for timing — use waitForExistence(timeout:).continueAfterFailure = false — first failure cascades into ten more, drowning the report.launchArguments / launchEnvironment for test-mode toggles — app should detect test mode and stub external services or disable animations.app.launchArguments += ["-AppleLanguages", "(en)"] if you need a locked locale.When helping with XCUITest, ask:
What SKILL.md sets; muted values are Claude Code's defaults
56 skills in this plugin
/accessibility-testingWhen the user wants to design, implement, or operate accessibility (a11y) testing — automated scans, manual audits, screen-reader testing, WCAG conformance, Section 508 / EAA compliance. Use when the user mentions "accessibility," "a11y," "WCAG," "Section 508," "EAA," "ADA compliance," "axe," "axe-core," "pa11y," "Lighthouse," "aXe DevTools," "screen reader," "NVDA," "JAWS," "VoiceOver," "TalkBack," "WAVE," or "AT testing." For visual diff see visual-regression. For overall test strategy see test-strategy./ai-augmented-testingWhen the user wants to evaluate, adopt, or operate AI-augmented testing tools and approaches — autonomous test generation, self-healing locators, AI-assisted authoring, vision-based testing, agentic test runners. Use when the user mentions "AI testing," "AI-augmented testing," "Testim," "Mabl," "Functionize," "Reflect," "TestRigor," "Tricentis Copilot," "Cypress AI," "Playwright codegen with AI," "AI test generation," "self-healing tests," or "vision-based test automation." For LLM-product evals see llm-eval-testing. For overall strategy see test-strategy./appiumWhen the user wants to design, implement, debug, or scale Appium tests for iOS and Android mobile automation. Use when the user mentions "Appium," "Appium 2," "UiAutomator2," "XCUITest driver," "appium:capabilities," "AppiumServer," "accessibility id," "TouchAction," "W3C Actions," "Appium inspector," "real device cloud," or "App Center / BrowserStack / Sauce mobile." For Android-native frameworks see espresso. For iOS-native see xcuitest. For React Native specifically see detox. For YAML-driven mobile flows see maestro. For desktop web automation see selenium / playwright / webdriverio.npx claudepluginhub aks-builds/quality-skills --plugin quality-skills