当前位置:网站首页>Pytest interface automated testing framework | introduction to fixture of pytest
Pytest interface automated testing framework | introduction to fixture of pytest
2022-07-26 11:57:00 【COCOgsta】
Video source :B standing 《 Risking your life to upload !pytest Interface automation test framework ( From basic theory to project practice and secondary development ) Teaching video 【 software test 】》
Organize the teacher's course content and test notes while studying , And share it with you , Infringement is deleted , Thank you for your support !
Attach summary sticker :pytest Interface automation test framework | Summary _COCOgsta The blog of -CSDN Blog
Official words :
https://docs.pytest.org/en/latest/explanation/fixtures.html#about-fixtures
pytest fixtures Designed to be explicit 、 Modular and scalable
What is? fixtures
In the test ,fixture Provides defined , Reliable and consistent context . This may include the environment ( for example , Configure the database with known parameters ) Or content ( for example , Data sets )
Fixtures Defines the steps and data that make up the test preparation phase . stay pytest in , They are functions defined for these purposes . They can also be used to define the test execution phase ; This is a powerful technique for designing complex use cases .
The test function is accessed by fixtures Set up the service , Status or other operating environment . For each used by the test function fixture, Usually, there is a parameter in the definition of the test function ( stay fixture Post naming ).
We can use modifiers @pytest.fixture To tell pytest A particular function is a fixture.
Illustrate with examples :
import pytest
@ pytest.fixture
def first_fix():
return ["a"]
def test_str(first_fix):
# The test execution
first_fix.append("b")
# Assertion
assert first_fix == ["a", "b"]
print(first_fix)
if __name__ == '__main__':
pytest.main(["-s"])边栏推荐
- Cohere博客:在生产环境中运行大型语言模型-推理框架概览
- Big view +500 cases, software teams should improve R & D efficiency in this way!
- Marriage seeking story
- How did the $50000 annual salary run out
- Pytorch——基于mmseg/mmdet训练报错:RuntimeError: Expected to have finished reduction in the prior iteration
- 建模杂谈系列150 SCLC工程化实验3-SRule
- 以太网驱动详解之RMII、SMII、GMII、RGMII接口
- pytest接口自动化测试框架 | pytest配置文件
- 线上一个隐匿 Bug 的复盘
- 最新心形拼图小程序源码+带流量主
猜你喜欢

System call capture and analysis conclusion making system call log collection system

GA-RPN:引导锚点的建议区域网络

Redis database, which can be understood by zero foundation Xiaobai, is easy to learn and use!
![[countdown 10 days] Tencent cloud audio and video special is about to meet, and the thousand yuan prize is waiting for you!](/img/a0/4910970a089cab198875944c7ae88c.png)
[countdown 10 days] Tencent cloud audio and video special is about to meet, and the thousand yuan prize is waiting for you!

Pycharm is really strong

Substance painter 2021 software installation package download and installation tutorial

Hashtable

Meiker Studio - Huawei 14 day Hongmeng equipment development practical notes 8

Pytorch——基于mmseg/mmdet训练报错:RuntimeError: Expected to have finished reduction in the prior iteration

Live broadcast preview at 19:30 on July 27: harmonyos3 and Huawei's full scene new product launch
随机推荐
Pytest interface automated test framework | fixture call fixture
GA-RPN:引导锚点的建议区域网络
。。。。。。
了解 useRef 一篇就够了
Mongodn database is connected in the form of URL
【通信原理】第二章 -- 确知信号
Application scheme of ankerui residual pressure monitoring system in residential quarter
Server memory failure prediction can actually do this!
Pytest interface automation test framework | rerun failed cases
MILA旗下初创企业Ubenwa获得250万美元投资,研究婴儿健康AI诊断
V00 - 年纪大了,想做啥就做啥吧
【倒计时10天】腾讯云音视频专场即将见面,千元大奖等你来拿!
pytest接口自动化测试框架 | pytest之fixture介绍
pytest接口自动化测试框架 | 使用多个fixture
[communication principle] Chapter 1 -- Introduction
System call capture and analysis conclusion making system call log collection system
Flink 在 讯飞 AI 营销业务的实时数据分析实践
pytest接口自动化测试框架 | pytest常用插件
Win10 uses NVM to install node, NPM, and cnpm
Transactional事务传播行为?