Research On Mobile Application Automation Testing Technology Based On Appium
Research On Mobile Application Automation Testing Technology Based On Appium
Authorized licensed use limited to: Escuela Superior de Ingeneria Mecanica. Downloaded on October 27,2022 at 15:48:34 UTC from IEEE Xplore. Restrictions apply.
testers to exhaust all the versions of devices and operating
systems to achieve full testing coverage. With limited time
and effort, we can achieve as much testing coverage as
possible from the perspective of input-output ratio. Because
most mobile applications support iOS and Android operating
systems, it is necessary to test mobile applications in both
iOS and Android systems. The version of the operating
system to be tested should cover the version of the operating
system used by the vast majority of current users. The
mobile devices tested should choose the tablets and mobile Figure 1. Appium supports iOS schematics
phones with high market share.
For Android testing, Appium server forwards the
C. Test contents of mobile applications received request to bootstrap.jar installed on the mobile
The following testings need to be done on mobile device. Bootstrap is responsible for monitoring Appium
applications. commands and calling UiAutomator on the mobile device to
1) user interface testing implement the operation. Finally, Bootstrap returns the
2) business function and process testing execution result to Appium server, and Appium server
3) performance testing returns the execution result to the client. Figure 2 is the
4) installation/uninstallation testing schematics for Appium supporting Android.
5) software upgrade testing
6) security testing
7) horizontal and vertical screen testing
Appium is mainly aimed at the automation of user
interface testing and business function and process testing.
III. APPIUM INTRODUCTION
A. Appium overview
Appium is an open source automation testing tool with
the following characteristics:
1) It is applicable to testing native, Web applications or
hybrid mobile applications [4]. Mobile native applications Figure 2. Appium supports Android schematics
refer to applications written in iOS or Android SDK. Mobile
Web applications refer to the applications accessed by
mobile browsers. Hybrid applications refer to native code IV. EXAMPLES OF APPIUM AUTOMATION TESTING FOR
encapsulating web views, native code interacting with Web ANDROID APPLICATIONS
contents.
2) Appium is a cross-platform testing framework, which A. Android overview
supports mobile application testing on iOS, Android and Android is a free and open source operating system
Firefox OS platforms. based on Linux. It is mainly used in mobile devices, such as
3) Appium test scripts can be written in Python, Ruby, C#, smartphones and tablets, led and developed by Google and
Java, Objective-C, JavaScript and other languages. Open Handset Alliance. The four major components of
B. Appium principle architecture Android development are Activity, Service, Broadcast
Receiver, Content Provider. Android applications are
Appium is a CS model tool that drives Android and iOS composed of various components that can be invoked
applications based on web driver protocols. For the testing separately. For example, a component can be a single
on iOS platform, Appium iOS encapsulates Apple's "Activity" that provides a view for the user interface, or a
Instruments framework, mainly uses UI Automation in "Service" that performs work independently in the
Instruments. Mobile devices are monitored by injecting background [5]. Activity is an application component that
bootstrap.js, bootstrap.js returns the execution results to provides an interface. Master Activity is the first object to
Appium server, and Appium server returns the results to start when the user taps on the application icon. Other
Appium client. Figure1 is the schematics for Appium components, such as broadcast receiver and service, support
supporting iOS. the application to perform background tasks without an
interface. “APK” is the suffix of Android application and the
abbreviation of Android Package, namely Android
installation package. It can be installed by transferring APK
files directly to an Android simulator or an Android real
device for execution.
248
Authorized licensed use limited to: Escuela Superior de Ingeneria Mecanica. Downloaded on October 27,2022 at 15:48:34 UTC from IEEE Xplore. Restrictions apply.
B. The setup of Appium automation testing environment device. If the device exists, it means that the connection
To test the Android application using Appium, the steps between the device and the computer is good. Then start
to set up the testing environment are as follows: Appium Desktop. The Appium Desktop startup view is
1) Set up Android development environment. When shown in Figure 3. On this view, just click the "Start Server"
configuring the Android development environment, the first button, and the Appium Server is started. Click the "Start
step is to get the ADT installation file online for installation. Inspector Session" button to start Appium Inspectorˈand
For example, adt-bundle-windows-x86_64-20140702.zip is fill in the correct platformName, appPackage, appActivity,
used for Windows 64-bit operating system. It provides many deviceName and noResearch information (as shown in
functions, which can control the mobile device and obtain Figure 4). Platform Name is Android; appPackage is the
various data of Android. After downloading and package name found by "aapt" command; appActivity is the
decompressing the installation file, system variables need to entry activity name found by "aapt" command. deviceName
be configured on the computer, for example, download and can be customized. If noReset is set to true, it means the data
decompress the file adt-bundle-windows-x86_64-201702.zip, is not clear when starting the App. Finally, click "Start
the system variable ANDROID_HOME needs to be added; Session" to start the App.
and %ANDROID_HOME%\tools, %ANDROID_HOME%\
build-tools\android-4.4W
and %ANDROID_HOME%\platform-tools need to be added
into the system variable "Path".
2) Install Appium Desktop. Appium Desktop is a
comprehensive tool embedded with Appium Server and
inspector. It can be downloaded and installed directly from
https://github.com/appium/appium-desktop/releases.
3) Install Appium Server. Appium Server is a core service
of Appium. It can receive requests and automate test
execution by manipulating mobile devices. The tool itself
can be installed independently. After the installation, the
command "appium" can be entered in the CMD window and
the port of 4723 is opened locally. This port is a small
service that receives requests from test scripts and automates
testing. If Appium Desktop is installed, the Appium Server
is already embedded. When Appium Desktop is started,
Appium Server is actually started in the background.
4) Install Appium Client. Appium Client is a client
encapsulation library in various languages for connecting to Figure 3. Appium Desktop Startup View
Appium Server. To run the test script successfully, Appium
Client needs to be installed, for example, to run the Python
script, a Python client needs to be installed to drive it locally.
When installing a Python client, you can go to
https://github.com/Appium/python-client to follow the
installation instructions.
C. Automating testing using Appium
After setting up the Appium test environment, we use
Appium to implement the automation testing of mobile
applications on Android platform as follows.
1) Get the App package name and the entry activity name.
App's package name and entry activity information can be
obtained through "aapt" command. The format of "aapt"
command is "aapt dump badging APK filename > log.txt". Figure 4. Appium Inspector Configuration View
Open the CMD window, run the command, put the output
information of the command into the file log.txt, and then 3) Use Appium Inspector to track App elements' properties.
search for "package" in log.txt to find the package name and When the App to be tested is started by Appium Inspector,
search for "launchable-activity" to find the entry activity the App page displayed on the mobile device will be
name. synchronized to the Appium Inspector view. Click on the
2) Start App with Appium. Firstly, install the App to be page element to be tracked, and the Source view of Appium
tested on Android mobile device, connect the mobile device Inspector will be displayed with the elementId, text,
to the computer, and open the settings that allow USB resource-id and other properties of the element, as shown in
debugging on the mobile device. Then, open the CMD Figure 5.
window and enter the command "adb devices" to view the
249
Authorized licensed use limited to: Escuela Superior de Ingeneria Mecanica. Downloaded on October 27,2022 at 15:48:34 UTC from IEEE Xplore. Restrictions apply.
window on the computer and run the command "python app
test.py" directly to drive the script execution. During the
execution of the script, you can see that a login scenario is
automatically completed on the mobile device.
250
Authorized licensed use limited to: Escuela Superior de Ingeneria Mecanica. Downloaded on October 27,2022 at 15:48:34 UTC from IEEE Xplore. Restrictions apply.