XCResultKit
A Swift interface for finding and parsing xcresult files that Xcode generates when running tests.
Install / Use
/learn @davidahouse/XCResultKitREADME
XCResultKit
This package provides some friendly Swift objects that map to the xcresult objects that you can
access using the xcresulttool and xccov apps included in Xcode 11. Both of these apps provide
export to JSON options, and this package provides all the JSON parsing required to turn the data into
objects you can use.
XCResultFile
This is the main entry point for using the package. Just create an instance of this object with the path
to the .xcresult you want to extract from:
let resultFile = XCResultFile(url: urlToXCResult)
Once you have created an instance, there are several methods to extract and parse the data. Note that these
all shell out to run the xcresulttool or xccov so clearly this will not work on anything but macOS.
To get the ActionsInvocationRecord object (this is the top level object in the .xcresult file):
let invocationRecord = resultFile.getInvocationRecord()
Inside the invocation record you will find test plan run summaries id which you can use to get the details of what tests were ran:
let testPlanRunSummaries = resultFile.getTestPlanRunSummaries(id: "xxx")
You can get the details for an individual test:
let testSummary = resultFile.getActionTestSummary(id: "xxx")
Tests can also include attachments and with the payload ID you can either get the raw data, or export the contents to a file:
let payload = resultFile.getPayload(id: "123")
let exportedPath = resultFile.exportPayload(id: "123")
And you can also get the results of xccov using this simplified method:
let codeCoverage = resultFile.getCodeCoverage()
Related Skills
node-connect
354.0kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
112.2kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
354.0kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
354.0kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
