当前位置:网站首页>Alibaba P8 painstakingly sorted it out. Summary of APP UI automated testing ideas. Check it out
Alibaba P8 painstakingly sorted it out. Summary of APP UI automated testing ideas. Check it out
2022-07-03 16:27:00 【Programming simplicity】
First of all, I want to explain ,APP Automated testing may not be used by many companies , But also most automated test engineers 、 Senior Test Engineer position recruitment information requirements , So for better treatment , We still need time to master , After all, no one can be against money . Next , Let's sum up APP UI The idea of automated testing Well .
01
Develop language options
Commonly used programming languages for automated testing are :Python、Java、Javascript、Ruby、C#、PHP etc. . Generally, we will choose our own familiar programming language to write automation scripts , But for programming, the basics are 0 Children's shoes ( Or children's shoes that focus on automated testing ), Recommend learning to use Python.
Compared with other languages ,Python Doing automated testing has the following advantages :
- For beginners ,Python Grammatical simplicity , High readability , Easy to learn
- There is a strong third-party library , Scripting is more efficient
- Python Medium Pytest Automated testing framework is one of the most popular testing frameworks
02
Test framework selection
After selecting the development language , We need to choose UI The test framework . At present, the more mainstream or more used APP UI The automated testing framework has Appium、Airtest etc. .
1、Appium
- Continuous maintenance and open source
- Appium server Support in Windows、macOS、Linux Up operation
- Support a variety of mainstream programming languages , Such as Python、Java、Javascript、Ruby etc.
- Support Android、ios、H5 automated testing ( Integrated UiAutomator、UiAutomation frame )
- The environment is complex
2、Airtest
- Developed by Netease ( Official documents ), Only support python Language
- Provide integration Airtest And Poco The two test frameworks are powerful IDE, Friendly to novices
- Integrated image recognition based UI Automated testing framework airtest, You can write automated scripts even if you don't understand the code
- Cross platform , But for Windows、Android and iOS Application software for automated testing
- Friendly to game testing
- Airtest And Poco Essentially, python Two third-party libraries of , The test environment is not built Appium So complicated
3、 Choose the framework
Choose the right framework according to the actual situation . Netease can be preferred in the following situations Airtest (Airtest Official website ):
- No programming foundation
- Game testing
- The test scenario is relatively single (Appium Relatively heavy )
- Alipay small program automation ( Bloggers currently use Airtest Integrated Poco Framework for Alipay small program automated testing )
It is suggested that Appium:
- The test scenario is complex ( If you need to test multiple mobile phones in batch )
- Testing scripting languages is not Python(Airtest Currently only supported Python)
03
Unit test framework selection
Different from the above UI The test framework , Unit test framework Used to load test cases 、 Execute test case 、 Assertion 、 Output test results etc. .
Different development languages have their own unit testing frameworks , Such as Java Yes JUnit、TestNG、Robot etc. ,Python Yes unittest、pytest etc. . Bloggers mainly use Python Do automated tests , So this is only for Python Unit testing framework .
python Mainstream unit testing framework :
- unittest,Python Built in unit test framework
- pytest, be based on unittest Development , Easy to use , More details , There are many plug-ins
- robot framework, be based on Python Keyword Driven Testing Framework for , There is an interface , Bring your own report and log, Functional perfection , Clear and beautiful
It is highly recommended to use pytest, Powerful and easy to use , The official document is in English , In Chinese, please refer to Pytest User manual ).
04
Test environment construction
1, Test computer selection
If possible, it is recommended to use Mac The machine is dedicated to UI automated testing , because ios app ui Automation can only be done in Mac On the machine .
2, Test the phone selection
When you start debugging test scripts, you can choose emulator ,Android The simulator can choose Gernymotion、 Night God Simulator , After the development of the whole test project is completed , It is suggested to run the automation script on the machine , This is closer to the real user scenarios .
3, Develop the language environment
Proposed installation python 3 Version above , Officials have stopped talking about python2 Version update maintenance .
4,UI Automatic test framework environment construction
windows Build... In the environment Appium Please refer to appium Environment building ,Mac The structures, Appium A little more complicated , We will share later . If choose Airtest Frame words , Please refer to the official website .
05
scripting
1、 Write tests demo
In order to verify whether the whole test environment is built successfully 、 Whether can run general example , Generally we need First write a simple test script and execute , The result shows that the whole environment is built successfully .
2、 Determine the directory structure
Recommended Page Object Design patterns to develop APP UI Automatic test items, please
3、 Select test report
Different development languages 、 Different test reports can be selected for different unit test frameworks . stay python in ,unittest Frame usage HTMLTestRunner or BSTestrunner Generate test reports ,Pytest Frame usage pytest-html Generate reports or through allure Custom test reports .
After the above steps are completed , Continue to add test cases to the test project .
06
Jenkins Integrate
According to the above steps to complete the whole app UI Automated test projects , And after a period of stable operation , We can consider Jenkins Integration of .
07
summary
summary APP UI Automation can be implemented in the following ways :
- python + appium + unittest + HTMLTestRunner
- python + appium + pytest + pytest-html / allure
- python + Airtest(AirtestIDE)
- python + Poco + pytest + pytest-html / allure
You can choose according to the actual situation . Any questions can be seen below
边栏推荐
- ThreeJS 第二篇:顶点概念、几何体结构
- 线程池执行定时任务
- How to use AAB to APK and APK to AAB of Google play apps on the shelves
- Pyinstaller is not an internal or external command, nor is it a runnable program or batch file
- Mysql 单表字段重复数据取最新一条sql语句
- How to thicken the brush in the graphical interface
- 手机注册股票开户安全吗 开户需要钱吗
- Explore Cassandra's decentralized distributed architecture
- Characteristic polynomial and constant coefficient homogeneous linear recurrence
- Cocos Creator 2. X automatic packaging (build + compile)
猜你喜欢
Google Earth engine (GEE) - daymet v4: daily surface weather data set (1000m resolution) including data acquisition methods for each day
[combinatorics] non descending path problem (outline of non descending path problem | basic model of non descending path problem | non descending path problem expansion model 1 non origin starting poi
Basis of target detection (IOU)
The difference between calling by value and simulating calling by reference
斑马识别成狗,AI犯错的原因被斯坦福找到了
Q2 encryption market investment and financing report in 2022: gamefi becomes an investment keyword
Slam learning notes - build a complete gazebo multi machine simulation slam from scratch (II)
[statement] about searching sogk1997 and finding many web crawler results
Visual SLAM algorithms: a survey from 2010 to 2016
探索Cassandra的去中心化分布式架构
随机推荐
线程池执行定时任务
Explore Cassandra's decentralized distributed architecture
Why can't strings be directly compared with equals; Why can't some integers be directly compared with the equal sign
Chinese translation of Tagore's floating birds (1~10)
Low level version of drawing interface (explain each step in detail)
初试scikit-learn库
Is it safe to open an account with flush?
8 cool visual charts to quickly write the visual analysis report that the boss likes to see
Myopia: take off or match glasses? These problems must be understood clearly first
Extraction of the same pointcut
Batch files: list all files in a directory with relative paths - batch files: list all files in a directory with relative paths
手机注册股票开户安全吗 开户需要钱吗
Threejs Part 2: vertex concept, geometry structure
NFT new opportunity, multimedia NFT aggregation platform okaleido will be launched soon
Everyone in remote office works together to realize cooperative editing of materials and development of documents | community essay solicitation
PHP secondary domain name session sharing scheme
Stm32f103c8t6 firmware library lighting
8 tips for effective performance evaluation
[web security] - [SQL injection] - error detection injection
Asemi rectifier bridge umb10f parameters, umb10f specifications, umb10f package