Getting Started with Appium
Getting Started with Appium
Appium is an open-source, cross-platform tool for automating mobile app testing. If your team has existing Appium tests, they can be integrated with HeadSpin and run on any HeadSpin device you have access to. Using Appium Desktop you can inspect the view hierarchy of an application, determine the selectors, and even generate scaffold Appium code.
Note: The API calls in this guide will be expressed as cURL commands for ease of readability cross-platform and independent of programming language.
Automation Configuration API
The HeadSpin Automation Configuration API provides you with the optimal minimum Desired Capabilities to use for a given device and the WebDriver URL. To recap, Desired Capabilities tell Appium how you want your test to work. They are represented as keys and associated values encoded in a JSON object and sent by the Appium client to the Appium server.
This is an example response:
The <code class="dcode">capabilities</code> object will have the values for your Desired Capabilities. The <code class="dcode">driver_url</code> will be the remote WebDriver you will use in your test.
Launching your application
In addition, the the minimum Desired Capabilies, the last remaining item to specify is the app you want to test.
For a given Android application you will need to specify the <code class="dcode">appPackage</code> and <code class="dcode">appActivity</code> you would like to launch. The appPackage is the Android app that you want to run and the <code class="dcode">appActivity</code> is the specific activity within the Android app package you would like to launch.
If you have the project source of your app, you can acertain these values from taking a look at the AndroidManifest.xml in Android Studio.
The starting <code class="dcode"><manifest></code> tag includes the <code class="dcode">appPackage</code> name and the <code class="dcode"><activity></code> tags show the activities of your app.
In the event where you don't have project source, you can determine this via <code class="dcode">adb.</code> If you install your app on your HeadSpin Device, launch it, and then use <code class="dcode">adb shell</code> either via the HeadSpin Remote ADB or REST API, you can run:
This will return the information in the following format: <code class="dcode">(appPackage/appActivity)</code>
For iOS you will need to specify the bundleId of the application. If you have .xcodeproj or .xcworkspace source then you can determine this from the General section in the Project Information section in Xcode:
In the event where you don't have project source, you can determine this from the iOS REST API to retrieve a list of installed apps on a given device. Please refer to the iOS Device API guide.
Examples in Appium Client Languages
The reference code snippets below provide a visual reference to how the desired capabilities and remote driver URL syntax appear in different Appium Client languages.
HeadSpin Appium Capabilities
HeadSpin also provides a set of convenient Appium Capabilities for using certain platform features such as Performance Sessions or setting a specific Appium Server version for example. The full listing of capabilities can be found in the HeadSpin Appium Capabilities document.