当前位置:网站首页>Pytest automated testing - compare robotframework framework
Pytest automated testing - compare robotframework framework
2022-07-01 04:39:00 【Horse killing chicken test】
One 、 Preface
The test framework Is to help us manage test cases 、 Execute test case 、 A parameterized 、 Assertion 、 Basic work such as generating test report ,
Let's focus on writing test cases . A good testing framework should be highly extensible , Support secondary development , And can support a variety of types of automated testing .
Testing tools Is to complete a certain type of test , such as Selenium Used to deal with WEB UI Conduct automated tests ,Appium Used to correct APP Conduct automated tests ,Jmeter It can be used for API Automated testing and performance testing .
in addition ,Java In language OkHttp library ,Python In language requests library , these HTTP Of client It can also be seen as a kind of API Testing tools .
Two 、 Frame comparison
【Robot Framework】
Robot Framework It's based on Python Of , Extensible Keyword Driven Automation test frame , For end-to-end acceptance testing and acceptance test driven development (ATDD).
advantage :
1) Enable easy to use Table Syntax , Create test cases in a unified way .
2) Provides the creation of reusable... From existing keywords Higher level keywords The function of .
3) Provide easy to read result The report and HTML Format log .
4) Provides a simple library API, Used to create Custom test library
5) Provide tags to classify and select test cases to execute .
shortcoming :
1) Fixed form of tabulation , Complicates a lot of simple grammar , And it doesn't support complex syntax , inflexible , And it's not conducive to improving the code writing ability of testers , And it's easy to write fatigue .
2) Test data and test code are interleaved into the same file 、 In the same way , There's tight coupling , Will result in modification of test data or test code , May affect each other , It is not conducive to the maintenance of test data and test scripts .
【Pytest】
Pytest yes Python It's easy to use 、 Efficient and flexible Unit test framework , Can support unit and functional testing .
advantage :
1) Easy to use , Easy entry , The document is rich , There are many examples in the document .
2) Support simple unit testing and complex functional testing .
3) Be able to execute all test cases , You can also select some test cases to execute , And it can automatically Retrying failed use cases .
4) Support Concurrent execution , It can also run by nose, unittest Test cases written .
5) have A lot of third-party plug-ins , And you can customize the extension .
shortcoming :
1) Because of pure Python To write , It needs testers to have certain ability of code writing and reading
2)Pytest There is no intuitive use case to display and browse the page itself , We need to show the distribution of use cases with the help of third-party modules ( such as Allure)
Writing rules :
- Test file with test_ start ( With _test The ending is OK )
- Test class to Test start , And not with init Method
- Test function to test_ start
- Assertions use basic assert that will do
Commonly used decorators :

3、 ... and 、 The new framework explains

Pain points to solve :
1) Method ( keyword ) There are too many references in , Easy to confuse 、 Use confusion
2) Method encapsulation level is simple , Too much repetitive code , This leads to bloated automation use cases ( One or two hundred lines )
3) The function of the method is single , There are too many general methods , Inconvenient to use (redis Seven or eight ways to query )
4) As more and more use cases , Cannot execute concurrently , The total execution time is too long ( A few hours )
5) The test data is fixed , Too little parameterization , Too much dependence on the environment , Can't expand ( Unable to switch between provinces and cities )
Four 、 New automation flow chart
1、 Automatic operation flow chart

2、 Interface verification flow chart

3、 Flow chart of database verification

边栏推荐
- [deep learning] (4) decoder mechanism in transformer, complete pytoch code attached
- 2022 polymerization process test questions and simulation test
- Tencent has five years of testing experience. It came to the interview to ask for 30K, and saw the so-called software testing ceiling
- Some small knowledge points
- Simple implementation of slf4j
- Ospfb notes - five messages [ultra detailed] [Hello message, DD message, LSR message, LSU message, lsack message]
- 做网站数据采集,怎么选择合适的服务器呢?
- 【LeetCode】100. Same tree
- [Master / slave] router election in DD message
- Execution failed for task ‘:app:processDebugResources‘. > A failure occurred while executing com. and
猜你喜欢

283. move zero

Dual Contrastive Learning: Text Classification via Label-Aware Data Augmentation 阅读笔记

Openresty rewrites the location of 302

How to do the performance pressure test of "Health Code"

2022 tea master (intermediate) examination question bank and tea master (intermediate) examination questions and analysis

2022危险化学品生产单位安全生产管理人员题库及答案

Common thread methods and daemon threads
![[learn C and fly] S1E20: two dimensional array](/img/68/34fad73ff23d3e0719ef364fc60cb5.jpg)
[learn C and fly] S1E20: two dimensional array

软件研发的十大浪费:研发效能的另一面

Question bank and online simulation examination for special operation certificate of G1 industrial boiler stoker in 2022
随机推荐
Leetcode learning - day 36
CF1638E. Colorful operations Kodori tree + differential tree array
Strategic suggestions and future development trend of global and Chinese vibration isolator market investment report 2022 Edition
Web server: how to choose a good web server these five aspects should be paid attention to
2022年煤气考试题库及在线模拟考试
2022 G2 power station boiler stoker examination question bank and G2 power station boiler stoker simulation examination question bank
Daily question - line 10
Custom components in applets
嵌入式系统开发笔记79:为什么要获取本机网卡IP地址
[difficult] sqlserver2008r2, can you recover only some files when recovering the database?
OSPF notes [multiple access, two multicast addresses with OSPF]
TCP/IP 详解(第 2 版) 笔记 / 3 链路层 / 3.4 桥接器与交换机 / 3.4.2 多属性注册协议(Multiple Registration Protocol (MRP))
TASK04|数理统计
Rule method: number of effective triangles
【深度学习】(4) Transformer 中的 Decoder 机制,附Pytorch完整代码
Some small knowledge points
Knowledge supplement: redis' basic data types and corresponding commands
Common UNIX Operation and maintenance commands of shell
Announcement on the list of Guangdong famous high-tech products to be selected in 2021
网站服务器:好用的网站服务器怎么选这五方面要关注