Skip to main content

XCUI Testing on LambdaTest

Developed by Apple, XCUITest is a framework for user-interface (UI) testing for iOS applications. It is built on top of XCTest, an integrated test framework in Apple's Xcode IDE. LambdaTest lets you perform automated app testing of your iOS apps using XCUITest across 3000+ real devices and OS combinations.

Prerequisites

tip

If you do not have any iOS app (.ipa) and an XCUI Test app (.ipa) file, you can run your sample tests on LambdaTest by using our sample 🔗 iOS app and a sample 🔗 XCUI Test.

Running Your First Test: A Step-by-Step Guide

Step 1: Upload Your Application

To begin testing, upload your iOS application (.ipa file) to LambdaTest's servers. You'll use our REST API for this process.

  • Authentication : You'll need your LambdaTest Username and AccessKey. Combine them in the format Username:AccessKey.
  • Uploading the App : Use cURL command to send a request to our API. The request should include the path to your application file (appFile).
curl -u "undefined:undefined" --location --request POST 'https://manual-api.lambdatest.com/app/uploadFramework' --form 'appFile=@"<PATH_OF_YOUR_iOS_APP>"' --form 'type="xcuit-ios"'
info
  • Provide the path of your android application in the above URL in place of <PATH_OF_YOUR_iOS_APP>
  • Response of above cURL will be a JSON object containing the App URL of the format - lt://APP123456789123456789 and will be used in the last step.

Step 2: Upload Your Test Suite

Upload your iOS test suite (.ipa) file to LambdaTest servers using our REST API.

The following sample cURL command shows how to upload a test suite:

curl -u "undefined:undefined" --location --request POST 'https://manual-api.lambdatest.com/app/uploadFramework' --form 'appFile=@"<PATH_OF_YOUR_TEST_SUITE_APP>"' --form 'type="xcuit-ios"'
info
  • Provide the path of your android application in the above URL in place of <PATH_OF_YOUR_TEST_SUITE_APP>
  • Response of above cURL will be a JSON object containing the App URL of the format - lt://APP123456789123456789 and will be used in the last step.

Step 3: Executing The Test

  • You will need base64 encoded authentication in order to execute your Espresso automation test suite. Enter your username:accesskey in Basic Authentication Header Generator to generate your auth token.

Take note of the base64 encoded authentication which needs to be added in the next step.

undefined:undefined
  • Once you have uploaded your app and test suite, you can execute your test by running the following command:

Enter your BASIC_AUTH_TOKEN, APP_ID (generated in the first step) and TEST_SUITE_ID (generated in the second step) in the below command.

curl --location --request POST 'https://mobile-api.lambdatest.com/framework/v1/xcui/build' \
--header 'Authorization: Basic BASIC_AUTH_TOKEN' \
--header 'Content-Type: application/json' \
--data-raw '{
"app" : "APP_ID",
"testSuite": "TEST_SUITE_ID",
"device" : ["iPhone 11-14"],
"video" : true,
"queueTimeout": 10800,
"idleTimeout": 150,
"devicelog": true,
"network": false,
"build" : "Proverbial-XCUITest"
}'

Step 4: View Test Execution

Once you have run your tests, you can view the test execution along with logs. You will be able to see the test cases passing or failing. You can view the same at LambdaTest Automation.

Image

Running Tests in Parallel

You can run tests in parallel on multiple devices by passing the device name in comma separated format in the execute command as show below:

curl --location --request POST 'https://mobile-api.lambdatest.com/framework/v1/xcui/build' \
--header 'Authorization: Basic BASIC_AUTH_TOKEN' \
--header 'Content-Type: application/json' \
--data-raw '{
"app" : "APP_ID",
"testSuite": "TEST_SUITE_ID",
"device" : ["iPhone 11-14","iPhone 12 Pro-15","iPhone X-13"],
"queueTimeout": 10800,
"IdleTimeout": 150,
"deviceLog": true,
"build" : "Proverbial-XCUITest"
}'

Test across 3000+ combinations of browsers, real devices & OS.

Book Demo

Help and Support

Related Articles