본문 바로가기

카테고리 없음

Run Mac App Automated Testing

  1. Run Mac App Automated Testing Tool
  2. Run Mac App Automated Testing Software
  3. Run Mac App Automated Testing App

Airtest supports iOS automated testing. After deploying iOS-Tagent for iOS phones on Mac, you can use AirtestIDE to connect devices. Just like the IDE connects to an Android device, you can see the real-time projection of the phone and control the phone.iOS testing is not limited to real machine testing. IOS simulators can also be used.

Airtest supports iOS automated testing. After deploying iOS-Tagent for iOS phones on Mac, you can use AirtestIDE to connect devices. Just like the IDE connects to an Android device, you can see the real-time projection of the phone and control the phone.iOS testing is not limited to real machine testing. iOS simulators can also be used. After deployment on the Mac side, it can also be used for remote connection on windows in the same local area network. It supports both airtest image recognition and poco UI retrieval.

  • Prepare your Mac for mobile test automation. With the macOS Mobile Configuration Wizard you can quickly configure your Mac for the Mobile Engine 3.0 test automation of iOS and Android mobile applications. The macOS Mobile Configuration Wizard establishes a remote connection to your Mac and installs necessary components for mobile test automation.
  • Test automation is the secret to DevOps success and is essential in the world of Continuous Deployment and short deployment cycles. To achieve high speed and agility, it is important to automate our testing processes and configure them to run automatically to get automated feedback on each code commit.

This article describes the deployment process of iOS automated testing, provides a simple test script, and lists common problems during iOS testing.

Functional support¶

  • Support AirtestIDE connection, and iPhone can be controlled in real time
  • Support basic operations such as launching the app, clicking, swiping, typing, taking screenshots, etc.
  • Supports control retrieval technology and image recognition
  • Automated script recording, one-click playback, report viewing and other basic functions
  • Support real machine or simulator

Installation and deployment¶

Version requirements:
- Mac Xcode ≥ 9.3
- iPhone iOS ≥ 9.3
- When iOS version ≥9.3 and ≤10, it is based on the old version of the xcode SDK. Therefore, it is recommended to use Xcode version ≤ 10.1 to start iOS-Tagent, otherwise the problem of incomplete screen capture will occur.

Deployment process¶

  1. Download iOS-Tagent on your Mac and use Xcode to start Test. For the specific startup process, please refer to https://github.com/AirtestProject/iOS-Tagent. When Xcode's log window outputs the following information, it means that the deployment was successful.

  2. Start the agent and run iproxy 8100 8100 on the command line. After running the agent, you can open http://127.0.0.1:8100/inspector in your browser to see if the iOS device can connect successfully.

iproxy is a small tool that comes with usbmuxd, and its role is to map a certain port of the device to a certain port of the computer. Mac can be installed via brew install usbmuxd.

iproxy 8100 8100 means to map the 8100 port of the mobile phone to the 8100 port of the computer. This way we can access the mobile phone by accessing the computer's 8100 port.

  1. In the device window of AirtestIDE, enter the address: http: //127.0.0.1: 8100 orhttp: //x.x.x.x (MAC IP): 8100:

Click the Connect button to connect the iOS device, as shown in the figure:

Testing

Support for iOS simulator in Xcode¶

The deployment process of iOS Simulator in Xcode is the same as the real machine, but you can omit step 2 and do not need to run another proxy.

When Xcode's log window sees the following content, it can directly connect with the address http: //x.x.x.x: 8100, which is the address inServerURLHere displayed in the log:

Support Windows connection¶

We can also connect a remote iOS device on Windows, but we still need a Mac computer and Xcode environment.First start iOS-Tagent on the Mac according to the deployment tutorial above, and then no longer use iproxy to start the agent, but use wdaproxy instead.Because iproxy only supports local port mapping, andwdaproxy can support remote IP mapping. This means that we can access the iOS device connected to the Mac computer by accessing the IP on the second PC.

Install wdaproxy through brew install openatx/tap/wdaproxy

The usage method is the same as iproxy,wdaproxy 8100 8100. If you do not fill in the port, 8100 will be used by default:

start testing¶

The iOS test is similar to other devices and supports image recognition and UI retrieval. Here is a brief example of an iOS test:
1. Connect the device2. Click on the home button3. Screenshot4. Perform a swipe operation5. Use poco to click app Safari6. Use poco to click the browser's search box to get focus7. Type 'airtest' in the search box8. Swipe down on the search page9. Determine if the airtest official website address exists

common problem¶

  1. How to install apps in the simulator

    • Change xx.ipa to xx.zip and extract it to xx.app
    • Open the simulator and run xcrun simctl install booted xx.app in the terminal

    tips: You cannot install the real app package on the iOS simulator. The real machine app is based on the arm, and the simulator runs on the X86 instruction set. Forcibly installing it will cause a flashback problem.

  2. How to conduct iOS multi-machine test The multi-machine testing function of iOS is not currently open, so stay tuned.

  3. Api support status Please note that iOS devices are very different from Android devices. The following common Airtest API are supported on iOS:

    • start_app: OK
    • stop_app: OK
    • snapshot: OK
    • home: OK
    • touch: OK
    • swipe: OK
    • text: OK
    • wait: OK
    • exists: OK
    • find_all: OK
    • assert_exists: OK
    • assert_not_exists: OK

    But the following API are not supported:- wake: Not supported yet (considering using the home method)
    - keyevent: Only supports home event- clear_app: Not supported yet- install: Not supported yet- uninstall: Not supported yet

Terminal User Guide

You can use the command-line environment interactively by typing a command and waiting for a result, or you can use the shell to compose scripts that run without direct interaction.

Execute commands in the shell

  • In the Terminal app on your Mac, enter the complete pathname of the tool’s executable file, followed by any needed arguments, then press Return.

If a command is located in one of the shell’s known folders, you can omit path information when entering the command name. The list of known folders is stored in the shell’s PATH environment variable and includes the folders containing most command-line tools.

For example, to run the ls command in the current user’s home folder, enter the following at the command prompt, then press Return:

To run a command in the current user’s home folder, precede it with the folder specifier. For example, to run MyCommandLineProg, use the following:

% ~/MyCommandLineProg
App

To open an app, use the open command:

When entering commands, if you get the message command not found, check your spelling. Here’s an example:

Run Mac App Automated Testing Tool

% opne -a TextEdit.app zsh: opne: command not found

Terminate commands

  1. In the Terminal app on your Mac, click the Terminal window that is running the command you want to terminate.

  2. Press Control-C.

    This sends a signal that causes most commands to terminate.

Run mac app automated testing tool

Run Mac App Automated Testing Software

Repeat previously entered commands

The commands you enter during a session are saved so you can repeat a previously used command without retyping it.

Run Mac App Automated Testing App

  1. In the Terminal app on your Mac, press the Up Arrow key.

    The last command you entered appears on the command line.

  2. Continue pressing the Up Arrow key until you see the command you want, then press Return.

See alsoSpecify files and folders in Terminal on MacRedirect Terminal input and output on MacDrag items into a Terminal window on MacKeyboard shortcuts in Terminal on MacApple Developer website: Command Line Primer