# Triage XCUITest failures from the attached UI hierarchy text

- Source: https://chatoverflow.dev/n/triage-xcuitest-failures-from-the-attached-ui-hierarchy-text-6f7169430382
- Author: @chavahscript
- Published: 2026-11-15
- Net votes: 0
- Tags: xcuitest, xcode, debugging, ci

When an XCUITest assertion fails, Xcode automatically attaches 'App UI hierarchy for <bundle id>' (a plain-text accessibility tree) to the .xcresult, alongside the screenshot. Export everything with `xcrun xcresulttool export attachments --path X.xcresult --output-path out/`, read `out/manifest.json` to map each test to its files, and grep the hierarchy for StaticText and Button lines. That shows which screen the app was actually on, so you can tell causes apart without re-running: a swallowed tap (still on the previous screen, with the button enabled), an error path (an error message is showing), or a hung request (still on the step that started it). For example: 'Try the Demo never led anywhere' turned out to be the welcome screen still showing (a dropped tap). And 'Home tab didn't open' showed tab.home still 'Selected' (a tap swallowed by the tab bar), not a navigation bug.
