Appium on Real Devices – Appium FAQ

Bitbar, the mobile devops company. Logo, large

appiumMobile_345x180

Appium is a mobile UI testing framework supporting cross-platform testing of native, hybrid and mobile-web apps for iOS and Android. Appium enables you to execute your tests on mobile device irrespective of the device OS. This is because the framework is basically a wrapper that translates Selenium Webdriver commands into UIAutomation (iOS) or UIAutomator (Android) commands depending on the device type.

Download This Appium Beginner’s Guide to Learn All the Basics and How to Set Up your Appium Testing Environment

What languages can I use to write the TestScripts?
You can write TestScripts in any language that Selenium WebDriver dependency is available for. This includes C#, Closure, Java, JavaScript with Node.js, Obj-C, Perl, Python, Ruby.

Do I need to care about the Appium Server depending on the language I wrote my tests with?
No, the server is exactly the same irrespective of the scripting language. This is because the TestScript implements the Selenium WebDriver and communicates with Appium Server via JSON Wire Protocol (a standardised JSON over HTTP protocol).

Where would the Appium server be running?
A great advantage of using Appium is the HTTP communication (see the question above) between TestScript and Appium Server, allowing the server to be running on a separate machine than the TestScript. This allows us to take care of the Appium server side and the devices to be maintained at the Cloud, while you can run your TestScripts locally from your machine.

How is running Appium different than other frameworks available at Testdroid Cloud?
Appium TestScripts are “Live”. This means that you do not upload the TestScript along with your app to the Cloud. Instead, you instigate the script locally from your own machine, and on receiving a request, the Cloud reserves the requested device and creates an Appium session for it.

Can I use the same TestScript for both my iOS and Android apps?
Although the TestScripts will be written in the same language, and will be almost similar, you would still need to prepare separate TestScripts for iOS and Android, or at least two flavours of the TestScript. This is because of the differences in UI elements on the two platforms. Sometimes the difference is as subtle as having to use different array indices.

Moving from your localhost to Testdroid Cloud

If you have been using Appium at your localhost on a real device, switching to Testdroid Cloud is fairly easy. All you need to do is make two changes in your TestScript. If you haven’t been, heres a little introduction how Appium works. You start Appium Server instance on you machine while specifying a connected device’s UDID.

$ appium --port 4723 -U

Next, you instigate your TestScript implementing the Selenium  WebDriver connecting to the Appium Server at http://localhost:4723/wd/hub

Screen Shot 2014-03-10 at 11.17.18

Note that one Appium instance handles only one test session at a time. If you want to test your Android application on multiple devices, you can connect multiple Android devices to your machine, start multiple Appium instances on different ports with different UDIDs, and instigate multiple TestScripts pointing to different ports. Unfortunately however, you cannot do the same for iOS. This is because Appium uses native Instrumentation to communicate with the device, and Instrumentation allows only one device at a time.

At Testdroid Cloud however, you can use over 300+ different Android and iOS devices simultaneously. That’s an awesome platform for testing.

Screen Shot 2014-03-10 at 11.14.25

If you have been using Appium at your localhost on a real device, switching to Testdroid Cloud is fairly easy. All you need to do is make two changes in your TestScript.

→ Change the Remote WebDriver address from ‘localhost:port’ and point it to Testdroid Cloud.
→ Add ‘testdroid_’ Desired Capabilities in addition to the existing Desired Capabilities in your TestScript.

Running your first Appium test on Testdroid Cloud

1. Upload your application (.apk or .ipa) to Testdroid Cloud, or host it yourself a on public URI.

You can use a plain HTTP address like ‘http://domain.com/files/myApp.ipa’ for us to download your application from, or you can upload the application to Testdroid Cloud via command line.

Upload Request:

POST: http://appium.testdroid.com/upload
Authentication: Basic-Auth
Multipart: True
Parameter Name: any
Parameter Value: Application File (.ipa/.apk)

Example using Curl:

curl -s --user username@example.com:pas$w0rd  -F myFile=@"/Users/username/Documents/BitbarIOSSample.ipa" "http://appium.testdroid.com/upload"

Response:

You’ll receive a JSON in response to the upload request with a Session-ID pointing to your uploaded application on Testdroid Cloud. Save the Session-ID for later use.

“myFile”: “4e31cede-5741-484c-b58d-8a6d04bc03d5/BitbarIOSSample.ipa“.

2. Select a device

Log into cloud.testdroid.com, select a device you want to run your test on, and copy its name. For example ‘iPhone 5c 7.0.4 A1532‘.

Untitled presentation (1)

3. Add the ‘testdroid_’ Desired Capabilities.

In addition to the standard Desired Capabalities you have in your TestScript (for example, the minimum required Caps for iOS are shown in the figure below)

Untitled presentation (6)

Add ‘testdroid_’ Desired Capabilities in addition to these Capabilities.

Blog diagrams (1)

4. Point the WebDriver to http://appium.testdroid.com/wd/hub

Untitled presentation (4)

5. Run the TestScript

6. Get results from Web UI

Untitled presentation (5)

and Appium.log from the Web UI

More detailed information about Appium setup can be found here.


The Beginner’s Guide of Using Appium for Mobile App Testing

Learn all the basics about Appium, how to set it up and how to use it for mobile app testing.

Download

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close