Sauce Labs Appium Example

Link to Sauce Labs Appium Example copied to clipboard

Below is an example for running your Appium tests integrated with axe DevTools against Sauce Labs.

Setup Configuration

Using Sauce Labs to test your project with Appium requires setting the iOSDriver URL within the test file to point to the below Sauce Labs URL. Be sure to plug in your Sauce Labs username and access key.

    public static final String URL = "https://" + SAUCE_USERNAME +":" + SAUCE_ACCESS_KEY +"";

Next, check that the desired capabilities for Appium are set correctly within the test file. Update or set the app capability:

  caps.setCapability("app", "storage:filename=<APP NAME AS IT APPEARS ON SAUCE STORAGE>");

Build Setup

With the configurations and test file ready, let's create a build and upload it to Sauce Labs for testing. Use the below script from the project's root, or follow the documentation to build your app and upload it manually.

  xcodebuild -configuration Debug \
           -scheme SCHEME HERE \
           -sdk iphoneos \
           -derivedDataPath "./DerivedData"
  mkdir Payload
  mkdir apps
  mv $APP_LOCATION/$ Payload
  zip -r $APP_NAME Payload
  rm -rf Payload/*
  curl -u "$SAUCE_USERNAME:$SAUCE_ACCESS_KEY" --location \
      --request POST '' \
      --form 'payload=@""' \
      --form 'name=$APP_NAME

  rm -rf apps
  rm -rf DerivedData

Run Tests

Make a call to the testing framework you're using to run your tests. You may add your testing command to the above script or create a new one.


This command will vary by the testing framework used.

The axeDevToolsUIKit.xcframework supports SauceLabs and Appium on a simulator or real device. Please see the SauceLabs documentation for instructions on how to get set up.


Are you using additional continuous integration tools? Sauce Labs supports testing within your current environment. Learn more about integration with your CI pipeline and Sauce Labs.


Once you've confirmed your configurations are set up correctly, you're ready to automate this process! We've included a script below to automatically build .ipa files for devices, upload them to Sauce Labs, and run your tests. Your team can also use this script to invoke a test run on Sauce Labs manually.

APP_NAME="App Name Here"

xcodebuild build-for-testing -configuration Debug \
                             -scheme "$APP_SCHEME" \
                             -target "$APP_UITEST_TARGET" \
                             -sdk iphoneos \
                             -derivedDataPath "./DerivedData"
mkdir Payload
mkdir apps
mv $APP_LOCATION/$ Payload
zip -r "apps/$APP_NAME.ipa" Payload
rm -rf Payload/*

zip -r "apps/${APP_NAME}UITests-Runner.ipa" Payload
rm -rf Payload

# call testing framework to run tests
./gradlew test