当前位置:网站首页>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
边栏推荐
- [proteus simulation] 8 × 8LED dot matrix screen imitates elevator digital scrolling display
- 《天天数学》连载56:二月二十五日
- 无心剑中译泰戈尔《漂鸟集(1~10)》
- The difference between calling by value and simulating calling by reference
- 面试之 top k问题
- First!! Is lancet hungry? Official documents
- [combinatorics] summary of combinatorial identities (eleven combinatorial identities | proof methods of combinatorial identities | summation methods)*
- Custom plug-in construction and use of QT plug-in
- 2022爱分析· 国央企数字化厂商全景报告
- Chinese translation of Tagore's floating birds (1~10)
猜你喜欢

线程池执行定时任务

MB10M-ASEMI整流桥MB10M

Unreal_DataTable 实现Id自增与设置RowName

面试官:JVM如何分配和回收堆外内存

Record a jar package conflict resolution process

How to thicken the brush in the graphical interface

Getting started with Message Oriented Middleware

NFT新的契机,多媒体NFT聚合平台OKALEIDO即将上线

NSQ source code installation and operation process

Deep understanding of grouping sets statements in SQL
随机推荐
PHP中register_globals参数设置
Multithread 02 thread join
[redis foundation] understand redis master-slave architecture, sentinel mode and cluster together (Demo detailed explanation)
Caching mechanism of Hibernate / session level caching mechanism
SVN使用规范
LeetCode1491. Average value of wages after removing the minimum wage and the maximum wage
远程办公之大家一同实现合作编辑资料和开发文档 | 社区征文
一台服务器最大并发 tcp 连接数多少?65535?
高等数学(第七版)同济大学 习题2-1 个人解答
Is it safe to open an account with flush?
Why can't strings be directly compared with equals; Why can't some integers be directly compared with the equal sign
Advanced Mathematics (Seventh Edition) Tongji University exercises 2-1 personal solutions
Pychart error updating package list: connect timed out
Golang anonymous function use
2022 love analysis · panoramic report of digital manufacturers of state-owned enterprises
Visual SLAM algorithms: a survey from 2010 to 2016
The mixlab editing team is recruiting teammates~~
架构实战营 - 第 6 期 毕业总结
Develop team OKR in the way of "crowdfunding"
[combinatorics] combinatorial identities (review of eight combinatorial identities | product of combinatorial identities 1 | proof | use scenario | general method for finding combinatorial numbers)