Setup Guide for Appium Real iOS Device

iOS testing has become increasingly popular among both the mobile app developers and testers. As iOS app development demands a lot of expertise and time to build functional apps, a number of automated testing tools have been available that allow executing manual tests very easily. Moreover, with the Appium iOS real device testing, iOS testing has become even easier and less time-consuming. In this article, we will discuss how Appium automation testing has revolutionized the entire testing process and helped nurture a steady relationship between users of iOS devices and their beloved mobile apps.

Introduction to Appium

Appium is an automation test tool that allows you to access the mobile application on real devices using the same language such as JavaScript and framework like Selenium. It becomes very complicated when two devices are involved in automation testing, especially for cross-platform applications.

  • Appium has a client program called Appium-doctor which checks the configuration of the Android and iOS devices. Using the Appium framework, you can access all the native functions of any supported native application.  Furthermore, through this we can explain how to automate your testing on both Android and IOS platforms using Appium.
  • Apart from it, this is a testing framework that allows to test on the device those tests that are written using Node.js, Java, Python or any other language by using strong APIs of various platforms. Once the test script combination is prepared and executed, it can be used with multiple automation frameworks like TestNG, JUnit, and NUnit. The API available for the Appium framework is open source as well as service-oriented architecture (SOA).

Furthermore, Appium allows you access to popular cloud services such as LambdaTest to eliminate the need of having physical devices at hand while automating iOS, android, or web app testing. The product can easily be extended to other mobile platforms with minimal effort by utilizing open-source client libraries available for each mobile platform.

Basic Requirements for using Appium Real iOS Device

The purpose of using Appium is to verify that a particular capability of the application works correctly. Compared to a manual tester, an Appium automated test must have the same scope and focus. In other words, minifying and automating a complete program is not possible because it would be impossible for a human and an automation robot to cover the entire spectrum of program behavior. Thus, with Appium, it is essential to get done with these basic requirements.

  1. For iOS developers to support automated (UI) testing as part of their software development practices, they need to have access to a tool that can expose the native XCUITest framework on their real iOS devices. This requires the WebDriver-Agent app to be installed on the device, something that this book will take care of. However, to develop the ability to write automated test scripts for your apps, you need a variety of tools.
  2. After this, the Xcode comes into play. An Xcode project contains an executable product that can be executed in order to run tests on the application. The program uses a test execution engine that performs a simulation of user actions from logging into screens and interacting with elements as would be done by a real user watching the device’s screen and clicking on buttons etc.

An automated testing setup helps in confirming both functional and non-functional requirements for new features with which quality assurance can be carried out effectively by analyzing data gathered from multiple tests.

Capabilities of the Real Appium Device

To gain access to the XCUITest API, we need to be able to install an application on the device. This means you will also require a real iOS device. However, the capabilities which the device needs are been classified below:

  1. Enabling the UDID allows you to send crash reports and usage data to Apple. It also allows you to track crashes and the devices which are affected. This makes it very easy to debug and release updates much more frequently.
  2. To run the application, you will need to set the xcodeOrgId – in Xcode 4 this is done via Project > Header Info > Identity. Once you have done this, building and running the application is then just a matter of hitting Cmd-B, then clicking on the Run button.
  3. The xcodeSigningId is important for a developer to start the setup if he is an iPhone Developer.
  4. The platform name has to be defined early because it allows the developers to know more about the system.
  5. Even the automation name has to be set to the XCUITest to get the developers on the right track.

One way to start off with Appium iOS testing automation is to create your own test runner using the Appium Python client library. This will require a basic understanding of how to use Python and JUnit tests. The benefit of doing this is being able to write tests in a language you are comfortable with.

Handling the Debugging

There may be times when you need to troubleshoot and diagnose a problem, or when Appium server log just doesn’t provide you with enough information to diagnose a problem. Xcode logs can help you identify if the compilation of the WebDriver-Agent app was successful or not. You can turn on the logging for Xcode in your agent.json file by setting the showXcodeLog property to true. Furthermore, whenever you are facing technical issues with Appium, the first thing you should do is check the Xcode logs and try to figure out why your build failed. Sometimes the error messages will point you in a direction which can help fix the issue. The WebDriver-Agent project contains build logs when it builds.

  • Xcode build errors on iOS devices is an issue which can stop you from using the mobile web app testing capabilities offered by Appium. But then again, this issue is not specific to Appium, but any software which uses WebDriver-Agent to connect with Appium Remote.
  • Appium logs information related to iOS simulator and iOS device tests in two different logs files. The Appium Server’s log and the WebDriver-Agent’s log. Both logs are very useful in determining the causes of errors and debugging them.

Setting up WebDriverAgent manually

Typically, you would use the Appium GUI to start the Appium server, attach your device to it and launch a Spec file. However, you may want to quickly check how a spec will be performed without having to open an additional GUI window. The WebDriver-Agent is intended to solve that problem by providing an easy way of starting up the Appium server along with an attached device and performing a test or a set of tests.

  • For mobile automation testing with Appium, you need to be able to simulate an input device such as a tap, swipe, and other gestures. This will make a native UI that’s functional and accessible across multiple platforms and operating systems. To access elements on the mobile device display, you will use Appium WebDriver client libraries.
  • By running WebDriverAgent from within Xcode, you can test web apps against a headless browser in the background without interacting with Xcode.

Clearly, the WebDriver-Agent project provides a graphical user interface (GUI) to allow you to control and monitor the Appium iOS Driver. It was developed as a separate tool to allow Appium developers to be able to run exploratory tests of iOS native apps without having to run the entire Appium server.

Cleaning up the Default Bundle ID

Even after using the WebDriver Agent, one can see some issues still arising and hence it might become hard for the developers to work around. To clean this up, we can go with the Build Settings Tab that is available with the users.

  • A project bundle identifier is a name by which your application can be identified and distinguished from similar applications. It’s used together with the development and distribution certificate that you create for your application, to help identify and distinguish your application from all the other applications on the App Store.
  • Furthermore, it is a string that identifies your app. This identifier is a required part of your app’s installation path, and it’s also how your app will sign its own command-line tools for authentication.

After creating the project bundle, we can easily get the errors fixed and hence the capabilities will be shown to the developers who will be using it. Furthermore, Appium Driver will be created easily and there won’t be any issue while running it.

Wrapping Up

While Appium is a great solution for mobile automation, it does have some downsides. First, you will need to manage your own Appium Server instance in the cloud and a WebDriverAgent on localhost. Second, you will need a real device—which is not ideal during development. On the other hand, Xcode by default has what is needed to run UI Automation. Furthermore, a real app automation needs real devices and at the moment, we have to use the Xcode integrated development environment (IDE) instead of our favorite IDE. Moreover, the good news is that all we need is a simple workaround to set up a command-line Swift project with all the certificates and provisioning profiles needed by Appium on an iOS device.

You can begin your Appium testing with LambdaTest, all you need to do is upload your iOS application (.ipa file) or android application (.apk file) to the LambdaTest servers using their REST API. You need to provide your Username and AccessKey in the format Username:AccessKey in the cURL command for authentication. LambdaTest is a cross browser testing platform,allowing you to run Selenium, Playwright, Cypress and more tests across 3000+ browser and OS combinations. It is trusted in over 130+ countries and used by over a million developer teams. You can also register for free with LambdaTest.

Leave a Reply

Your email address will not be published. Required fields are marked *