This article is from the official account of the project: “AirtestProject” Copyright notice: It is allowed to be reproduced, but the original link must be retained. Do not use it for commercial or illegal purposes

preface

The simulator is a tool that our testing partners like very much. When using the AirTest framework for automated testing, our friends also like to use the simulator as a test device, but we also received many questions about connecting the simulator:

① Airtest can not connect to the xx simulator how to do ② XX simulator connected but good card ah ③ which simulator is good to use, there is no recommendation……

Today we will use the AirtestIDE to connect to five major simulators to see which one of them is the best.

The preparatory work

① Enter developer mode and open USB debugging

No matter what brand of emulator we connect, we need to turn on its USB mode first, then we can connect to it.

How to turn it on: Slide to the bottom of Settings, find about tablet, click in to find the version number, and then repeatedly tap the version number until it says: You are in Developer mode. Now go back to the upper menu, you can see that there is a developer option, click in, and then turn on the USB debug option.

② Manually install Yosemite in the emulator

In many cases, AirTest does not automatically install Yosemite when connecting to an emulator as it does to a real device. We recommend manually installing Yosemite before connecting to the emulator to avoid the following errors:

The Yosemite installation package can be found in the unpacked AirtestIDE folder:

1. Lightning simulator

① Product version used in this test:

  • Lightning Simulator: 3.94.0 (New)
  • AirtestIDE: 1.2.3 (Latest)

② The port number of the lightning simulator is 5554. The steps of connecting the lightning simulator in the device connection window of IDE are shown in the figure below:

Note: The lightning simulator can connect to the AirtestIDE without checking the alternative connection parameters

(3) If more than one lightning emulator device with port number 5554 is generated, select the one with ADB Status as device, namely emulator-5554.

④ Connect the lightning simulator to the auto_setup interface

auto_setup(__file__,devices=["Android: / / 127.0.0.1:5037 / emulator - 5554"])
Copy the code

2. With complte patterns simulator

① Product version used in this test:

  • Mumu Simulator: 2.3.10 (Latest)
  • AirtestIDE: 1.2.3 (Latest)

(2) Mumu simulator port number is 7555. The steps of connecting mumu simulator in the device connection window of IDE are shown as follows:

Note: Mumu simulator can connect to the AirtestIDE without checking the alternative connection parameters

③ Connect mumU emulator in auto_setup interface

auto_setup(__file__,devices=["Android: / / 127.0.0.1:5037/127.0.0.1:7555"])
Copy the code

3. Night God simulator

① Product version used in this test:

  • Nighthian Simulator: V6.6.0.8005 (New)
  • AirtestIDE: 1.2.3 (Latest)

② The port number of the Pygmy simulator is 62001. The steps of connecting the Pygmy simulator in the device connection window of the IDE are shown in the figure below:

③ To connect to Nighgod on IDE, you need to check the alternative connection parameter use Javacap before clicking Connect, otherwise the connection will report an error or the simulator will appear black screen:

④ Connect to the Pyse simulator in the auto_setup interface

auto_setup(__file__,devices=["Android: / / 127.0.0.1:5037/127.0.0.1:62001? cap_method=JAVACAP"])
Copy the code

4. Leisure simulator

① Product version used in this test:

  • Xiao Xiao Simulator: 7.2.1 (New)
  • AirtestIDE: 1.2.3 (Latest)

② The port number of the happy simulator is 21503. The steps of connecting the happy simulator in the DEVICE connection window of IDE are shown in the figure below:

(3) Before clicking Connect, you need to check the alternative connection parameters use Javacap and Use ADB orientation. Otherwise, the following error will appear:

④ Connect the proms simulator in the auto_setup interface

auto_setup(__file__,devices=["Android: / / 127.0.0.1:5037/127.0.0.1:21503? cap_method=JAVACAP&&ori_method=ADBORI"])
Copy the code

5. Daily simulator

① Product version used in this test:

  • Daily Simulator: 3.2.8 (Latest)
  • AirtestIDE: 1.2.3 (Latest)

② The port number of tian Tian Simulator is 6555. The steps of connecting tian Tian Simulator in the device connection window of IDE are shown in the figure below:

③ To connect to the daily simulator on IDE, you need to check the alternative connection parameter use Javacap before clicking Connect, otherwise the simulator will appear black screen:

④ Connect to the daily simulator in the auto_setup interface

auto_setup(__file__,devices=["Android: / / 127.0.0.1:5037/127.0.0.1:6555? cap_method=JAVACAP"])  
Copy the code

summary

① Performance of running the same script for 5 times (the script takes about 5min to run) :
The serial number The simulator CPU utilization Memory usage Average running time note
1 Thunder and lightning 75% – 85%. 44% 263.676 s None Failed to run
2 mumu 75% – 85%. 45% 242.742 s None Failed to run
3 Night god 65% – 75%. 43% 230.199 s One card to death
4 Free and unfettered 80% – 85%. 47% 214.351 s None Failed to run
5 Day after day 65% – 75%. 46% 250.368 s None Failed to run

Note: The simulator performance configuration is set as the highest level, and the device models are basically the same. In addition, there may be errors in the test results on different hardware devices.

② Check alternative parameters and common problems for the simulator
The serial number The simulator The port number Alternate connection parameter Q&A
1 Thunder and lightning 5554 There is no Multiple devices with port number 5554 are displayed
2 mumu 7555 There is no Temporarily not found
3 Night god 62001 use javacap If javacap is not selected, the screen goes black and the javacap freezes
4 Free and unfettered 21503 Use Javacap, use ADB orientation If unchecked, AdbShellError is reported
5 Day after day 6555 use javacap If javacap is not selected, a black screen is displayed
(3) conclusion

1) The speed of running scripts is faster than that of other simulators; 2) Compared with other simulators, the Probability of death of The Nighthian simulator is higher; 3) Simulators that can be connected without checking any connection parameters include Thunder and Mumu; 4) If the simulator has a connection problem, check whether Yosemite is installed first, and then check the connection parameters to try to resolve the problem. 5) This test is based on a specific version of the IDE and the simulator, so you can use the version that passed the test first to avoid more connection problems.


Airtest website: airtest.netease.com/ Airtest tutorial website: airtest.doc.io.netease.com/ build enterprise private cloud service: airlab.163.com/b2b