Appium and ios logo with blue background
March 8, 2022

Appium iOS Framework for Automated Testing: Tutorial

Automation

With new updates for iOS devices happening regularly each year, the market for testing iOS applications is stronger than ever. Users have come to expect exceptional functionality with their iOS applications, and in turn, testing teams must keep pace. To do so, the right iOS test automation framework is needed. 

Appium is the most popular open-source iOS test automation framework. This includes test automation for native mobile, web, and hybrid apps.  

This blog will walk you through the benefits of Appium iOS and a tutorial for how to do iOS test automation with Perfecto and Appium.

Related Resources >> Appium Framework: Pros & Cons

Back to top

Benefits of Appium for iOS 

Appium for iOS is a powerful tool that can be used to automate the testing of mobile and web applications across a variety of platforms. Here are some of the top benefits:  

  • Affordable & Open-Source: Appium is free and open-source, and it is simple to install. No additional installation on a device is needed to support Appium. 
  • Cross-Platform Support: Appium tests can run on both iOS and Android without requiring any changes to the code. 
  • Flexible: Appium provides support for multiple development languages through Remote WebDriver language bindings (Java, JavaScript, Perl, Python, C#). Appium can cover black box end-to-end test flows including outside-the-app scenarios.
  • Record & Playback: Appium, like other automation tools, has a record and playback feature. Using Appium's record and playback functionality, inspectors may be used to speed up testing. It inspects the DOM to record the actions of the native app (Document Object Model). 
  • Integration with CI tools: Most CI technologies may be integrated with Appium to provide automated test triggering throughout release cycles. 

Related Resource >> Appium: Pros, Cons, and What The Future Might Look Like

Back to top

How to Start Appium iOS Test Automation With Perfecto 

Before you get started with testing Appium for iOS, there are a few things that you will need to do beforehand.  

Install:  

If you use Eclipse, you should also install: 

If you use IntelliJ IDEA, you should install: 

Back to top

How to Run Tests with Appium iOS:Tutorial  

Integrating your existing Appium test code with Perfecto is easy. You can configure your TestNG/Maven projects from within your IDEs (IntelliJ, Eclipse, etc.). Simply provide your private cloud URL and security token, then define the desired capabilities for the platforms you want to test against. 

1. Go to  https://github.com/PerfectoMobileSA/PerfectoJavaSample and download the project. This is a project you can use for both Selenium and Android tests, but this blog will concentrate on iOS only.

2. Import the project as an existing Maven project.  

3. After importing, navigate to the PerfectoAppiumiOS.java file and add your Perfecto cloud name and token.

4. Now the blueprint test is ready to run with the pre-loaded sample test. If you want to create your own test covering any use case, you can use this Java file as an example. 

As Perfecto is Appium-friendly, users can inject previously created Appium tests. The tests will still work if the cloud, token, and capabilities are set correctly. Perfecto supports iOSDriver, AppiumDriver, and AndroidDriver, and extended functionalities including:  

  • Image and Audio injection 
  • Location set 
  • Network virtualization 
  • Face ID and Fingerprint injection  
  • Image and Text analysis 
  • Call and SMS support (by inserting real SIM cards in the devices) 

For element location, you can use the embedded tool called Object Spy. Perfecto’s “Object Spy” feature can show the application’s object properties, which can be used in Appium scripts.

Once the test is finished, you can view your results with Perfecto’s Insights dashboard.

The Insights view showcases a dashboard of data consisting of three powerful widgets that provide you with greater visibility and context into test status, so you can save even more time identifying, prioritizing, and fixing issues.  

Insights also provides intelligent analysis and actionable advice on how to proceed, so you can act quickly and improve your tests. If you are a current Perfecto customer, the Insights view and enhanced capabilities are available for you to start using, in the Test Analysis section.  

Related Resource >> Perfecto Test Reporting & Analytics

Back to top

Bottom Line  

Perfecto gives your team immediate access to thousands of real iOS devices, even from different parts of the world. Appium scripts may be written in a variety of languages (Java, C#, etc.) and executed by test automation engineers and developers. Teams can then seamlessly run these scripts on actual devices in Perfecto’s cloud. 

See a demo of testing iOS apps with Appium and Perfecto here. 

START Trial

Back to top