Appium 2.0: A Deep Dive into the Next Generation of Mobile Automation Framework
Appium is an open source, cross-platform automation testing tool for running scripts and testing native, mobile-web and hybrid applications on Android or iOS using a webdriver.
History
Appium was originally developed in 2011 by Dan Kueller under the name “iOSAuto”, written in the C# programming language. The program became open source in August 2012 under the Apache 2.0 license. In January 2013, Sauce Labs pledged financial support for Appium’s development and facilitated the migration of its codebase to Node.
The Appium framework aims to bring together different automation technologies, making them easily accessible through popular programming languages like Java, Python, Ruby, C#, and Javascript.
Appium® 2.0
Appium® released its latest version after 5 years. These modifications will not have a direct impact on the behavior of automation. In Latest Appium® 2.0 (beta) “drivers” and “plugins” can be easily created and shared independently.
Appium Server GUI VS Appium Inspector
Appium Desktop is an app for Mac, Windows, and Linux which gives you the power of the Appium automation server in a beautiful and flexible UI.
The Current Appium Desktop is still available but now release in two separate packages:
- Appium Server GUI (You can set options, start/stop server, see logs)
- Appium Inspector (You can use to inspect application locators and also perform basic interactions)
How to Install Appium 2.0 Server?
Open Command Prompt / Terminal and Run the command:
Appium® 2.0 beta version can be installed using the below command:
> npm install -g appium@next
If you encounter errors, try updating Node and attempt the process again; it should resolve the issue.
⚠ The minimum node version required for the Appium to run is node 12.
> appium -v
2.0.0-beta.71
Appium server can take up several optional arguments. In addition to the server arguments, Appium 2.0 introduces new arguments:
- In a Terminal Window we can run the Appium Server with the command
> appium
- -a to specify an IP Address to listen on
> appium -a 127.0.0.1 (Default 0.0.0.0)
- -p to specify Port to listen on
> appium -p 4723 (Default 4723)
- — allow-cors to Turn on CORS compatibility mode
> appium — allow-cors (Default false)
- -ka to specify the number of seconds the Appium® server should apply as both the keep-alive timeout and the connection timeout for all requests.
> appium server -ka 800 (Default 600 Seconds)
- -ah to specify a directory to install Appium drivers
> appium server -ah /path/to/install/drivers driver install uiautomator2 (No default path)
Explore New / Improved Features
Let's Discover Enhanced Features and Key Objectives of this Significant Framework Update, Empowering Your Mobile App Testing Journey
Decoupled Drivers
Appium drivers (UIAutomator2 driver, XCUITest driver, Espresso Driver, etc) are tightly coupled with Appium Server but from Appium 2.0 these drivers are separated from Appium Server and can be installed separately based on users’ needs. Creating custom drivers for any new platform or special use cases are going to be easy from Appium 2.0.
> appium driver list
> appium driver install <drivername>
> appium driver install uiautomator2
> appium driver list --installed
Plugins
Appium plugins are here to help with the various use cases that require a change to Appium’s default behavior.
- Plugins add arbitrary functionality that executes before or after the actual appium commands
- Plugins alter the Appium server to introduce new commands and distribute them.
There are already official Appium plugins created by the project, as well as community-created Appium plugins.
Some Examples are: Find Element by Image API or the Appium + Test AI Classifier.
To install the plugins, run the following command to get a list of the available plugins and then install any of them:
> appium plugin list
> appium plugin install <pluginname>
> appium plugin install images
> appium plugin list --installed
Summary
All we talked about in this article was installing Appium 2.0 and using the driver Command-Line. But there’s a lot more to Appium 2.0! In future articles we’ll look at some of the breaking changes that are coming, and most importantly how to leverage the plugin Command-Line
A lot of new plugins are expected to come soon. The ability to easily create new drivers and plugins in Appium 2.0 will help solve many interesting use cases and problems that were hard to solve before