当前位置:网站首页>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

边栏推荐
- Possible problems and solutions of using scroll view to implement slider view
- js 图片路径转换base64格式
- Threejs opening
- 283. move zero
- Why is Hong Kong server most suitable for overseas website construction
- 2022 polymerization process test questions and simulation test
- VIM easy to use tutorial
- Task04 | statistiques mathématiques
- I also gave you the MySQL interview questions of Boda factory. If you need to come in and take your own
- Codeforces Round #721 (Div. 2)B1. Palindrome Game (easy version)B2. Palindrome game (hard version)
猜你喜欢

Annual inventory review of Alibaba cloud's observable practices in 2021

MySQL advanced -- you will have a new understanding of MySQL

JVM栈和堆简介

Knowledge supplement: basic usage of redis based on docker

ThreeJS开篇

2022 a special equipment related management (elevator) simulation test and a special equipment related management (elevator) certificate examination

Daily question - line 10

离线安装wireshark2.6.10

LM small programmable controller software (based on CoDeSys) note 20: PLC controls stepping motor through driver

Account sharing technology enables the farmers' market and reshapes the efficiency of transaction management services
随机推荐
什么是权限?什么是角色?什么是用户?
Maixll dock quick start
OSPF notes [multiple access, two multicast addresses with OSPF]
25.k sets of flipped linked lists
Simple implementation of slf4j
Odeint et GPU
Browser top loading (from Zhihu)
什么是uid?什么是Auth?什么是验证器?
2022.2.7-2.13 AI industry weekly (issue 84): family responsibilities
Use winmtr software to simply analyze, track and detect network routing
JS image path conversion Base64 format
1. Mobile terminal touch screen event
How to view the changes and opportunities in the construction of smart cities?
软件研发的十大浪费:研发效能的另一面
Programs and processes, process management, foreground and background processes
Openresty rewrites the location of 302
Task04 | statistiques mathématiques
LM small programmable controller software (based on CoDeSys) note 20: PLC controls stepping motor through driver
Software testing needs more and more talents. Why do you still not want to take this path?
[today in history] June 30: von Neumann published the first draft; The semiconductor war in the late 1990s; CBS acquires CNET