In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/03 Report--
Resources
As blogs are not allowed to be outside the link (do not understand why, more and more closed), so can not directly write URL, you can Baidu search keyword "airtest" to see the official website
Some of the following are instructions from the official website
Airtest introduction
Airtest is a cross-platform UI automated testing framework suitable for games and App. Support Windows, Android, IOS (unknown errors in the test phase) platform.
Airtest provides cross-platform API, including installation of applications, analog input, assertions, etc. By locating UI elements based on image recognition technology, you can automate testing without embedding any code. A detailed HTML test report can be generated automatically after the test script is run.
Airtest is a cross-platform UI automated testing framework based on image recognition, which is suitable for games and App. The supporting platforms are Windows, Android and iOS.
Poco is an automated testing framework based on UI control identification, which currently supports native Unity3D/cocos2dx-*/Android app/iOS native app/ WeChat Mini Programs. (WeChat Mini Programs is no longer supported for the time being)
AirtestIDE is a cross-platform UI automated test editor with built-in plug-ins for Airtest and Poco that can be used to write scripts quickly and easily.
PS: after personal use, it feels really powerful, but the accuracy still needs to be improved. After recording a more complex scene, you still need to manually change the debugging script. Handwritten code that wants to play better.
AirtestIDE installation
Download the corresponding version, extract it and double-click AirtestIDE.exe to run it.
You need to register an account at the beginning of the operation. After registration and verification, you can enter ide, as shown below.
On the left is the auxiliary window, which, to put it bluntly, is the recognition and recording of images and elements, with the script area in the middle and the equipment area on the right, that is, the linked phone or simulator.
Link to Android mobile phone
Open the phone > Settings > developer options > USB debug switch
Click the Refresh ADB button in the AirtestIDE device panel to view the devices on the connection
If the device is not shown, try Restart ADB
Click the Connect button of the corresponding device to initialize (if you are using an emulator, select use javacap to get a high-definition picture)
If an error similar to the following occurs:
Adb server version (40) doesn't match this client (39); killing... * daemon started successfully *
Solution:
Overwrite the adb.exe under android-sdk-windowsplatform-tools to the airtest/core/android/static/adb/windows
Connect to iOS mobile phone
Reference: http://airtest.netease.com/docs/cn/2_device_connection/4_ios_connection.html
Other usage methods will be explained step by step in subsequent scripts
Airtest script
Based on image recognition. Special attention here, image recognition is not omnipotent! It has a success rate. If there are 10 pictures in a script, the recognition success rate of each picture can be as high as 95%, and the probability of correct recognition of all 10 pictures is only 60%. So you know ~ ~
Basic steps:
App starts up.
Click the button in the airtest panel to select the elements in the corresponding app, which can be recorded step by step and automatically generate the code for you.
Click the recording button in the airtest panel to record in real time and generate a script. In other words, when you operate app in the device panel on the right side of ide, the code will be generated automatically, doesn't it feel good? But in fact, from the perspective of experience, the code generated by slightly more complex scenarios generally cannot be used directly and needs to be modified.
Take a look at the recorded code (take Xiaomi Mall APP as an example)
To put it simply, click the app icon to start, click the search box, enter the air purifier, and click the search button. The input needs to be entered by clicking on the text component in the left airtest panel.
PS: look at the above code, there is a touch comment out, here we should pay special attention when selecting the range of elements, be sure to choose the one with high accuracy, the comment out is because the selection is not very good, the text in the element will change, which will lead to sometimes success and sometimes failure. If you change it to the one above, it is basically 100% successful.
Run the script and view the report
To run is to click the triangular arrow at the top, and you can't find it? Then you can't find it. Don't ask me. During operation, log will be displayed in the lower log area, and playback will be displayed in the right device area.
To view the report is to click the last button at the top, and the result is similar to this.
Poco script
Based on UI recognition, to put it bluntly, the tree structure is similar to webdriver and appium. As an aid to the airtest script.
Basic steps:
Start the app.
Select the corresponding type in the poco panel, such as Android, and immediately see the ui tree below.
Single-step recording: double-click the target entry in the UI tree to insert the poco code of the corresponding UI node, but the operation code in the single-step recording code (such as ".click ()") needs to be added manually
PS: click the right-click menu -'UI path-code' to generate xpath code
Automatic recording: click the recording button in the poco panel, and the code will be generated automatically with your operation. To stop, click the recording button again.
PS: the recorded code generally does not run correctly and needs to be modified.
Take a look at the recorded code. Some modifications have been made.
Students who have a little automated testing foundation should know in seconds ~ among them, the input air purifier is recorded and manually modified.
PS: if you find that you cannot use it correctly, you need to connect to Poco-SDK beforehand. The steps are rather tedious. For more information, please see the official website and generally let the development be completed.
As for the operation and report is the same as before, there is no more description here.
Web automated testing
Airtest was originally born for game testing, but later extended to app and web. Experience to admire NetEase these great gods, personally feel that recording is a good thing for Xiaobai, but the script maintenance is not small. Personally, I think it's better to write code directly if you are familiar with python. In fact, the advanced usage of airtest is to write your own code. So... You know ~
Airtest-selenium is another layer encapsulated on selenium webdriver. We can use AirtestIDE to automate script recording, script running, and report generation for web.
Recording
Airtestide and chrome browsers need to be installed locally
Window > selenium window, open the se panel
Set Chrome local path: "options"-"Settings"-"Selenium"-"set Chrome path"
Click to open the browser and generate the initialization code
Open the browser-click the prompt that pops up in the edit box to generate the initialization code
After entering the web page to be tested in the browser, click the start_web of the auxiliary window to generate the code to access the URL to be tested:
Driver.get ("http://www.xqtesting.com/")"
Click to record
When operating in the browser, the code is automatically generated, similar to the following
Click the run script button again to play it back, similar to that of se
After running, click the report button to view the report
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.