1.3 IOS test

This article is over 600 words long, it may take about 2 minutes to read the full text

Overview

This article introduces how to get started with AirtestIDE for IOS testing. It is divided into the following sections:

  • About iOS automated testing
  • Deploy iOS-Tagent
  • Connect to iOS devices
  • Record and run scripts using Airtest image recognition
  • Record and run scripts using Poco mode
  • FAQ

About iOS automated testing

There are several common scenarios for automating test solutions for iOS. Apple’s recommendation is to write test code directly in the xcode project, then test it with xcode. The problem with this approach is that the coupling degree between test’s code and project’s code is relatively high and complex.

Airtest Project provides a new way of thinking: using Python as scripting language and image recognition to automate testing. It also uses the optimized WebdriverAgent (iOS-Tagent) as the underlying framework of runtime device control. This greatly optimizes the execution efficiency. IOS automation has never been easier and more convenient.

Deploy iOS-Tagent

The first step in performing an iOS test is to deploy iOS-Tagent. For a more specific deployment tutorial, see github link or [AirtestIDE official documentation](http:/ /airtest.netease.com/docs/docs_AirtestIDE-en_US/1_quick_start/5_ios_connection.html)

After following the steps in the deployment tutorial, a log like the one below will indicate that the project has started successfully:

Test Suite 'All tests' started at 2017-01-23 15:49:12.585
Test Suite 'WebDriverAgentRunner.xctest' started at 2017-01-23 15:49:12.586
Test Suite 'UITestingUITests' started at 2017-01-23 15:49:12.587
Test Case '-[UITestingUITests testRunner]' started.
t =     0.00s     Start Test at 2017-01-23 15:49:12.588
t =     0.00s     Set Up

In general, the Agent on the phone should be accessed by setting up the usb proxy, as there may be problems accessing directly through wifi. For further explanation on this, please refer to [Issues](https://github.com/facebook/WebDriverAgent/ Wiki/Common-Issues) and detail

Iproxy can be used

$ brew install libimobiledevice
$ iproxy 8100 8100

| After the startup has finished, try to visit http://127.0.0.1:8100/status
| If some json-formatted information is displayed, the startup was successful.

Connect to iOS devices

After completing the above steps, you can start using AirtestIDE to connect to the device. In simple terms, connecting to an iOS device requires only to:

  • Open AirtestIDE
  • Enter url and click connect

After deploying iOS-Tagent, open AirtestIDE and find the iOS connection window.

Click “connect” to connect to the device

Record and run scripts using Airtest image recognition

Airtest image recognition system is our solution to record and play back operations such as clicking and sliding.

The following describes the use of Airtest recognition system:

  • Select the calculator icon to be clicked
  • Playback script

Select the touch button to record a click operation.

Select the button in the screen that needs to be clicked

Play back the operation

For more on automatic recording, see

Record and run scripts using Poco mode

When using Poco for recording and running scripts, the elements on the current screen can be accurately located in the actual UI structure tree, so we can retrieve information such as the position. Here’s how iOS uses Poco to record and run:

  • Opens poco selection component
  • Shows a script playback process, i.e. opens the calculator and performs simple calculations

In the poco window, select iOS to open Poco.

For specifics on how to use poco see

The following describes the use of Poco for recording and playback.

FAQ

Q1. iOS Are connections to multiple devices supported?

Q2. What to do if the connection fails?

Q3. Does it support test games?

  • It does, for more information, check poco page