Join the webinar on ‘Demystifying Audiovisual (AV) Experience Testing Using AI’ on Aug 6th.
close

Upgrade Seamlessly with Appium 2.0 Tools

Ensure a smooth transition to Appium 2.0 with managed server and driver installations.
Appium 2.0 Migration PlaybookAppium 2.0 Migration Playbook

Appium 2.0 Migration Playbook

August 18, 2023
 by 
Rohan SinghRohan Singh
Rohan Singh

Overview of Appium 2.0

Appium 2.0 represents a significant evolution in the Appium framework, bringing new features and improvements designed to enhance the testing experience for mobile and web applications. This version focuses on modularity, allowing users to install only the necessary components, making the setup more lightweight and customizable. Additionally, Appium 2.0 emphasizes improved plugin support, enabling developers to extend and enhance Appium’s capabilities to fit their testing requirements better.

Getting Started with Appium 2.0

Appium 2.0 is the latest major release of the popular open-source automation framework for mobile applications. This version builds on its predecessors while introducing new features designed to improve the testing experience. Here are some key benefits of getting started with Appium 2.0:

Modularity and Customization

Appium 2.0 embraces a modular architecture, allowing users to install only the necessary components. This modularity ensures a leaner, more efficient setup by enabling users to customize their installation with specific drivers and plugins tailored to their testing needs.

Enhanced Plugin Support

The new plugin system in Appium 2.0 offers greater flexibility and extensibility. Developers can create and use plugins to modify server behavior, add new commands, or integrate with other tools. This feature allows for a highly customizable testing environment.

Improved Performance and Stability

Appium 2.0 includes several performance optimizations that lead to faster test execution and more efficient resource utilization. Improved stability and reliability ensure smoother test runs, reducing the likelihood of flaky tests and unexpected failures.

Backward Compatibility

Despite the significant changes and improvements, Appium 2.0 maintains backward compatibility with Appium 1.x scripts. This ensures that existing users can transition to the new version without needing to rewrite their test scripts.

Updated and New Drivers

Appium 2.0 has updated versions of existing drivers, such as UIAutomator2 for Android and XCUITest for iOS, providing better compatibility and performance. Additionally, new drivers are introduced, expanding the range of supported platforms and devices.

What is New in Appium 2.0

Appium 2.0 introduces several notable enhancements:

Modular Architecture

The new modular architecture allows for selective installation of drivers and plugins, reducing the bloat and enabling a more streamlined setup.

Enhanced Plugin Support

Plugins in Appium 2.0 can now modify server behavior and add new commands, providing greater flexibility and customization for testing needs.

Improved Performance

Appium 2.0 includes performance optimizations that result in faster test execution and more efficient resource utilization.

Better Error Handling and Logging

Enhanced error handling and logging mechanisms make it easier to diagnose and troubleshoot issues during test execution.

Updated Drivers

Many existing drivers have been updated for better compatibility and performance, including the XCUITest and UIAutomator2 drivers.

Backward Compatibility

Appium 2.0 maintains backward compatibility with Appium 1.x scripts, ensuring a smooth transition for existing users.

Appium 2.0 has finally been released! HeadSpin has been a proud supporter of Appium, and we are so excited to show you how to install the latest version of Appium and start using it in your existing scripts.

In order to get started on Appium version 2.0 on HeadSpin, please reach out to helpdesk@headspin.io, and we will install Appium 2.0 on each of your devices.

For local testing, we will need to do a new install.

Installing Appium 2.0

Appium 2.0 is now the default that can be installed through NPM:


npm i --g appium

This will install Appium globally so it can be run from anywhere in your command line . You can start the Appium server with the following command:


appium

You should see some output that starts with a line like this:


