Written By :Appsierra

Thu Sep 14 2023

5 min read

Appium Testing: The Complete Guide

Home >> Blogs >> Appium Testing: The Complete Guide
Appium Testing

What is Appium Testing?

Appium testing is referred to as automating native, mobile web, and hybrid applications on different operating systems and platforms like iOS, Android, Windows, etc.

  1. Native apps are the one, developed using iOS, Android or Windows SDKs.
  2. Mobile Web Apps are web applications, operated on mobile devices.
  3. Hybrid apps are the one with a native shell around them to enable interaction with the mobile browser embedded in the app.

With the increase in the number of devices, browsers and operating systems, it is very difficult to make the application compatible on various platforms. Appium architecture is used to write tests for automating apps on multiple platforms using the same API. The testers are required to write test only once and the same code can be used for cross-platform testing. These Appium tutorials will help you in starting the Appium mobile testing of your application.

Features of Appium Testing

1. With the aid of Appium, there is no need to modify the app individually for each platform. This is done by using vendor-provided frameworks.

Vendor provided frameworks used for Appium mobile testing are

  • Apple’s XCUITEST for iOS 9.3 and above
  • Apple’s UIAutomation for iOS 9.3 and lower
  • Google’s UIAutomator/UIAutomator2 and Espresso Driver for Android
  • Microsoft’s WinAppDriver for Windows
  • Mac Driver for Mac applications.
Features of Appium Testing
Features of Appium Testing

2. The tests can be written and executed in any language as per the tester’s preference. Appium follows the client-server protocol known as JSON wire protocol to run the test written in any programming language. In this client-server architecture, Appium acts as a webserver, that responds to the commands made by the client. Appium has a set of client libraries that can be used to write tests in any language.

The cloud services like Sauce Labs and Lambda Test can be used to receive and interpret the commands. These services provide test automation frameworks for implementing Appium testing. The client sent the desired capabilities of the application to the Appium server to specify what kind of session they want to start. Appium used the same WebDriver protocol as used by Selenium. Appium Server is written in Node.js and simple words an HTTP server. The client libraries supported by Appium are in Java, Ruby, Python, PHP, JavaScript and C#.

JSON Wire Protocol

This protocol provides a list of commands for communication between client and server. These commands can vary based on the driver used.

They also provide error files for defining a different kind of errors.

Features of Appium Testing
Features of Appium Testing

Installing Appium

Appium can be installed either on NPM or by downloading Appium desktop, which has a graphical user interface for running Appium Server. It is as easy as commanding ‘npm install -g appium’ and downloading from the release page on Appium website for installation using NPM and downloading respectively.

Prerequisites for Testing Mobile Web Apps

Various prerequisites for testing mobile web apps are given below:

Mobile Safari on iOS

The automation can be done on real devices or simulators available.

For Real Device

The web inspector on an iOS device should be turned on.

For Simulators

The developer mode in the Safari preference should be turned on to open the remote debugger port 

Chrome on Android

For Android also, the automation is possible on both real devices and emulators.

  • The chrome browser should be installed in the device or emulator used.
  • Chrome driver should also be installed. Appium does provide a default driver for automating on specific versions of Chrome browser installed on the device or emulator.

What Are Desired Capabilities?

Desired capabilities are the data provided by the client to the server, to start a new session. This data is encoded in the JSON object. It contains all the information that helps Appium to decide the kind of session will be appropriate for testing. It explains ‘what you expect to get evaluated in the test?’. Again, any programming language can be used for this purpose as ultimately it will be converted into a JSON object.

Examples of Capabilities

  • automationName: To explains the desired automation engine to be used.
  • platformName: To specify the Mobile OS for the test.
  • deviceName: To specify the emulator or mobile device to test the application on.
  • The path of the application is also specified.
  • browser name: To select the browser the application is desired to be automated on.

Many other capabilities can be provided before initiating the testing through Appium architecture.

Running Test App with Appium

Here is the running test app with Appium:

iOS

  • The first thing to make sure is that the Appium is working on your device.
  • There must be a local absolute path to the simulator, .app directory.
  • There should also be a zip file containing the .app package.
  • The remote session must be allowed to use the capabilities and connect to the server running host and port.

Android

  • Only one Android emulator is allowed to connect at a time during testing. This can be checked by running ‘ adb <devicename> ‘ and it will show the devices connected.
  • There are waits like ‘appWaitPackage’ and ‘appWaitActivity’, that can be applied to make Appium wait until some specified activity is not launched.
  • The remote session must be allowed to use the capabilities and connect to the server running host and port.

Windows

The only thing to make sure is the Appium is responding to the test requests on desired test runner.

Commands

Here are some commands:

  • Status: These commands are used to find out ‘if the server is ready to start a new session or not?’.
  • Execute Mobile commands are used to execute a variety of mobile command native to iOS or Android.
  • Create New Session: The server should decide the session type based on required capabilities rather than desired capabilities.
  • End: To end the currently running session.
  • Get Session Capabilities to get the capabilities of a session.
  • Go Back: To navigate the browser’s history in the backward direction.
  • Screenshot: To capture screenshot of the current window.

Appium is one of the test automation frameworks that provide a whole lot of commands for a specific client, libraries. Along with that it also provides the sample code directory that can act as Appium tutorials. Appium server tries it’s best to keep the platform secure as multiple clients are accessing it at the same time. It is the reason why enabling features request by Appium clients are not entertained via capabilities and it is done by the one who launches Appium Server. You can also connect with the Appium community for attaining help in getting started and during the test.

Also Read: Appium Testing Tutorial

Contact Us

Let our experts elevate your hiring journey. Message us and unlock potential. We'll be in touch.

Phone
blog
Get the latest
articles delivered to
your inbox

Our Popular Articles