当前位置:网站首页>pytest接口自动化测试框架 | pytest安装与规则
pytest接口自动化测试框架 | pytest安装与规则
2022-07-22 09:48:00 【COCOgsta】
视频来源:B站《冒死上传!pytest接口自动化测试框架(基础理论到项目实战及二次开发)教学视频【软件测试】》
一边学习一边整理老师的课程内容及试验笔记,并与大家分享,侵权即删,谢谢支持!
- 安装
pip install pytest
- 验证
pytest --version
- pytest文档
官方文档:
https://docs.pytest.org/en/latest/contents.html
- pytest规则
pytest是如何去寻找要执行的测试用例的?
1)pytest将在当前目录及其子目录中运行所有格式为test_*.py或者*_test.py的文件
2)类必须以Test开头
官方:
它遵循标准的测试发现规则。
Python测试发现约定
- 如果为指定任何参数,则收集从testpaths(如果已配置)或当前目录开始。另外,命令行参数可以在目录,文件名或节点ID的任何组合中使用。
- 递归到目录,除非它们匹配norecursedirs。
- 在这些目录中,搜索test_*.py或*_test.py。
- 从这些文件中,收集测试项目:在类之外拥有test前缀的测试函数或方法在拥有Test前缀中的测试类(不含__init__方法)中的拥有test前缀的测试函数或方法
可自定义测试发现规则
pytest也可以发现使用标准的unittest.TestCase子类技术的测试用例(完全兼容unittest的原因)
边栏推荐
- LeetCode 每日一题 2021/12/13-2021/12/19
- Leetcode daily question 2022/2/7-2022/2/13
- JS advanced - understanding of objects
- Future prospects and trends of IT outsourcing service industry in various fields
- 记一次 .NET 某RFID标签管理系统 CPU 暴涨分析
- Leetcode: 620. interesting movies
- Leetcode: 627. Change gender
- LeetCode 每日一题 2021/11/29-2021/12/5
- Enumerate properties in objects
- 蓝队资源大合集
猜你喜欢
In his early 30s, he became a doctoral director of Fudan University. Chen Siming: I want to write both codes and poems
4G工业路由器大气环境监测方案
由浅入深详解NLP中的Adapter技术
Jackson parsing JSON detailed tutorial
"35 years old, I retired": This is the most reliable answer to the midlife crisis
助力品牌洞察——消费者情绪行为分析
MFC dialog program only runs a simple example of a single instance
MySQL optimization enforces the use of indexes
Introduction to arrays
Rongyun handles political affairs: "small grid" can also achieve "big governance"
随机推荐
Leetcode daily question 2022/3/14-2022/3/20
蓝队资源大合集
威胁狩猎大合集
Global scope and function scope
Help brand insight -- Analysis of consumers' emotional behavior
Introduction to date object
Idea Quick Start Guide
Force deduction solution summary 648 word replacement
Day4:循环结构
Several trends in the future development of software industry
Mail Informer
Force deduction solution summary 1260 two dimensional mesh migration
Terminal data protection of Internet communication security
LeetCode 每日一题 2021/12/20-2021/12/26
2022 centos8 Yum image installation & Alibaba cloud MySQL 5.7 tutorial and problem solving
A practical example of the go pipeline pattern -- calculating the MD5 value of a series of files
LeetCode 每日一题 2022/3/21-2022/3/27
Leetcode: 596. Classes with more than 5 students
LeetCode 每日一题 2022/2/7-2022/2/13
Go 中的基础库Time时间处理