当前位置:网站首页>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'])边栏推荐
- 数据分析5
- LevelSequence源码分析
- The log causes these pits in the thread block, you have to prevent
- app 自动化 打开app (二)
- Data organization -- singly linked list of the linear table
- 05-SDRAM:仲裁
- How to use Photoshop to composite star trail photos, post-processing method of night sky star trail photos
- 搜索框字符自动补全
- Golang:go模版引擎的使用
- Vim简介
猜你喜欢
随机推荐
实战演练 Navicat 中英文模式切换
Detailed explanation of the crawler framework Scrapy
R语言使用tidyquant包的tq_transmute函数计算持有某只股票的天、月、周收益率、ggplot2使用条形图可视化股票月收益率数据、使用百分比显示Y轴坐标数据、使用不同的色彩表征正负收益率
Fist game copyright-free music download, League of Legends copyright-free music, can be used for video creation, live broadcast
pytest接口自动化测试框架 | 单个/多个参数
pytest接口自动化测试框架 | 跳过测试类
MySQL row locks and gap locks
三维坐标系距离
my creative day
LeetCode 415:字符串相加
Introduction to the basic principles, implementation and problem solving of crawler
图片无损压缩软件哪个好用:试试完全免费的JPG-C 图片批量修整压缩减肥工具吧 | 最新jpg批量修整工具下载
案例实践 --- Resnet经典卷积神经网络(Mindspore)
pytest接口自动化测试框架 | 执行失败跳转pdb
Summary of test points about app updates in different ways
如何使用Photoshop合成星轨照片,夜空星轨照片后期处理方法
【ASWC Arxml结构分解】-7-Explicit(显式)和Implicit(隐式) Sender-Receiver communication描述差异
Monitor the width and height of the parent element, adapt to the size of the plug-in
2022杭电多校第二场1011 DOS Card(线段树)
crypto-js uses









