Learn how to upload your application to emulators and simulators using Sauce Application Storage or installing from a remote location.
Below are the various ways you can upload your application for automated "emusim" (emulators and simulators) tests:
Uploading to Sauce Application Storage
Below are some examples on how to upload your application using the Storage API /upload
method. Supported application file types include *.APK, *IPA, or *.ZIP (.ZIP must include a valid iOS application bundle) files of up to 4 GB. In addition to the application itself, you can upload test assets (e.g., e.g., *.js, *.py, *.tar, *.zip, *.sh, *.bat) for use in your automated tests, such as pre-run executables. For more details about the Storage API, please visit Application Storage.
Uploading with cURL
If you're using cURL for the upload, you must include the @
before your file path, e.g. payload=@path/to/your_file_name
$ curl -F 'payload=@/Users/<user-name>/Downloads/<file_name>.apk' -F name=<file_name>.apk -u "$SAUCE_USERNAME:$SAUCE_ACCESS_KEY" 'https://api.us-west-1.saucelabs.com/v1/storage/upload'
> curl -F 'payload=@\Users\<user-name>\Downloads\<file_name>.apk' -F name=<file_name>.apk -u "%SAUCE_USERNAME%:%SAUCE_ACCESS_KEY%" 'https://api.us-west-1.saucelabs.com/v1/storage/upload'
Then you need to reference a unique identifier (id
) with the "app"
capability in order to use the package file in your automated tests ("app":"<uuid>")
. For more information visit the following section in the Application Storage page: Using Application Storage with Automated Test Builds.
Uploading to a Remote Location
There may be situations where you want to install an application from a downloadable remote location (AWS S3 bucket, a GitHub repository, etc.).
Please review the following guidelines below before uploading your application:
- Make sure your application meets the prerequisite requirements for Android and iOS Mobile Application Testing.
- Upload your application to the hosting location.
- Ensure Sauce Labs has READ access to the app URL.
In your test script, enter the URL for the application as the
"app"
desired capability. Below are some example snippets:caps.setCapability("app", "https://github.com/saucelabs/sample-app-mobile/releases/download/2.2.1/iOS.Simulator.SauceLabs.Mobile.Sample.app.2.1.1.zip);
caps.SetCapability("app", "https://github.com/saucelabs/sample-app-mobile/releases/download/2.2.1/iOS.Simulator.SauceLabs.Mobile.Sample.app.2.1.1.zip");
app: 'https://github.com/saucelabs/sample-app-mobile/releases/download/2.2.1/iOS.Simulator.SauceLabs.Mobile.Sample.app.2.1.1.zip',
'app': 'https://github.com/saucelabs/sample-app-mobile/releases/download/2.2.1/iOS.Simulator.SauceLabs.Mobile.Sample.app.2.1.1.zip',
app: 'https://github.com/saucelabs/sample-app-mobile/releases/download/2.2.1/iOS.Simulator.SauceLabs.Mobile.Sample.app.2.1.1.zip'
Uploading to Legacy Sauce Storage
Sauce Storage is a private temporary storage space. Files uploaded will expire seven days after upload, and be removed. If it has been over seven days since you uploaded your application to Sauce Storage, you will need to upload it again. You can upload the application you want to test to Sauce Storage using our REST API, and then access it for testing by specifying sauce-storage:myapp
for the app
capability in your test script. You upload apps using the upload_file
method of the Sauce Labs REST API.
You can use any REST client; cURL is a convenient command-line option.
US-WEST Data Center
$ curl -u $SAUCE_USERNAME:$SAUCE_ACCESS_KEY -X POST -H "Content-Type: application/octet-stream" \ "https://saucelabs.com/rest/v1/storage/$SAUCE_USERNAME/$APP_NAME?overwrite=true" --data-binary @path/to/your_file_name
US-EAST Data Center
$ curl -u $SAUCE_USERNAME:$SAUCE_ACCESS_KEY -X POST -H "Content-Type: application/octet-stream" \ "https://us-east-1.saucelabs.com/rest/v1/storage/$SAUCE_USERNAME/$APP_NAME?overwrite=true" --data-binary @path/to/your_file_name
EU-CENTRAL Data Center
$ curl -u $SAUCE_USERNAME:$SAUCE_ACCESS_KEY -X POST -H "Content-Type: application/octet-stream" \ "https://eu-central-1.saucelabs.com/rest/v1/storage/$SAUCE_USERNAME/$APP_NAME?overwrite=true" --data-binary @path/to/your_file_name
US-WEST Data Center
> curl -u %SAUCE_USERNAME%:%SAUCE_ACCESS_KEY% -X POST -H "Content-Type: application/octet-stream" \ "https://saucelabs.com/rest/v1/storage/%SAUCE_USERNAME%/%APP_NAME%?overwrite=true" --data-binary @path\to\your_file_name
US-EAST Data Center
> curl -u %SAUCE_USERNAME%:%SAUCE_ACCESS_KEY% -X POST -H "Content-Type: application/octet-stream" \ "https://us-east-1.saucelabs.com/rest/v1/storage/%SAUCE_USERNAME%/%APP_NAME%?overwrite=true" --data-binary @path\to\your_file_name
EU-CENTRAL Data Center
> curl -u %SAUCE_USERNAME%:%SAUCE_ACCESS_KEY% -X POST -H "Content-Type: application/octet-stream" \ "https://eu-central-1.saucelabs.com/rest/v1/storage/%SAUCE_USERNAME%/%APP_NAME%?overwrite=true" --data-binary @path\to\your_file_name