Skip to end of metadata
Go to start of metadata

Appium is an open-source tool that can be used to automate your mobile applications. Just like the Selenium WebDriver - which is an open-source tool used to automate web browsers - Appium is an automation library used to drive your mobile applications, and even the web browser within the mobile simulator, emulator or real device.

Advantages of Using Appium

  • You can write tests against multiple mobile platforms using the same API
  • You can write and run your tests using any language or test framework
  • It's an open-source tool that you can easily contribute to

Advantages of Using Appium on Sauce Labs

  • You save the time it takes to set up the Appium server locally
  • You don't have to install/configure the mobile emulators/simulators in your local environment
  • You don't have to make any modifications to the source code of your application
  • You can start scaling your tests instantly

For an in-depth explanation of what Appium is, how it works, and the various technologies behind it, check out the official Appium Documentation.

How Appium Works on Sauce Labs

The driver address in you test script is what points the test to the Sauce Labs cloud, for example http://SAUCE_USERNAME:SAUCE_ACCESS_KEY@ondemand.saucelabs.com:80/wd/hub. Once you execute the test using the test framework of your choice, Sauce Labs initializes its own Appium server using the specifications taken from your desired capabilities. What happens after that depends on the type of mobile platform you're testing against. 

iOS Tests

After the mobile application is initialized, the Appium server takes the driver commands in your test script, which are in a WebDriver JSON Wire Protocol format, and converts them into UIAutomation JavaScript commands that can be understood by Apple Instruments. These commands, once converted, are sent to your iOS mobile application via Apple Instruments, which executes the commands against your mobile application in the simulator/device.

The responses from your mobile application are received by Apple Instruments, sent to UIAutomation, and relayed to the Appium server in the Sauce Labs cloud. The Appium server then converts the UIAutomation JavaScript responses back into WebDriver JSON Wire Protocol format, and sends the JSON responses to your test script.

Android Tests

After the mobile application is initialized, the Appium server receives your test script commands and launches your mobile application in the emulator/device that you've specified. Appium then takes the driver commands in your test script, which are in a WebDriver JSON Wire Protocol format, and converts them into UIAutomator Java commands. UIAutomator is the library provided by Google as part of the Android SDK, and is also the library that Appium uses to automate your Android mobile application tests.

In the case where you are connecting to the Selendroid automation backend, Appium simply proxies all requests to the Selendroid server running on the emulator/device.

The response from your mobile application are received by UIAutomator and relayed to the Appium server in the Sauce Labs cloud. The Appium server then converts the UIAutomator Java responses back into WebDriver JSON Wire Protocol format, and send the JSON responses back to your test script.

Appium hides all of this complexity from your test script. Your test script thinks it's communicating with your mobile application, but in reality it is communicating with Appium's implementation of the WebDriver API. The fact that Appium is running your mobile application in the appropriate simulator, emulator or device, and wrapping up all of the communications with your mobile application, including the command conversions, remains completely hidden, and your test script is none the wiser.

Appium Resources

For more information, feel free to visit the resources listed below: