The developers of Appium must have gotten something right as they were able to gain 35% of the testing market share in a world where proven tools like Selenium have existed for a long time. This feat was achieved in a mere 9 years after Appium 1.0 was released in 2014. However, it is also a fact that the mobile world has moved on rapidly in these past nine years. It has revolutionized and modernized itself keeping the end-user in focus of its evolution. Appium, as far as it could match the pace of mobile development, kept releasing new features and capabilities until 2022 when they knew that at this point things would get highly complex on the same codebase. Hence, a change in the foundational structure was required to keep up for the next five or ten years and this is where Appium 2.0 was born – a simple, effective, and modern successor for quality mobile testing.
What is Appium 2.0?
Appium is a popular mobile application automation testing tool working on native, hybrid, and mobile web applications. Holding more than 17.4k stars on its GitHub repository, this open-source tool uses Webdriver to conduct automation tests smoothly. While it has been going strong in 2023 as well, Appium has started to suffer because of its 10-year-old architecture that can make things complex even for simpler situations based on testing scenarios.
Since the process of conducting the automation tests has largely been the same, its underlying functionality or supporting resources are what needed an upgrade. This is what motivated the developers to work on Appium 2.0 and leave out support for Appium 1.0 permanently. The new upgrade also makes building and sharing various code projects easier and faster to enhance collaboration, something that works as a life-support for an open-source project. This also eliminates the dependence on the core development team for each plugin which was a pain point in Appium 1.0.
In a nutshell, Appium 2.0 is Appium 1.0 but without deprecated features, and functionalities, and accommodates changes that focus more on how things are done rather than what extra it can do.
Features of Appium 2.0
To understand the need for Appium 2.0, let’s highlight the new features in brief.
DRIVER INSTALLATION
Appium 1.0 would install all the available drivers at the time of installation of the Appium server. This functionality was included even if the drivers would not be required by the testers. With Appium 2.0, the tester now has the choice of installing the drivers along with the Appium server or installing just the server with
npm i -g appium
These drivers are also installed at the APPIUM_HOME environment variable now giving flexibility to the tester for choosing the most optimum location for the same. This was earlier set to the same location as the location of the Appium server installation. This makes both of them independent entities, an effect which can also be seen while updating the drivers. Unlike Appium 1.0, testers need not wait for a new release version of Appium to update the drivers. The update can be done separately and the drivers can be updated in isolation to Appium starting 2.0.
All these functionalities incline towards providing flexibility to the testers.
Protocol deprecation
A major shift in protocol usage is seen in Appium 2.0. In this upgraded version, the support for JSONWP (JSON Wire Protocol) and MJSONWP (Mobile JSON Wire Protocol) is removed. These were two options used for both Selenium and Appium. From Appium 2.0, the testers will use only W3C WebDriver protocol which is what Appium is based on and is the industry standard today.
Richer plugin system
The plugin system of Appium’s latest version is now deeper with the inclusion of non-core features. These features that were part of the library previously are now consolidated separately into the plugin. For instance, image-related features such as image analysis are part of plugin images. This helps create a clear distinction for the core code and the tester needs to get only what they want.
Options to customize
Appium 2.0 offer the flexibility to the testers to set and develop things as they wish to work. Now the testers can develop their own server plugins that can change the core command functionalities as well. Similarly, the developers can develop their own drivers and download third-party drivers as well from package managers or Git.
Configuration file support
Appium 2.0 extends its support to the configuration files, something that was limited to just command line arguments up until Appium 1.0. For instance, a simple configuration file targeting servers and instructing the plugins to use is as follows:
{
"server": {
"use-plugins": ["my-plugin", "some-other-plugin"]
}
}
Currently, Appium 2.0 supports JSON, YAML, and JS configurational files format.
Apart from these major functionalities (and modifications), Appium 2.0 also introduces other major changes such as removing port 0 for use and removing the WD client library.
Migrating from Appium 1.0 to Appium 2.0
Appium’s latest version has brought a few changes as discussed in the previous section. However, the installation process is mostly kept the same except for a few modifications which are easy to learn and grab. This makes migrating from Appium 1.0 to Appium 2.0 a quick job.
To install Appium 2.0, the tester needs to execute this command:
npm i --location=global appium
This command will ensure that Appium is installed as a global entity and therefore can be accessed from any directory through the terminal. To verify the installation, execute the following command:
appium
If it is installed, the following output will be seen:
[Appium] Welcome to Appium v2.0.0
As discussed, Appium 2.0’s major feature is the separation between the drivers and the server. They will now be seen and handled as separate units. Therefore, the above command will not install any driver as it would do on Appium 1.0. The driver can be installed through separate commands as follows:
appium driver install uiautomator2
This command will install the UiAutomator2 driver. However, this is not enough to start writing any test cases. UiAutomator2 driver requires a few prerequisites as follows:
- Android Studio.
- Android platforms downloaded through Android SDK.
- Java JDK
- Properly set up environment variables.
The successful installation of the driver will produce the following output:
Attempting to find and install driver ‘uiautomator2’
✔ Installing ‘uiautomator2’ using NPM install spec ‘appium-uiautomator2-driver’
Driver uiautomator2@2.0.5 successfully installed
– automationName: UiAutomator2
– platformNames: [“Android”]
Similarly, XCUITest can be installed as
appium driver install xcuitest
Along with drivers, plugins too are separated and made more flexible to enhance collaboration and minimize the dependency on the core Appium team. Any plugin can be installed through the following syntax:
appium plugin install <plugin_name>
For example
appium plugin install images
This command should install the “images” plugin.
This is all we need to know! Once everything is completely downloaded, installed, and set up, the testers can start testing right away!
Using Appium 2.0 on TestGrid
While Appium 2.0 has modified itself to walk shoulder to shoulder with recent technological advancements, an organization may still go through the same discussion while adopting it in its projects. How can we acquire so many real devices? What would happen when new devices are rolled out? Should we test locally? What type of resources would we want in the local systems? And so on. The problem is that while Appium is capable of testing devices efficiently, it needs resources to do so. This is not a feasible option for most organizations and this is the reason we turn towards pocket-friendly capable alternatives.
TestGrid is an automation testing tool that provides real devices to perform various types of testing. This includes manual testing, visual testing, as well as automation testing through Appium. The integration of Appium in TestGrid allows it to bridge the gap for testing on mobile devices while keeping the whole infrastructure on the cloud. To get started, a tester needs to follow these steps:
First, the tester needs to create a free account on the platform. Once done, sign in to land on your dashboard and select “Real Device Cloud” from the left panel:
This option will list down all the devices available for testing. Choose the most appropriate one from the list:
Select the OS icon (such as Apple in the selected device) to open various information required for testing. This includes the Appium URL and Appium port that help the test cases connect to the correct device:
Make use of this information and other organizations’ information to set the values of following variables:
TG_DEVICE_URL
TG_DEVICE_NAME
TG_DEVICE_UDID
TG_DEVICE_PLATFORMNAME
TG_DEVICE_PLATFORMVERSION
TG_DEVICE_SYSTEM_PORT (Android) *
TG_WDA_PORT (iOS) *
TG_USER_TOKEN
Now all we need is the user’s personal information such as a token to connect the test cases to a particular user and organize them accordingly. For this, go to Dashboard->Test Runs
From the left panel, select “TestCase Writer”:
On the next screen, select the OS under “Versions” and then click on the “i” button available on the right side:
This will open up all the personal information that a tester may require for connecting their Appium 2.0 tests to TestGrid:
That’s it! Now just execute the Appium tests on the local device and they will start running on the robust cloud infrastructure of TestGrid. Testers can also make use of Appium Inspector on the platform for a better debugging experience through locators and other such identifications.
Conclusion
Appium has been one of the primary choices for people who need to run automation tests on mobile devices. However, the underlying mechanics of Appium did not change since its inception till 2022. Such a foundation started giving issues when other aspects of mobile automation started setting standards and opening more doors to the open community. Things had to change for the better and this is when Appium 2.0 was thought of, worked on, and released in 2022.
Appium 2.0 tries to bring more flexibility to the testers, and third-party developers while keeping its core separate from all dynamic entities. This arrangement provides greater strength to the automation framework and makes it more adaptable to the changes in the project (or different projects altogether). This post discusses the aspects of Appium 2.0 and keeps drawing lines and comparisons with its previous version wherever possible. It helps understand why Appium 2.0 was born and its relevance in the current scenario. With this, we hope that this small guide will help you get started with Appium 2.0 and experience testing on real devices over the cloud without spending any penny.
Frequently Asked Questions (FAQ)
What is the vendor prefix in Appium?
A vendor prefix is an Appium capability entity written as follows:
<vendor>:<capability_name>
This is a part of the W3C protocol and therefore must be used when working with capabilities in Appium 2.0.
Is Appium 2.0 officially released?
Yes, Appium 2.0 has been released and is now the recommended version for use by the Appium team. The previous version is now no longer maintained.
Is Appium manual or automation?
Appium is an automation testing framework primarily used for mobile app testing in native, hybrid, or web formats.
Should Appium be used on local machines only?
No, Appium need not be used on local machines only. On the contrary, local use is not recommended for production because local resources lack many elements such as fast servers and real devices. Companies such as TestGrid provide a cloud-based setup where they take care of all the resource-related stuff leaving just the testing part for the testers.