Introduction
Mobile automation is the process of automating the testing of mobile applications. It helps to ensure that an app functions as intended and meets the desired quality standards before it is released to the public. One of the leading platforms for mobile automation is Appium, an open-source test automation tool for mobile applications.
The problem
One of the challenges that developers often face when using Appium is the inability to upgrade to the latest version of the Java Development Kit (JDK), specifically JDK 17, due to a bug in cglib. cglib is a Java library that enables the creation of dynamic proxies. It is used by Appium to create page objects, which are classes that represent the various screens and elements of a mobile app.
This bug appears when using the Page Factory to initialize a page object through the Appium decorator.
The issue has been reported in the Appium GitHub repository and can be a major hindrance for those who want to take advantage of the latest features and improvements offered by JDK 17.
The solution
Fortunately, there is a solution to this problem. By adding the following JVM argument
to your Surefire command line arguments:
You can resolve the issue with cglib and use Appium with JDK 17. This JVM argument tells the Java runtime to allow reflective access to non-exported packages, which is necessary for cglib to work with JDK 17.
To add this JVM argument in IntelliJ, you can either go to the Run Configuration and add it under the VM options field:
Or you can install the JVM Arguments Setter plugin. This plugin will automatically add the necessary JVM arguments to your project, saving you the hassle of manually adding them each time.
Happy testing!