当前位置:网站首页>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'])边栏推荐
猜你喜欢
随机推荐
05-SDRAM: Arbitration
13 - JUC CountDownLatch concurrent programming
数据分析6
旋度(7)连接失败localhost8080;连接拒绝了
How to generate and configure public key certificate in Alipay
Dart 异常详解
Golang:go连接和使用mysql
JVM: Runtime Data Area - PC Register (Program Counter)
MVVM project development (commodity management system 1)
Classwork (7) - #598. remainder operation (mod)
Dbeaver connect the MySQL database and error Connection refusedconnect processing
问下 mysql向pg同步多个表的话 有什么好的方案吗?
zip打包目录所有文件(含隐藏文件/夹)
pytest接口自动化测试框架 | 跳过测试类
POJ2031空间站题解
MATLAB program design and application of MATLAB 2.5
图像基本操作的其他内容
Golang: go get url and form attribute value
图片无损压缩软件哪个好用:试试完全免费的JPG-C 图片批量修整压缩减肥工具吧 | 最新jpg批量修整工具下载
POJ2421道路建设题解









