Appium is an open-source test automation tool developed and supported by Sauce Labs to automate native and hybrid mobile apps. It is basically known as a Cross-Platform Mobile Automation Tool.
Features of Appium
- Appium can run on a variety of devices and emulators making it an apt choice for mobile test automation.
- Automating hybrid and native mobile applications for Android and iOS is a key function handled by Appium, a node.js server.
- One of the main principles of Appium is that test codes can be written in any framework or language like Ruby on Rails, C#, and Java without having to modify the apps for automation purposes.
- Most of those tools require an extra agent that needs to be compiled with application code so that the tool can interact with the mobile app. In Appium, extra agents are not required. It removes the problem that the app which will be tested is not the same app which will be submitting in the App Store. We need to remove those automation agent libraries before submitting the app.
Appium Architecture
Appium is an HTTP server written in node.js which creates and handles multiple WebDriver sessions for different platforms like iOS and Android.
It is almost the same as the Selenium server which perceives HTTP requests from Selenium client libraries, and it handles those requests in different ways depending upon the platforms. Each vendor like iOS and Android has a different way and mechanism to run a test case on the device so Appium kind of hacks into it and runs this test case after listening commands from the Appium server.
Appium Advantages
- All the complexities come under the Appium server only and for an automation developer the programming language and the whole experience would remain the same irrespective of the platform he is automating (iOS or Android).
- Same test would work on multiple platforms.
- Appium doesn’t require you to include some extra agents in your app to make it automation friendly.
- It is developed and supported by Sauce Labs and it is getting picked really fast within the WebDriver community for mobile automation.
- It can automate Web, Hybrid and Native mobile applications.
Appium LimitationsWe can only run one instance on instruments per Mac OS so we can only run our iOS scripts on one device per mac machine. So, if we want to run our tests on multiple iOS devices at the same time then we would need to arrange the same number of Mac machines, which would be a costly affair.
But this limitation can be resolved if we execute our scripts in Sauce Lab’s mobile cloud which supports running scripts on multiple iOS simulators at the same time.
Prerequisite to use Appium
- Install the Java Development Kit
- Set Up Java Environment Variable Path
- Install Android SDK / ADB on Windows
- Install Android SDK Packages
- Set up Android Environment Variable
- Download and Install NodeJs
- Install Microsoft .net Framework
- Download and Install Appium Desktop Client
- Enabling Developer Mode Options on Android Phone or Tablet
- Set Up Appium Project – Add java client dependency for Appium
Run First Appium Test
- Launch Appium Node Server
- Click on Android icon to open the configuration of the Appium run.
- Select the check box of No Reset. This will ensure that the Appium will not install or uninstall App on every run.
- Click on General Setting icon and make sure that Server Address and Port is populated.
- Do not alter the IP address or port number. Appium console starts at 127.0.0.1:4723 as shown in below.
Click on the Launch Appium Node Server button on the top right corner of Appium window and wait for few seconds. Appium server started and running on your system.
Sample of basic code