|
| 1 | +--- |
| 2 | +id: xcresult |
| 3 | +title: XCResult |
| 4 | +sidebar_label: XCResult |
| 5 | +description: Learn how to generate and download Xcode Result Bundles (.xcresult) for XCUI test executions on LambdaTest. Debug smarter with detailed reports directly in Xcode. |
| 6 | +keywords: |
| 7 | + - xcuitest |
| 8 | + - xcui result bundle |
| 9 | + - xcuitest report |
| 10 | + - xcuitest logs |
| 11 | + - lambdatest xcuitest |
| 12 | + - xcui xcresult |
| 13 | + - app testing |
| 14 | + - real devices |
| 15 | +url: https://www.lambdatest.com/support/docs/xcresult/ |
| 16 | +site_name: LambdaTest |
| 17 | +slug: xcresult/ |
| 18 | +--- |
| 19 | + |
| 20 | +import CodeBlock from '@theme/CodeBlock'; |
| 21 | +import Tabs from '@theme/Tabs'; |
| 22 | +import TabItem from '@theme/TabItem'; |
| 23 | +import {YOUR_LAMBDATEST_USERNAME, YOUR_LAMBDATEST_ACCESS_KEY} from "@site/src/component/keys"; |
| 24 | + |
| 25 | +<script type="application/ld+json" |
| 26 | + dangerouslySetInnerHTML={{ __html: JSON.stringify({ |
| 27 | + "@context": "https://schema.org", |
| 28 | + "@type": "BreadcrumbList", |
| 29 | + "itemListElement": [{ |
| 30 | + "@type": "ListItem", |
| 31 | + "position": 1, |
| 32 | + "name": "Home", |
| 33 | + "item": "https://www.lambdatest.com" |
| 34 | + },{ |
| 35 | + "@type": "ListItem", |
| 36 | + "position": 2, |
| 37 | + "name": "Support", |
| 38 | + "item": "https://www.lambdatest.com/support/docs/" |
| 39 | + },{ |
| 40 | + "@type": "ListItem", |
| 41 | + "position": 3, |
| 42 | + "name": "XCUI Testing on LambdaTest", |
| 43 | + "item": "https://www.lambdatest.com/support/docs/getting-started-with-xcuitest/" |
| 44 | + }] |
| 45 | + }) |
| 46 | + }} |
| 47 | +></script> |
| 48 | + |
| 49 | +# XCResult on LambdaTest |
| 50 | + |
| 51 | +Apple’s **Native XCResult Bundles (`.xcresult`)** are comprehensive test reports generated when you run XCUITest cases. These bundles include **test hierarchy, logs, stack traces, screenshots, and performance data**, which can be directly viewed in Xcode. They provide developers with rich debugging information, making it easier to analyze why a test passed or failed. |
| 52 | + |
| 53 | +On LambdaTest, you can now **generate and download `.xcresult` bundles** for your XCUI test sessions. You can access them via the **REST API**. |
| 54 | + |
| 55 | +--- |
| 56 | +## Prerequisites |
| 57 | + |
| 58 | +- Your LambdaTest [Username and Access Key](https://accounts.lambdatest.com/security). |
| 59 | +- Access to an **iOS app (.ipa)** and an **XCUI Test app (.ipa)**. |
| 60 | +- Xcode installed locally to view `.xcresult` bundles. |
| 61 | + |
| 62 | +--- |
| 63 | + |
| 64 | +## Flow for Adding XCUI Result Bundles |
| 65 | + |
| 66 | +### Step 1: Upload Your Application and Test Suite |
| 67 | + |
| 68 | +To begin testing, you need to upload both your iOS application (.ipa) file and your XCUI test suite (.ipa) file to LambdaTest. These files are required before executing tests. |
| 69 | + |
| 70 | +Detailed upload steps are available here: [Getting Started with XCUI Testing – Running Your First Test](https://www.lambdatest.com/support/docs/getting-started-with-xcuitest/#running-your-first-test-a-step-by-step-guide) |
| 71 | + |
| 72 | +### Step 2: Execute Your Tests with Result Bundles |
| 73 | + |
| 74 | +To generate `.xcresult` bundles for your XCUI test executions, you must pass `"enableResultBundle": true` in your build request and use the new build endpoint: |
| 75 | + |
| 76 | +``` |
| 77 | +POST https://mobile-api.lambdatest.com/mobile-automation/api/v1/xcuitest/builds |
| 78 | +``` |
| 79 | + |
| 80 | +This endpoint initiates your test run and enables generation of the result bundle. |
| 81 | + |
| 82 | +| Parameter | Description | Values | |
| 83 | +|--------------------|-------------------------------------------------------|--------------------------------| |
| 84 | +| enableResultBundle | Enable generating result bundles for your XCUI build. | true/false (default: false) | |
| 85 | + |
| 86 | +Below is an example cURL command to execute your test with result bundles enabled: |
| 87 | + |
| 88 | +<Tabs className="docs__val"> |
| 89 | + |
| 90 | +<TabItem value="bash" label="Linux / MacOS" default> |
| 91 | + |
| 92 | + <div className="lambdatest__codeblock"> |
| 93 | + <CodeBlock className="language-bash"> |
| 94 | + |
| 95 | +```bash |
| 96 | +curl --location --request POST 'https://mobile-api.lambdatest.com/framework/v1/xcui/build' \ |
| 97 | +--header 'Authorization: Basic BASIC_AUTH_TOKEN' \ |
| 98 | +--header 'Content-Type: application/json' \ |
| 99 | +--data-raw '{ |
| 100 | + "app" : "APP_ID", |
| 101 | + "testSuite": "TEST_SUITE_ID", |
| 102 | + "device" : ["iPhone 11-14"], |
| 103 | + "video" : true, |
| 104 | + "queueTimeout": 10800, |
| 105 | + "idleTimeout": 150, |
| 106 | + "devicelog": true, |
| 107 | + "network": false, |
| 108 | + "build" : "Proverbial-XCUITest", |
| 109 | + "enableResultBundle": true |
| 110 | +}' |
| 111 | +``` |
| 112 | + |
| 113 | +</CodeBlock> |
| 114 | +</div> |
| 115 | + |
| 116 | +</TabItem> |
| 117 | + |
| 118 | +<TabItem value="powershell" label="Windows" default> |
| 119 | + |
| 120 | + <div className="lambdatest__codeblock"> |
| 121 | + <CodeBlock className="lamguage-powershell"> |
| 122 | + |
| 123 | +```bash |
| 124 | +curl --location --request POST "https://mobile-api.lambdatest.com/framework/v1/xcui/build" \ |
| 125 | +--header "Authorization: Basic BASIC_AUTH_TOKEN" \ |
| 126 | +--header "Content-Type: application/json" \ |
| 127 | +--data-raw "{ |
| 128 | + "app" : "APP_ID", |
| 129 | + "testSuite": "TEST_SUITE_ID", |
| 130 | + "device" : ["iPhone 11-14"], |
| 131 | + "video" : true, |
| 132 | + "queueTimeout": 10800, |
| 133 | + "idleTimeout": 150, |
| 134 | + "devicelog": true, |
| 135 | + "network": false, |
| 136 | + "build" : "Proverbial-XCUITest", |
| 137 | + "enableResultBundle": true |
| 138 | +}" |
| 139 | +``` |
| 140 | + </CodeBlock> |
| 141 | +</div> |
| 142 | + |
| 143 | +</TabItem> |
| 144 | +</Tabs> |
| 145 | + |
| 146 | +### Step 3: Retrieve the Result Bundle |
| 147 | + |
| 148 | +Result bundles are generated at the Build level. To download the `.xcresult` bundle for a specific session, use the following GET endpoint: |
| 149 | + |
| 150 | +:::note |
| 151 | +In case of sharding, each shard execution is treated as a separate shards and generates its own `.xcresult` bundle. You will need to retrieve each shard's bundle individually. For more information, see [Sharding in HyperExecute](https://www.lambdatest.com/support/docs/sharding-rd-hyperexec/). |
| 152 | +::: |
| 153 | + |
| 154 | +``` |
| 155 | +GET https://mobile-api.lambdatest.com/mobile-automation/api/v1/framework/builds/{build-id}/xcresult |
| 156 | +``` |
| 157 | + |
| 158 | +Replace `{build-id}` with the actual build ID. |
| 159 | + |
| 160 | +Example cURL command to download the result bundle: |
| 161 | + |
| 162 | +<div className="lambdatest__codeblock"> |
| 163 | + <CodeBlock className="language-bash"> |
| 164 | +{`curl --location --request GET \\ |
| 165 | +'https://mobile-api.lambdatest.com/mobile-automation/api/v1/framework/builds/{build-id}/xcresult' \\ |
| 166 | +--header 'Authorization: Basic BASIC_AUTH_TOKEN' \\ |
| 167 | +--output xcui-result-bundle.zip`} |
| 168 | + </CodeBlock> |
| 169 | +</div> |
| 170 | + |
| 171 | +:::tip |
| 172 | +You will need your **BASIC_AUTH_TOKEN** (Base64 encoded `username:accesskey`) in the request header. |
| 173 | +If you’re unsure how to generate it, follow the instructions here: [Executing the Test](https://www.lambdatest.com/support/docs/getting-started-with-xcuitest/#step-3-executing-the-test). |
| 174 | +::: |
| 175 | + |
| 176 | +The response is a binary ZIP file containing the `.xcresult` bundle, which you can unzip and open directly in Xcode for detailed analysis. |
| 177 | + |
| 178 | +### Step 4: Report Structure |
| 179 | + |
| 180 | +The `.xcresult` bundle contains a comprehensive report of your XCUI test execution, including: |
| 181 | + |
| 182 | +- **Summary View**: Shows total tests executed, number passed, and number failed with a visual chart. |
| 183 | +- **Errors Section**: Lists any critical errors or crashes encountered (e.g., test runner crashes with signal codes). |
| 184 | +- **Tests Section**: Provides execution duration, device and OS version details, and per-device results. |
| 185 | +- **Device & Configuration Matrix**: Displays which tests passed/failed on specific device configurations. |
| 186 | +- **Individual Test Details**: Each test case shows its status (pass/fail), failure reason, logs, and any assertion errors. |
| 187 | + |
| 188 | + |
| 189 | +You can open the `.xcresult` bundle directly in Xcode to explore these details visually, enabling efficient debugging and analysis of your test runs. |
| 190 | + |
| 191 | + |
0 commit comments