全栈自动化测试之pytest常用命令行参数_--multiproc是 python3

assert True

D:\tools\pycharm\pythonProject1>pytest -x 自动化 -v
========================================================================================================== test session starts ===========================================================================================================
platform win32 – Python 3.8.0, pytest-7.1.3, pluggy-1.0.0 – d:\tools\python3.8\python.exe
cachedir: .pytest_cache
metadata: {‘Python’: ‘3.8.0’, ‘Platform’: ‘Windows-7-6.1.7601-SP1’, ‘Packages’: {‘pytest’: ‘7.1.3’, ‘py’: ‘1.11.0’, ‘pluggy’: ‘1.0.0’}, ‘Plugins’: {‘html’: ‘3.1.1’, ‘metadata’: ‘2.0.2’}, ‘JAVA_HOME’: ‘C:\Program Files (x86)\Java\jdk
1.8.0_111’}
rootdir: D:\tools\pycharm\pythonProject1
plugins: html-3.1.1, metadata-2.0.2
collected 4 items

自动化/测试pytest参数/test_demo.py::TestDemo::test_one PASSED [ 25%]
自动化/测试pytest参数/test_demo.py::TestDemo::test_two FAILED [ 50%]

================================================================================================================ FAILURES ================================================================================================================
___________________________________________________________________________________________________________ TestDemo.test_two ____________________________________________________________________________________________________________

self = <test_demo.TestDemo object at 0x00000000037463D0>

def test_two(self):

assert False
E assert False

自动化\测试pytest参数\test_demo.py:8: AssertionError
======================================================================================================== short test summary info =========================================================================================================
FAILED 自动化/测试pytest参数/test_demo.py::TestDemo::test_two - assert False
!!! stopping after 1 failures !!!
====================================================================================================== 1 failed, 1 passed in 0.43s =======================================================================================================

-v 显示执行的详细信息

D:\tools\pycharm\pythonProject1>pytest -x 自动化 -v
========================================================================================================== test session starts ===========================================================================================================
platform win32 – Python 3.8.0, pytest-7.1.3, pluggy-1.0.0 – d:\tools\python3.8\python.exe
cachedir: .pytest_cache
metadata: {‘Python’: ‘3.8.0’, ‘Platform’: ‘Windows-7-6.1.7601-SP1’, ‘Packages’: {‘pytest’: ‘7.1.3’, ‘py’: ‘1.11.0’, ‘pluggy’: ‘1.0.0’}, ‘Plugins’: {‘html’: ‘3.1.1’, ‘metadata’: ‘2.0.2’}, ‘JAVA_HOME’: ‘C:\Program Files (x86)\Java\jdk
1.8.0_111’}
rootdir: D:\tools\pycharm\pythonProject1
plugins: html-3.1.1, metadata-2.0.2
collected 4 items

自动化/测试pytest参数/test_demo.py::TestDemo::test_one PASSED [ 25%]
自动化/测试pytest参数/test_demo.py::TestDemo::test_two FAILED [ 50%]

–maxfail=num  最大失败次数,当超过最大失败次数就不在往下执行

D:\tools\pycharm\pythonProject1>pytest -v --maxfail=1 自动化
========================================================================================================== test session starts ===========================================================================================================
platform win32 – Python 3.8.0, pytest-7.1.3, pluggy-1.0.0 – d:\tools\python3.8\python.exe
cachedir: .pytest_cache
metadata: {‘Python’: ‘3.8.0’, ‘Platform’: ‘Windows-7-6.1.7601-SP1’, ‘Packages’: {‘pytest’: ‘7.1.3’, ‘py’: ‘1.11.0’, ‘pluggy’: ‘1.0.0’}, ‘Plugins’: {‘html’: ‘3.1.1’, ‘metadata’: ‘2.0.2’}, ‘JAVA_HOME’: ‘C:\Program Files (x86)\Java\jdk
1.8.0_111’}
rootdir: D:\tools\pycharm\pythonProject1
plugins: html-3.1.1, metadata-2.0.2
collected 4 items

自动化/测试pytest参数/test_demo.py::TestDemo::test_one PASSED [ 25%]
自动化/测试pytest参数/test_demo.py::TestDemo::test_two FAILED [ 50%]

================================================================================================================ FAILURES ================================================================================================================
___________________________________________________________________________________________________________ TestDemo.test_two ____________________________________________________________________________________________________________

self = <test_demo.TestDemo object at 0x0000000003744490>

def test_two(self):

assert False
E assert False

自动化\测试pytest参数\test_demo.py:8: AssertionError
======================================================================================================== short test summary info =========================================================================================================
FAILED 自动化/测试pytest参数/test_demo.py::TestDemo::test_two - assert False
!!! stopping after 1 failures !!!
====================================================================================================== 1 failed, 1 passed in 0.46s =======================================================================================================

D:\tools\pycharm\pythonProject1>

-s 代码中的打印输出

class TestDemo:
def test_one(self):
print(“Hello test Demo one”)
assert True

D:\tools\pycharm\pythonProject1>pytest -v 自动化 -s
========================================================================================================== test session starts ===========================================================================================================
platform win32 – Python 3.8.0, pytest-7.1.3, pluggy-1.0.0 – d:\tools\python3.8\python.exe
cachedir: .pytest_cache
metadata: {‘Python’: ‘3.8.0’, ‘Platform’: ‘Windows-7-6.1.7601-SP1’, ‘Packages’: {‘pytest’: ‘7.1.3’, ‘py’: ‘1.11.0’, ‘pluggy’: ‘1.0.0’}, ‘Plugins’: {‘html’: ‘3.1.1’, ‘metadata’: ‘2.0.2’}, ‘JAVA_HOME’: ‘C:\Program Files (x86)\Java\jdk
1.8.0_111’}
rootdir: D:\tools\pycharm\pythonProject1
plugins: html-3.1.1, metadata-2.0.2
collected 4 items

自动化/测试pytest参数/test_demo.py::TestDemo::test_one Hello test Demo one
PASSED
自动化/测试pytest参数/test_demo.py::TestDemo::test_two FAILED
自动化/测试pytest参数/test_demo.py::TestDemo::test_three PASSED
自动化/测试pytest参数/test_demo.py::TestDemo::test_four FAILED

–lf 只运行失败的

D:\tools\pycharm\pythonProject1>pytest -v --lf 自动化

–ff   失败成功的都运行

D:\tools\pycharm\pythonProject1>pytest -v --ff 自动化

–tb=no 不显示具体的失败信息
pytest -v --tb=no 自动化

重点:学习资料学习当然离不开资料,这里当然也给你们准备了600G的学习资料

【需要的可以扫描文章末尾的qq群二维码自助拿走】

【记得(备注“csdn000”)】

【或私信000】

群里的免费资料都是笔者十多年测试生涯的精华。还有同行大神一起交流技术哦。

项目实战:

大型电商平台:

全套软件测试自动化测试教学视频

300G教程资料下载【视频教程+PPT+项目源码】

自我介绍一下,小编13年上海交大毕业,曾经在小公司待过,也去过华为、OPPO等大厂,18年进入阿里一直到现在。

深知大多数软件测试工程师,想要提升技能,往往是自己摸索成长或者是报班学习,但对于培训机构动则几千的学费,着实压力不小。自己不成体系的自学效果低效又漫长,而且极易碰到天花板技术停滞不前!

因此收集整理了一份《2024年软件测试全套学习资料》,初衷也很简单,就是希望能够帮助到想自学提升又不知道该从何学起的朋友,同时减轻大家的负担。
img
img
img
img
img

既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,基本涵盖了95%以上软件测试开发知识点,真正体系化!

由于文件比较大,这里只是将部分目录大纲截图出来,每个节点里面都包含大厂面经、学习笔记、源码讲义、实战项目、讲解视频,并且后续会持续更新

如果你觉得这些内容对你有帮助,可以添加V获取:vip1024b (备注软件测试)
img

一个人可以走的很快,但一群人才能走的更远。不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎扫码加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!

讲义、实战项目、讲解视频,并且后续会持续更新**

如果你觉得这些内容对你有帮助,可以添加V获取:vip1024b (备注软件测试)
[外链图片转存中…(img-87VASFq0-1713014192406)]

一个人可以走的很快,但一群人才能走的更远。不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎扫码加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值