当前位置:网站首页>Actual combat | UI automation test framework design and pageobject transformation
Actual combat | UI automation test framework design and pageobject transformation
2022-04-21 20:21:00 【hogwarts_ beibei】

stay UI Automated testing process , Facing complex business scenarios , We often encounter such challenges :
- Simple recording / Fast playback speed , But can't adapt to complex scenes ;
- Writing automated test scripts is more flexible , But the workload is heavy and the maintainability is poor ;
- Previous packaging technologies (PageObject) Can adapt to all kinds of UI scene , But the structure is loose , Cannot migrate in multiple projects ;
therefore , A testing team often needs to customize a testing framework , To make up for the shortcomings of the existing framework .
because UI The automated testing framework revolves around UI Interface to use , therefore , Still choose PageObject Design patterns for UI And test for packaging , Simultaneous coordination Pytest Unit test scripts can be effectively organized 、 Coherent application , So as to improve the maintainability and readability of the framework .
Because the test framework is based on PageObject Design patterns , The main direction is PO improvement , Data driven , Exception handling , such as : - Data driven test data : Store data externally yaml In file , utilize yaml Tool for data reading ;
- Data driven of data steps : Put the operation steps outside yaml In file , utilize yaml The tool reads the operation steps , Analyze and implement the operation steps with special functions ;
- Automatic exception handling mechanism : Encapsulate and improve the element search module , Including how to deal with pop ups ;
As a universal UI The test framework , PageObjet Not just for Web automated testing , It also applies to Appium Mobile automation test , Its advantages are as follows : - Reduce code duplication
- Improve the readability of test cases
- Improve maintainability of test cases

This case will be about snowball App Conduct Page Objetct Packaging and improvement .
When starting the snowball App when , Will enter the home page . Click the search box to enter the search page , Search for a stock and determine whether the share price is greater than 200:
PageObjetct The module relationship is as follows , All modules should inherit BasePage , App Implement start , restart , Stop and wait operation , Main Enter the search page , Enter the stock page and other operations :
base_page Modules are all page The parent of a class , It defines the public method , For example, encapsulate the following find After the method , You can let subclasses call find :
App Module encapsulation app Start of , restart , Stop, etc , When app When starting, it will enter main page , So in the following main Methods return Main ,Main The definition of class will be explained later :
Main The module is the first page PageObject , The method encapsulates the important functions of the home page , For example, in the following code goto_search_page Encapsulated click search and jump to Search page :
Search The module can search for a stock , You can also get the price of the stock , For example, below :
The encapsulation code is as follows :
Finally, test the above code , New test module test_search :
above , For your reference , Welcome to leave a message to discuss .
Related articles
- UI Should automated testing be put into ? Have no future ? What is the wisest thing to do ?
- actual combat | UI Dispatching automation test platform ( be based on Python)
- Page Object The mode is very hot ,UI Whether automated testing should be used or not ? How to use it? ?
- PageObject(PO) The design pattern is UI Summary of practice in Automation ( With QQ E-mail login as an example )
版权声明
本文为[hogwarts_ beibei]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204212013490426.html
边栏推荐
- Status code encapsulation -- reprint
- The timer class of version C is accurate to microseconds and retains one decimal place after seconds. It supports the output of year, month, day, hour, minute and second with units
- How chaotic is the research market
- Solution when the port is occupied
- Know that Chuangyu issued a heavy strategic plan to build a practical defense system for continuous exchange of fire
- Interface non idempotent solution
- The difference between English and American pronunciation [turn]
- First acquaintance with EEMBC coremark
- C package DLL into program
- STL container (I) -- vector
猜你喜欢

Source insight configuration and problem summary

Cuda02 - memory access optimization and unified memory

Data preprocessing for data analysis

Jmeter关联参数

Wild road play QT, episode 31, glass cleaning game

如何在不加锁的情况下解决线程安全问题

Your independent station conversion rate is low? Three tips to help improve conversion

JUC queue interface and its implementation class

自制整人电脑小程序

Three implementation methods of quick sorting
随机推荐
如何确保API 的稳定性与正确性?你只需要这一招
vim 从嫌弃到依赖(6)——插入模式
Share the advantages of Intranet instant messaging software
Introduction to WLAN qpower
[2021] number of effective sequences programmed by Tencent autumn recruitment technology post
My medical experience of "traditional Chinese medicine"
Gbase 8A round or reject the double value, and the result is not the analysis and solution of rounding problem
【 summer internship 】
Changan dark blue c385 product information exposure aims at 200000 level, and the number one target is model 3!
MFC CComboBox 使用例子
How to let the back door of the network card kill a system and let you know how powerful the network card is
初识EEMBC-Coremark
La classe Timer de la version C # conserve une décimale pour supporter la sortie de l'unit é mm / JJ / MM / MIN / sec après avoir été exacte à microsecondes
【原】通俗说法所谓数码相机的“动态像素”和“静态像素”背后的故事
On multi-core CPU, multithreading and parallel computing
如何让网卡后门搞死一个系统,让你知道网卡是个多么厉害的角色
824. Goat Latin
MFC CCombobox usage example
C# 双保险进程监视器 lol 保证被监视的程序'几乎'永远运行. 关键字:进程操作 进程查看 创建进程
【转】SSE2 SSE简介和C代码示例