rohan@Rohans-MacBook-Pro-14 appium_2 % appium
[Appium] Welcome to Appium v2.0.1 (REV 0ccd099bff8e384043883c4ae01b589794b13d72)
[Appium] Appium REST http interface listener started on http://0.0.0.0:4723
[Appium] You can provide the following URLS in your client code to connect to this server:
[Appium] 	http://127.0.0.1:4723/ (only accessible from the same host)
[Appium] 	http://192.168.0.62:4723/
[Appium] No drivers have been installed in /Users/rohan/.appium. Use the "appium driver" command to install the one(s) you want to use.
[Appium] No plugins have been installed. Use the "appium plugin" command to install the one(s) you want to use.

Install Appium version 2.0 Drivers

As can be seen, the Appium server is up and running. Appium 2.0 has a major architectural change where it uses drivers to interact with a range of devices and browsers. In addition, there are plugins to enable more advanced features.

This greatly simplifies the complexity of Appium and allows the community to contribute easily.

Let’s go ahead and install the Android UIAutomator2 and iOS XCUITest drivers


appium driver install uiautomator2
appium driver install xcuitest

You should get two successfully installed messages


✔ Installing 'uiautomator2' using NPM install spec 'appium-uiautomator2-driver'
ℹ Driver uiautomator2@2.29.4 successfully installed
- automationName: UiAutomator2
- platformNames: ["Android"]

✔ Installing 'xcuitest' using NPM install spec 'appium-xcuitest-driver'
ℹ Driver xcuitest@4.33.2 successfully installed
- automationName: XCUITest

Porting existing scripts

A major change in Appium 2.0 is that instead of the /wd/hub base path, now it is just /.

This can be changed when instantiating the webdriver request or changed on loading the Appium server with the following command:


appium --base-path=/wd/hub

Using Appium Inspector

Appium Desktop has been deprecated and now the inspector functionality will move to Appium Inspector. It can be downloaded from:

appium/appium-inspector: A GUI inspector for mobile apps and more, powered by a (separately installed) Appium server (github.com)

Or even used in the browser version at https://inspector.appiumpro.com. In order to use this on a local Appium server, please start the server with the --allow-cors flag.

Lastly you can use HeadSpin’s integrated inspector.

HeadSpin inspector integration

Using Appium 2.0 on HeadSpin

Since HeadSpin manages the Appium server and driver installations for you, the migration to Appium version 2.0 is seamless. However, there are still a few updates you’ll want to make to your capabilities, to ensure a smooth transition.

First we can check which versions of Appium are available on each server with the following command:


curl -X GET https://{ headspin-host }:{ headspin-port }/v0/{your-api-token}/wd/hub/versions

This data can be obtained from the UI as follows:

Device Lists

Click on the three dots next to the device under test and click ‘Automation Configuration’

Device configuration

Then take the Web Driver URL append /versions to the end. Eg:


curl -X GET "https://dev-au-mel-1.headspin.io:7024/v0/4707c0d8da834821b6862bdd7185c039/wd/hub/versions"
{"status": 0, "value": {"default": "1.22.3", "available": ["2.0.0", "1.21.0", "1.20.2", "1.22.1", "1.22.0", "1.22.3", "1.22.2"], "drivers": {"default": {"uiautomator2": "2.29.1"}}, "plugins": {"default": {}}}, "session_id": null}

(If your host doesn’t have any Appium 2 servers or plugins available, or if you need a specific version, get in touch with your HeadSpin support contact or helpdesk@headspin.io, and we’ll get things sorted out for you.)

To use the desired version of Appium with plugins, please add the following capability to your Appium script:


{
    "headspin:appiumOptions": {
        "version": "2.0.0",
        "plugins": ["images", "relaxed-caps"]
    }
}

You can also just change the version or plugins with the following capabilities:


headspin:appiumVersion
headspin:appiumPlugins
Share this

Appium 2.0 Migration Playbook

4 Parts

Close

Perfect Digital Experiences with Data Science Capabilities

Utilize HeadSpin's advanced capabilities to proactively improve performance and launch apps with confidence
popup image