Mobile automation: Run Appium tests on Sauce Labs

Problem: Maintaining infrastructure for testing your mobile applications on different platforms and browser versions is time consuming.

Why this post?

This post was written for the hands on tester looking to explore different tools testers can use for mobile automation. In this post we will show you how to run your Appium tests on Sauce Labs. We estimate that you need about one hour to try this post on your own. We will start with the test we wrote in a previous post, titled GET STARTED WITH MOBILE AUTOMATION: APPIUM & PYTHON, and modify the test script so it runs on Sauce Labs.

NOTE: Sauce Labs offers a limited free plan for individuals. I recommend that testers take them up on the deal use it to get started. Knowing an extra tool is always useful.


Getting started with Appium on Sauce Labs

1. Sign up for a Sauce Labs Account
2. Get your user name and access key
3. Create a test for the app you want to test
4. Update the method to include access key
4. Run the test
5. Check the result

STEP 1: Sign up for a Sauce Labs account.
You can sign up for a free Sauce Labs account, where you get 2 hours of automated testing hours per month on all desktop & mobile browsers

STEP 2: Get your user name and access key.Your access key is listed on this page: https://saucelabs.com/account. Currently its in the bottom left corner. We will be using this access key in combination with your username to interact with Sauce Labs.

STEP 3: Create a test for the app you want to test
We will use the same chess app used in our previous post for our test. You can refer to our previous post to create test case for the chess app. Make sure you have Appium Python Client installed

STEP 4: Update the method to include access key
Update the setUp method to include the username and access key to run your test on sauce Labs

def setUp(self):
        "Setup for the test"
         # Using the apk link directly to launch the app
        app = "http://file.appsapk.com/wp-content/uploads/apps-3/Chess%20Free.apk"
        self.driver = webdriver.Remote(
            command_executor='http://$USERNAME:[email protected]:80/wd/hub',
            desired_capabilities={
                'platformName': 'Android',
                'deviceName': 'Android Emulator',
                'platformVersion': '4.2',
                'app': app,
                'name': 'Appium Python Android Test for Chess App',
                'appPackage': 'uk.co.aifactory.chessfree',
                'appActivity': '.ChessFreeActivity'
            })

STEP 5: Run the test
You can run the test script the normal way you do. We run it via the command prompt.

Run Appium test on sauce

STEP 6: Check the result
You can see the results on your web account. Login to your Sauce Labs account and you should see a result table like the screen shot below.

Sauce Result

Sauce Detail result


And there it is. You learnt how to run Appium tests on Sauce Labs by adding about a dozen lines of Python code to your existing tests.

P.S.: You can use this earlier tutorial to figure out how to parameterize your test to have it run on different browsers.


Subscribe to our weekly Newsletter


View a sample



One thought on “%1$s”

Leave a Reply

Your email address will not be published. Required fields are marked *