当前位置:网站首页>pytest接口自动化测试框架 | 使用多个fixture
pytest接口自动化测试框架 | 使用多个fixture
2022-07-26 11:40:00 【COCOgsta】
视频来源:B站《冒死上传!pytest接口自动化测试框架(基础理论到项目实战及二次开发)教学视频【软件测试】》
一边学习一边整理老师的课程内容及试验笔记,并与大家分享,侵权即删,谢谢支持!
附上汇总贴:pytest接口自动化测试框架 | 汇总_COCOgsta的博客-CSDN博客
- 如果用例需要用到多个fixture的返回数据,fixture可以返回一个元素,list或字典,然后从里面取出对应的数据
import pytest
@pytest.fixture()
def test1():
a = 'zz'
b = '123456'
print('传出a,b')
return(a,b)
def test2(test1):
u = test1[0]
p = test1[1]
assert u == 'zz'
assert p == '123456'
print('通过fixture的元组正确取出用户名和密码')
if __name__ == '__main__':
pytest.main(['-s', 'test_multi_fixtures01.py'])- 可以分成多个fixture,然后在用例中传多个fixture参数
import pytest
@pytest.fixture()
def test1():
a = 'zz'
print("\n传出a")
return a
@pytest.fixture()
def test2():
b = '123456'
print('传出b')
return b
def test_3(test1, test2):
u = test1
p = test2
assert u == 'zz'
assert p == '123456'
print("传入多个fixture参数正确")
if __name__ == '__main__':
pytest.main(['-s', 'test_multi_fixtures02.py'])边栏推荐
- Data Lake (19): SQL API reads Kafka data and writes it to iceberg table in real time
- 打造绿色数据中心,Colt DCS 是认真的!
- 【万字长文】使用 LSM-Tree 思想基于.Net 6.0 C# 实现 KV 数据库(案例版)
- 音视频技术开发周刊 | 255
- Several inventory terms often used in communication
- [cloud co creation] what good habits do you adhere to in order to write good code?
- How did the $50000 annual salary run out
- Cohere博客:在生产环境中运行大型语言模型-推理框架概览
- Query summary of SQL Server
- 沟通中经常用到的几个库存术语
猜你喜欢

28. Implementation of file directory parsing code

CVPR 2022 单目深度估计新SOTA—NeW CRFs:Neural Window Fullyconnected CRFs

元宇宙GameFi链游系统开发NFT技术

音视频+

Data type of SQL Server database

PyCharm是真的强

Harbor2.2 quick check of user role permissions

Swagger2.9.2 tutorial and swagger3.0.0 tutorial
![[error reported]exception: found duplicate column (s) in the data schema: `value`;](/img/df/ca676633ca6d5e8c0a870be0732707.png)
[error reported]exception: found duplicate column (s) in the data schema: `value`;

Cohere博客:在生产环境中运行大型语言模型-推理框架概览
随机推荐
【云驻共创】为了写好代码,你坚持了哪些好习惯?
System call capture and analysis conclusion making system call log collection system
Mlx90640 infrared thermal imager temperature sensor module development notes (6)
Database composition storage engine
你敢信?开发一个管理系统我只用了两天时间
PostgreSQL in Linux and windows installation and introductory basic tutorial
百问百答第48期:极客有约——可观测体系的建设路径
An online duplicate of a hidden bug
Exploration on cache design optimization of community like business
线上一个隐匿 Bug 的复盘
大咖观点+500强案例,软件团队应该这样提升研发效能!
win10使用nvm安装node、npm、cnpm
Miccai2022 paper | evolutionary multi-objective architecture search framework: application in covid-19 3D CT classification
浅谈Web Vitals
3dunity game project actual combat - aircraft war
Fineos announced the open registration of grouptech connect activities in 2022
CVPR 2022 单目深度估计新SOTA—NeW CRFs:Neural Window Fullyconnected CRFs
Metauniverse gamefi chain game system development NFT Technology
Esp8266 Arduino programming example GPIO input and output
SQL statement of SQL server creates database