当前位置:网站首页>pytest interface automation testing framework | single/multiple parameters
pytest interface automation testing framework | single/multiple parameters
2022-08-01 07:27:00 【COCOgsta】
Video source: Station B "Upload at risk!pytest interface automation testing framework (basic theory to project actual combat and secondary development) teaching video [software testing]"
Organize the teacher's course content and test notes while studying, and share it with everyone. The infringement will be deleted immediately. Thank you for your support!
Attach the summary post: pytest interface automation testing framework | Summary_COCOgsta's blog-CSDN blog
Function data parameterization
It is convenient for the test function to obtain the test data.
Method:
parametrize(argnames, argvalues, indirect=False, ids=None, scope=None)
Common parameters:
argname: parameter name
- argvalues: the corresponding value of the parameter, the type must be list
- Format when parameter is one: [value]
- When the number of parameters is more than one, the format is: [(param_value1, param_value2, ...), (param_value1, param_value2, ...)]
How to use:
@pytest.mark.parametrize(argnames, argvalues)
If the parameter value is N, the test method will be run N times
Single parameter
import pytest# a parameter is given 2 values, the function will run 2 [email protected]("a", ['aaa', 'bbb'])# The parameters must be consistent with the parameters in parametrizedef test_01(a):print('\n' + a)if __name__ == '__main__':pytest.main(['-s', 'test_single_param.py'])Multiple parameters
import pytest# a parameter is given 2 values, the function will run 2 [email protected]("a,b", [('zz', '123456'), ('xz', '123456')])# The parameters must be consistent with the parameters in parametrizedef test_01(a, b):print('\n' + a)print('\n' + b)if __name__ == '__main__':pytest.main(['-s', 'test_multi_param.py'])边栏推荐
- 监听父元素宽高,自适应插件大小
- Datagrip error "The specified database userpassword combination is rejected..."Solutions
- 【HDLBits 刷题】Circuits(1)Combinational Logic
- 微信小程序请求封装
- 爆肝3万字,最硬核丨Mysql 知识体系、命令全集 【建议收藏 】
- pytest接口自动化测试框架 | 执行失败跳转pdb
- 【手撕AHB-APB Bridge】~ AHB地址总线的低两位为什么不用来表示地址呢?
- Golang:go模版引擎的使用
- pytest接口自动化测试框架 | 单个/多个参数
- MVVM项目开发(商品管理系统一)
猜你喜欢

数据分析6

Offer刷题——1

Zero-code website development tool: WordPress

Golang: go open web service

拳头游戏免版权音乐下载,英雄联盟无版权音乐,可用于视频创作、直播
![Explosive 30,000 words, the hardest core丨Mysql knowledge system, complete collection of commands [recommended collection]](/img/7f/08b323ffc5b5f8e3354bee6775b994.png)
Explosive 30,000 words, the hardest core丨Mysql knowledge system, complete collection of commands [recommended collection]

爬虫框架 Scrapy 详解

NIO编程

我三本学历,五面阿里,被面试官“供”着出来了,拿了33*15的Offer

LevelSequence源码分析
随机推荐
Classwork (7) - #598. remainder operation (mod)
Electromagnetic compatibility introductory tutorial (6) test project
my creative day
JVM: Runtime Data Area - PC Register (Program Counter)
curl (7) Failed connect to localhost8080; Connection refused
C语言学习概览(二)
The log causes these pits in the thread block, you have to prevent
华为深度学习课程第九章——卷积神经网络以及案例实践
pytest接口自动化测试框架 | parametrize叠加使用
pytest接口自动化测试框架 | 单个/多个参数
特别数的和
监听父元素宽高,自适应插件大小
Guest brush SQL - 2
Introduction to the basic principles, implementation and problem solving of crawler
史上超强最常用SQL语句大全
app 自动化 打开app (二)
pytest接口自动化测试框架 | 使用函数返回值的形式传入参数值
Srping bean in the life cycle
Delphi MDI appliction 文档最大化显示、去掉最大化最小化等按钮
rhcsa 第四天