当前位置:网站首页>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
边栏推荐
- TCP congestion control details | 3 design space
- NSQ源码安装运行过程
- 探索Cassandra的去中心化分布式架构
- Redis installation under windows and Linux systems
- Thinking about telecommuting under the background of normalization of epidemic | community essay solicitation
- Develop team OKR in the way of "crowdfunding"
- Mongodb installation and basic operation
- 14 topics for performance interviews between superiors and subordinates (4)
- The difference between calling by value and simulating calling by reference
- 于文文、胡夏等明星带你玩转派对 皮皮APP点燃你的夏日
猜你喜欢
First knowledge of database
Embedded development: seven reasons to avoid open source software
[solved] access denied for user 'root' @ 'localhost' (using password: yes)
Explore Netease's large-scale automated testing solutions see here see here
【LeetCode】94. Middle order traversal of binary tree
Détails du contrôle de la congestion TCP | 3. Espace de conception
Google Earth engine (GEE) - daymet v4: daily surface weather data set (1000m resolution) including data acquisition methods for each day
One article takes you to understand machine learning
Initial test of scikit learn Library
线程池执行定时任务
随机推荐
Batch files: list all files in a directory with relative paths - batch files: list all files in a directory with relative paths
Multithread 02 thread join
QT串口ui设计和解决显示中文乱码
远程办公之大家一同实现合作编辑资料和开发文档 | 社区征文
One article takes you to understand machine learning
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 (I)
Custom plug-in construction and use of QT plug-in
[combinatorics] combinatorial identities (review of eight combinatorial identities | product of combinatorial identities 1 | proof | use scenario | general method for finding combinatorial numbers)
NFT新的契机,多媒体NFT聚合平台OKALEIDO即将上线
用同花顺炒股开户安全吗?
From "zero sum game" to "positive sum game", PAAS triggered the third wave of cloud computing
Mixlab编辑团队招募队友啦~~
June to - -------
How to set up SVN server on this machine
Mb10m-asemi rectifier bridge mb10m
"Remake Apple product UI with Android" (3) - elegant statistical chart
Chinese translation of Tagore's floating birds (1~10)
Pychart error updating package list: connect timed out
Myopia: take off or match glasses? These problems must be understood clearly first