With Sauce Labs, you can test your mobile apps on a variety of Android and iOS devices. If you do not have an app, consider using the Sauce Labs Swag Labs sample app for validating your account functionality as well as your tests.
What You'll Need
- A Sauce Labs account (Log in or sign up for a free trial license).
- Your mobile app file. If you don't have one on hand, consider using our Demo Apps:
Uploading an App
You can upload your app via the Sauce Labs UI or via the REST API. For information about uploading via the API, see Upload Files with the REST API.
To upload an app via the Sauce Labs UI:
On Sauce Labs, in the left panel, click LIVE and then click Mobile App.
Click Upload App. You can either drag and drop an app, or browse for and select the file. We currently support *.apk Android app files, *.aab Android App Bundle files and *.ipa or *.zip iOS app files (*.zip files are parsed to determine whether a valid *.app bundle exists). Non-app file uploads are not supported in the UI at this time, but can be uploaded through the API.
If you don't have an app to test, you can use the Sauce Labs sample mobile app.
Deleting an App
Deleting an app in Sauce Labs will delete the whole app (i.e., the group of builds belonging to the same app package). Files associated with app identifiers (i.e., belonging to the same platform and accessible to the same team) are indicated by the + symbol next to version number. Also, the version number shown is the most recently updated file, not necessarily the latest version of the app.
To delete an app, on the Mobile App test page, hover over the test and then click Delete.
To view or change the app settings, on the Mobile App test page, hover over the test and then click Settings.
To easily copy a test's file name or ID, hover over the test and then click the clipboard icon.
The app settings screen is only available for real device testing.
Default App Settings
|Device Language||Use the dropdown to select the device language.|
|Device Orientation||Use the dropdown to set the device orientation (Landscape or Portrait).|
|Proxy||Enable/disable the use of a proxy. Enter the Hostname and Port and then click Update.|
|Instrumentation||Enable/disable device instrumentation. Enabling allows you to use advanced features when testing your app in the real device cloud, like image injection and taking screenshots of secure views.|
|Image Injection||Enable/disable image injection. Image injection allows you to mimic camera behavior when testing apps by letting you upload an image and present it to the app as if it were read by the device camera.|
|Bypass Screenshot Restriction |
|Enable/disable Bypass Screenshot Restriction (not supported on apps uploaded to the legacy sauce storage). If you're testing Android mobile apps on Sauce Labs and see a black screen in your live testing session, you might need to enable the Bypass Screenshot Restriction. This allows Sauce Labs to work around a setting on those apps that prevents screenshots or videos from being taken. However, there are other details to keep in mind. To effectively test apps that have this setting, see Bypass Screenshot Restriction.|
|System Alerts Display |
|Enable/disable a system alerts delay. Enabling delays alerts, such as asking for permission to access the camera, to prevent app crashes at startup.|
|Biometrics Interception||Enable/disable biometrics. Enabling allows you to choose authentication options if your mobile app requires a biometric authentication, such as fingerprint or face recognition on Android, and Face ID or Touch ID on iOS.|
This setting is disabled by default for iOS apps.
|Group Folder Redirect |
|Enable/disable a group directory redirect. Enabling allows you to use your app's private app container directory instead of the shared app group container directory. When your app gets resigned, the shared directory is not accessible.|
Any changes you make to the app settings will affect all uploaded versions of the app.
Example Settings - iOS
Example Settings - Android
Most settings update automatically, however, when you make changes to the proxy setting, click Update to finish.
Selecting a Device
You must select a device prior to launching a session.
On the App Selection page, hover over the app you want to test and then click Choose Device.
The device selection page will open, with the option to test on a real device or a virtual device.
If you are testing an iOS app, the Virtual Devices tab will only appear if the app is configured for simulators.
On the device selection page, click the Mobile Real tab. Use the search box and filters to find the device you want to test on, or select the device in the grid.
On the device selection page, click the Mobile Virtual tab. Use the dropdowns to select the details for the virtual device you want to test on, and then click Start Session.
Public vs. Private Devices
There is a distinction between Public Devices and Private Devices.
- Public devices are accessible by anyone with a Sauce Labs account and are subject to availability. If a device is in use, you will see a yellow Busy flag across the thumbnail.
- Private devices are associated with your account and are an enterprise only feature. Private devices are indicated by a person icon.
Launching a Test
You can launch a test from the following screens:
Hover over the device in the grid and then click Launch.
Hover over the device in the grid and then click Details. On the Details screen, click Launch.
You'll see a loading screen, and then the app will launch in a live test window using the device you selected.
Time Limits and Timeouts for Real Devices
- Live tests for free users have a 10 minute limit from session start
- Live tests for all other users are limited to six hours
- Live tests for paid users will timeout after 15 minutes of inactivity
Trusting Enterprise Certificates
If you upload an app that is signed with an enterprise certificate, and Instrumentation is DISABLED in app settings, you must manually trust the certificate before it will successfully launch.
- If you receive an app installation failed error, click the X in the app loading screen to exit to the device home screen.
- On the device home screen, navigate to Settings -> General.
- Under Profiles & Device Management, tap the app you are trying to install and test.
- Tap Trust "app name" and then tap Trust.
- Reopen the app to continue the test.
Live Test Interface
|Unpin/Pin Toolbar||Unpins or pins the live testing toolbar.|
|Session Info||Opens the Current Session window, which includes app and device details.|
|Take Screenshot||Takes a screenshot of the current device screen. The image downloads automatically as a .png file.|
|Share Session||Opens the Share Device window. For a sharable link to the device, click Get Link. |
Users must be logged in to be able to view the test.
|Rotate Device||Rotates the device between portrait and landscape.|
|Home||Opens the device home screen.|
|More Device Options||Set Location - Set the GPS location using coordinates or by dropping a pin on the map. |
Camera Injection - Opens the Camera Injection window. See Camera Image Injection for more information.
Biometric Injection - Opens the Biometric Authentication window.
|Restart App||Restarts the app.|
|Switch App Version||Opens the Switch App Version window. To change the version of the app you are testing, hover over the version and then click Choose version.|
|Clipboard||Opens the Paste Content Into Device window.|
|Install Dependency||Opens the Install Dependent App window.|
|Developer Options||Opens the Developer Options panel, which includes the Device Log, Device Vitals, and Dev Tools tabs.|
|Search Log||Opens the Search log interface. Enter a term or terms in the search box and select or deselect the following checkboxes as necessary: |
|Pause Log||Pauses the log feed.|
|Wrap Text||Wraps text in the log for easier reading.|
|Clear Log||Clears the log feed.|
|Download Log||Downloads the log as a .txt file.|
Device Vitals is a feature that collects useful performance data in real time from a device during a live session. Data such as network, CPU, and memory usage helps users understand the general performance of a device and the app under test. Users can view a graph of this performance data in real time as the app is processing.
|Graph Height||Change the size of the graphs (S, M, L).|
|Grid Layout||Displays graphs side by side.|
|Row Layout||Displays graphs as as a list.|
|Download Vitals||Downloads the device vitals as a .txt file.|
Performance Metrics for Android/iOS Devices
The graph and csv file will contain these performance metrics for devices.
|System-wide CPU usage in percentage across all CPU cores. 4 cores at max use would be shown as a value of 400%|
|CPU usage for user processes in percentage across all CPU cores. 4 cores at max use would be shown as a value of 400%|
|Android OS CPU usage in percentage across all CPU cores. 4 cores at max use would be shown as a value of 400%|
|Total threads in use by the app|
|Total threads in use by the app|
|Memory currently in use by app in kilobytes|
|Anonymous shared memory currently in use by system shared between app(s) and system|
|Data in bytes received over wifi connection|
|Data in bytes sent over wifi connection|
|Data in bytes received from the mobile carrier network|
|Data in bytes sent over mobile carrier network|
Changing an App Version
Sometimes you need to conduct A/B testing, or document and validate feature parity between different versions of the same app. You can change the app version, as well as the real device, and launch a new test session.
- On the App Upload page, click the +n in the Version column.
- On the Settings page, in the versions list, hover over the version you want to launch.
- Click Choose Device.
Testing Apple Pay in Mobile Apps
There are three ways to test Apple Pay with Sauce Labs:
- Using simulators
- Using real private devices with an Apple Pay Sandbox Testing account
- Using real private devices with a real production account and real credit cards
Apple certificates are used to ensure security in their systems, and they are much more strict about them than Android. This level of security makes certificates a very complex part of making Apple Pay work with devices in a cloud.
To give you an example, Android apps can be installed without any specific signing on whatever real device you want. With Apple you have two options, or you need to add a remote device to your developer certificate and the provisioning profile, so you are allowed to install the app on that specific device. Or you need to use an enterprise certificate where the Apple device that has that certificate installed allows you to install the app. Similarly, when you install an iOS app on a device, we re-sign the app with a Sauce Labs enterprise certificate so you can install your app on all Sauce Labs public/private devices.
Apple Pay has a limitation that it cannot work with an enterprise certificate. You need to use the developer certificate where the device has been added to the provisioning profile in order to make this work. This can only be done for Sauce Labs private devices on which you have disabled the resigning.
Apple Pay on Real Private Devices
To make Apple Pay work on Sauce Labs real private devices:
Follow Apple’s steps to enable Apple Pay (see Setting Up Apple Pay Requirements). Apple is strict about certificates, so they require you to follow very specific steps:
Set up Apple Pay integration in your app.
Register the Merchant ID in your Apple developer account.
Set up an Apple sandbox tester account (see Create a sandbox tester account for more information).
Build your app. Apple Pay doesn’t work with enterprise certificates, so it will not work with Sauce Labs out of the box. The first step is to add the Sauce Labs real private devices to your Apple developer certificate before building the app. You can do that in one of the following ways:
Manually adding the device and its UDID to the device list for your developer certificate.
Your device list can be found on Apple’s Certificates, Identifiers & Profiles page for your developer account, and you can get the UDID of your private device by contacting your Sauce Labs CSM.
Using the Sauce Labs Virtual USB solution:
Start a session with Virtual USB (see Testing with Virtual USB on Real Devices for more information).
When the connection is established, open XCODE.
Select the device from the device list.
On the Signing & Capabilities tab, you will see that the device has not yet been added.
Click Register Device to add the device to your developer certificate.
Once the UDID of the device is added to the developer certificate, you can build the app (manually or automatically):
- Select your build scheme and then select Generic iOS Device.
- To build the app, click Product and then click Archive.
- Click Distribute App.
- Distribute the app with Ad Hoc and Automatically manage signing.
- Store the app on your local machine.
If the app has been built, you should not yet upload it to Sauce Labs. The device to be tested needs to be prepared. If you have already prepared the device, then you can skip to step 4.
Prepare the device. Set up the first Sauce Labs private device to use Apple Pay with the Apple sandbox account that was created in step 1.
Disable the Passcode
Apple Pay requires that you have set a passcode on your phone, and you can’t add cards to your wallet without it. But setting a passcode on a device can break Appium automation because Appium can’t automate the passcode screen. To prevent the testing device from displaying the passcode screen:
- On the device, go to Settings > Display & Brightness and disable Auto-Lock.
- Ask your CSM to disable rebooting the device by providing them with the unique device name, found in the device details.
There is no guarantee that the device won’t reboot or show the passcode screen. The test run on the device might be less reliable if the passcode screen appears during the automated session.
Add the Testing Account
- On the device, go to Settings and then click Sign in to your iPhone. Sign in using your Apple sandbox tester account.
- If prompted, enter the device’s passcode.
If you weren’t prompted for a passcode, set it by going to Settings > Face ID & Passcode and tapping Turn Passcode On.
Add Apple Sandbox Test Cards
Apple test cards can be found on Apple’s Sandbox Testing page.
- On your device, go to Wallet. If you didn’t set a passcode, Apple will show a notification.
- In Wallet, tap the plus sign to add a new card. Use the card information on Apple’s Sandbox Testing page.
- Prepare Sauce Labs. As mentioned before, Sauce Labs uses an enterprise certificate to install an app on public and private devices. But Apple Pay can’t work with the enterprise certificate, so the app needs to be signed with the developer certificate. You need to instruct Sauce Labs to not re-sign the app when it is installed.
- On Sauce Labs, in the left navigation, click Live and then click Mobile-App.
You will see an overview of the already uploaded apps. If no app has been uploaded, then upload the app. Once uploaded, open the app settings by hovering over the row until you see this:
- Click Settings.
- Under Default settings, toggle Instrumentation to Disabled.
Disabling this allows the app to use Apple Pay and the developer certificate and provisioning profile that you used when you built the app.
Disabling re-signing will break the installation of the app on public devices. The app will only be allowed to be installed on private devices that have been added to the developer certificate and provisioning profile.
Once the app has been uploaded and re-signing has been disabled, you can start the device and let Sauce Labs install the app on the device.
- Test the app. View the Sauce Labs Demo Payments app: