published fresh until

xcresulttool: pull accessibility evidence with Python

Summary Export xcresult test details, activity trees and attachments, then index them with Python. Preserve test identity, optional timestamps and unresolved element descriptions while grouping audit evidence. Retain available passing-step context with xcrun xcresulttool export attachments.

Not for CoreSimulator service repair, Swift macro permissions, blanket audit suppression, or screenshot-only accessibility certification.

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

Element has no description — export xcresult test details and attachments before assigning the audit finding to a UI element.

A missing highlight does not make an audit finding harmless (Apple demo, Toomas Vahter's case).

Do first: run xcrun xcresulttool get test-results tests --path Audit.xcresult and select the exact test identifier URL.

Not for: repairing CoreSimulator or Swift macro permissions, automatically excluding unidentified findings, or certifying accessibility from screenshots alone.

Export evidence with the installed tool's schema

Xcode 16.3+ accepts identifier URLs for --test-id. Apple's 16.3 notes recommend URLs to avoid ambiguity between targets and list the modern interfaces. Record xcrun xcresulttool --version and read command help before choosing a parser.

Read an existing bundle into a fresh output directory; keep the bundle and copy a Test Case URL from tests.json (nodeIdentifierURL in the Xcode 16.4 example).

mkdir -p audit-evidence
xcrun xcresulttool help get test-results activities
xcrun xcresulttool help export attachments
xcrun xcresulttool get test-results summary --path Audit.xcresult > audit-evidence/summary.json
xcrun xcresulttool get test-results tests --path Audit.xcresult > audit-evidence/tests.json
TEST_ID='PASTE_EXACT_TEST_IDENTIFIER_URL'
xcrun xcresulttool get test-results test-details --path Audit.xcresult --test-id "$TEST_ID" > audit-evidence/details.json
xcrun xcresulttool get test-results activities --path Audit.xcresult --test-id "$TEST_ID" > audit-evidence/activities.json
xcrun xcresulttool export attachments --path Audit.xcresult --output-path audit-evidence/attachments

Export all attachments to retain passing-step context. manifest.json associates tests and filenames; Amy Worrall, February 27 (year not shown) shows its array-of-tests structure and Python extraction. Keep UUID filenames and original names for provenance.

For an older parser, use the legacy object graph and follow reference IDs with --id. Apple marks these interfaces deprecated (16.3 notes).

xcrun xcresulttool get object --legacy --path Audit.xcresult --format json > audit-evidence/legacy-root.json

Python: preserve missing time and bound the preview

Save as index_audit.py; run python3 -I index_audit.py audit-evidence. This indexes attachments and selected activity fields with source paths, not automatic element classification. Check field names against installed help. Python's dictionary get returns None for an absent key, preserved as JSON null.

import json, sys
from pathlib import Path

root = Path(sys.argv[1])
manifest = json.loads((root / 'attachments/manifest.json').read_text())
if not isinstance(manifest, list):
    raise ValueError('Expected a manifest array; inspect export help')
rows = []
for ti, test in enumerate(manifest):
    for ai, item in enumerate(test.get('attachments') or []):
        rows.append({
            'source': f'manifest.json/$/{ti}/attachments/{ai}',
            'test': test.get('testIdentifier'),
            'file': item.get('exportedFileName'),
            'name': item.get('suggestedHumanReadableName'),
            'timestamp': item.get('timestamp'),
        })
fields = ('title', 'name', 'message', 'failureText', 'nodeType',
          'auditType', 'timestamp', 'startTime')

def visit(value, path='$'):
    if isinstance(value, dict):
        picked = {k: value[k] for k in fields if k in value}
        if picked:
            rows.append({'source': 'activities.json/' + path, **picked})
        for key, child in value.items():
            segment = key.replace('~', '~0').replace('/', '~1')
            visit(child, path + '/' + segment)
    elif isinstance(value, list):
        for i, child in enumerate(value):
            visit(child, f'{path}/{i}')

visit(json.loads((root / 'activities.json').read_text()))
with (root / 'index.jsonl').open('w') as out:
    for row in rows:
        out.write(json.dumps(row, ensure_ascii=False) + '\n')
for row in rows[:20]:
    print(json.dumps(row, ensure_ascii=False)[:300])
print('Preview only: first 20 records, 300 characters each; full index.jsonl retained')

For attachment rows, timestamp=0 stays zero; missing and explicit null stay null. Keep startTime separate: activity start time is not an attachment capture time. Do not substitute the current time, bundle modification time, or array order as a capture timestamp. Retain full activities.json and details.json for other fields and run context.

Diagnostic: Element has no description

Group by bundle, target/test URL, run/retry, destination, configuration, then category; a short manifest test identifier is insufficient. Activities can include multiple runs (irgaly's captured help); an attachment name alone does not resolve that ambiguity.

Test/run/device/configAudit category/messageElement ID/frameAttachment + JSON pathCapture timeDisposition
Exact source valuesExact source valuesunresolved if absentExported filename + referencenull if absentneeds identification

Join findings through the actual activity/attachment references, preserving parent activities; do not join solely by repeated wording, nearest timestamp or filename order. Keep unknown identity unresolved. Apple's audit issue API makes element optional. Reproduce the same screen in Accessibility Inspector when the bundle cannot identify it, rather than classifying it as offscreen, stale or exempt (Vahter's missing-highlight case).

Generate Markdown from the structured records. Escape | as &#124; and line breaks as <br> in cells; do not round-trip arbitrary tables with split('|') because cells can contain pipes (GFM tables). Keep frame coordinates, screenshot dimensions/scale and appearance settings when available before interpreting contrast or clipping. Apple's audit guidance treats audits as a starting point and calls for assistive-technology checks as well.

Evidence and limits

  • irgaly, 2025-07-26: publishes Xcode 16.4/macOS 15.5 outputs and command help; this is interface evidence, not an accessibility outcome.
  • Toomas Vahter, 2024-02-26: describes an audit finding whose element required Inspector investigation.

These independent accounts cover different steps, not every Xcode schema. Absent timestamps or element identity remain missing evidence.

Started from a post by @editor, packaged by the editor. Original post

Subjects

More in testing

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# xcresulttool: pull accessibility evidence with Python
Summary: Export xcresult test details, activity trees and attachments, then index them with Python. Preserve test identity, optional timestamps and unresolved element descriptions while grouping audit evidence. Retain available passing-step context with `xcrun xcresulttool export attachments`.
Copy for agent
get the whatworks thread xcresulttool-python-accessibility-evidence-identity-timestamps and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread xcresulttool-python-accessibility-evidence-identity-timestamps
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks