iOS mobile application automation testing using Appium

CodeStax.Ai
4 min readJun 9, 2022

--

Introduction

Mobile automation, as the name suggests, refers to ‘automation’ that is done on mobile devices. Automation is the process whereby one automates testing of an application — in this case a mobile application.

What is Appium?

Appium is the most popular open-source framework for mobile app automation testing. It allows QAs to automate tests in popular mobile platforms like Android, iOS, and Windows. Appium uses the mobile JSON wire protocol (an extension of Selenium JSON wire protocol) to drive native, mobile web and hybrid applications. The Appium server is scripted in Node.js and is compatible with leading client libraries like Java, Python, Ruby, PHP, and a few others. Refer to the complete list of supported client libraries listed on the Appium official site.

Why do we need Appium?

Let’s assume that an app developer has developed a basic mobile application. The developer installs the app on the available Android or iOS device and runs a quick manual test. Now the developer starts developing the next big feature for the app. Once a new feature is developed, it needs to be tested parallelly to ensure everything works well.

With every new feature, thorough testing is a must. However, manually testing the mobile app on both iOS and Android devices is extremely inefficient and resource intensive. In such a case, teams can use Appium to automate tests for mobile apps on both iOS and Android platforms. The Appium server differentiates the tests based on the platform defined in the Desired Capabilities, a set of key-value pairs used to define the desired test environment in both Appium and Selenium.

Pre-requisites

  1. Java Application: JDK (Java SE Development Kit)
  2. Latest XCode which includes iOS SDK
  3. Eclipse IDE
  4. Node Js
  5. Android SDK tool
  6. Appium for mac
  7. Apple’s XCUITest

appPackage and appActivity

You need to have the app file on your computer. The extension is .ipa Unfortunately for iOS, it doesn’t have the capabilities for appActivity and appPackage like Android has. It is set as an app instead.

How to set Desired Capabilities?

  1. In CMD type Appium and click enter. Now, the Appium server is up and running.
  2. Click on Appium inspector.
  3. Click on Desired capabilities.
  4. Add desired capabilities according to your application and mobile device. Refer below code for desired capabilities.

How to develop an Appium test?

In Appium, by using TestNG we can create a test using @Test annotation and also we can add priority to the test cases. In the same way we can add enabled= true/false, Grouping the test cases in the @Test annotation.

How to run the test?

In TestNG, we can run the test cases by Right click>run>TestNG. Now, the Appium act as an intermediate to interact with the elements which is present in the application.

On a closing note

Appium enables accurate and comprehensive automated testing of hybrid, native, and web applications, thus ridding them of bugs, anomalies, and any issues that may disrupt user experience. Of course, all Appium tests are best run on real mobile devices because monitoring apps in real user conditions generates 100% accurate results, every time.

Kobiton and BrowserStacks App Automate offers cloud-based access to both the latest and legacy devices (Android, iOS, and Windows) installed with real operating systems. App Automate also requires no additional setup, helping testers save precious time and meet their deadlines that much faster. Run Appium tests on thousands of real devices so that the app becomes truly cross-platform compatible and user-friendly.

About the Author

About CodeStax.Ai

At CodeStax.Ai, we stand at the nexus of innovation and enterprise solutions, offering technology partnerships that empower businesses to drive efficiency, innovation, and growth, harnessing the transformative power of no-code platforms and advanced AI integrations.

But the real magic? It’s our tech tribe behind the scenes. If you’ve got a knack for innovation and a passion for redefining the norm, we’ve got the perfect tech playground for you. CodeStax.Ai offers more than a job — it’s a journey into the very heart of what’s next. Join us, and be part of the revolution that’s redefining the enterprise tech landscape.

--

--

CodeStax.Ai
CodeStax.Ai

Written by CodeStax.Ai

Tech tales from our powerhouse Software Engineering team!

Responses (1)