- 2.1.2 and master184.108.40.206.04.2
- 2.1.2 and masteriOSmacOS(Intel)macOS(ARM)LinuxtvOSwatchOS
Command line tool & Swift framework for parsing Xcode 11+ xcresult
A command line tool to extract code coverage & screenshots from Xcode 11 XCResult files.
To learn more about Xcode 11's xcresult format, read Rishab Sukumar's post on the ChargePoint Engineering blog
Enter the following command into your terminal:
brew install chargepoint/xcparse/xcparse
This will tap into our xcparse Homebrew tap and install the tool on your local machine.
To use xcparse via Mint, prefix the normal usage with mint run ChargePoint/xcparse like so:
mint run ChargePoint/xcparse xcparse <command> <options>
To use a specific version of xcparse, add the release tag like so:
mint run ChargePointemail@example.com xcparse --help
See our Bitrise step's README for more information.
xcparse <command> <options>
Below are a few examples of common commands. For further assistance, use the --help option on any command
xcparse screenshots --os --model --test-plan-config /path/to/Test.xcresult /path/to/outputDirectory
This will cause screenshots to be exported like so:
Options can be added & remove to change the folder structure used for export. Using no options will lead to all attachments being exported into the output directory.
Options available include:
||Divide by test target model|
||Divide by test target operating system|
||Divide by test run configuration|
||Divide by test language|
||Divide by test region|
||Divide by test|
xcparse screenshots --help for a full-listing
--test-status option can allow for whitelisting only screenshots from tests that have a status that matches at least one of the provided status strings
||Passing tests only|
||Failing tests only|
||Passing or failing tests only|
Test status strings can be found by using verbose mode with the screenshots sub-command.
--activity-type option allows for whitelisting screenshots whose activity type matches at least one of the provided activity type strings.
||Test failure screenshots only|
||User created screenshots only|
Note that when an activity type string is provided which doesn't have a reverse-DNS style domain, it is assumed to be of
com.apple.dt.xctest.activity-type.<activityTypeString> and the domain is automatically added.
Therefore, these two are option calls are equivalent:
--activity-type userCreated attachmentContainer
--activity-type com.apple.dt.xctest.activity-type.userCreated com.apple.dt.xctest.activity-type.attachmentContainer
Activity types can be found in verbose mode. Below are a listing of common ones:
|com.apple.dt.xctest.activity-type.attachmentContainer||Placeholder activity that contains an attachment, may contain user created screenshot|
|com.apple.dt.xctest.activity-type.deletedAttachment||Deleted attachment placeholder activity|
|com.apple.dt.xctest.activity-type.internal||Internal test step, may have automatic screenshot to show test progression|
|com.apple.dt.xctest.activity-type.testAssertionFailure||Step where the test failed in an assertion, may have failure screenshot|
|com.apple.dt.xctest.activity-type.userCreated||User created screenshot/attachment|
xcparse attachments /path/to/Test.xcresult /path/to/outputDirectory --uti public.plain-text public.image
Export all attachments in the xcresult that conform to either the
public.plan-text or the
public.image uniform type identifiers (UTI). The screenshots command, for example, is actually just the attachments command operating a whitelist for
public.image UTI attachments. Other common types in xcresults are
public.plain-text for debug descriptions of test failures.
Read this Apple documentation for a list of publicly documented UTIs.
xcparse codecov /path/to/Test.xcresult /path/to/exportCodeCoverageFiles
This will export the action.xccovreport & action.xccovarchive into your output directory.
xcparse logs /path/to/Test.xcresult /path/to/exportLogFiles
This will export logs & diagnostic files into a per-action folder structure similar to Xcode 10's xcresult format.
xcparse --help xcparse screenshots --help
Learn about all the options we didn't mention with