1.  -s    表示输出调试信息,包括print打印信息

D:\demo>pytest -s ./pytest_1
=============================================================== test session starts ================================================================
platform win32 -- Python 3.7.4, pytest-6.2.4, py-1.10.0, pluggy-0.13.1
rootdir: D:\demo
plugins: allure-pytest-2.9.43, forked-1.3.0, html-3.1.1, metadata-1.11.0, ordering-0.6, rerunfailures-10.0, xdist-2.3.0
collected 1 item pytest_1\test_login.py 登录1
. ================================================================ 1 passed in 0.07s =================================================================

pytest -s ./pytest_1

pytest.main(['-s', './pytest_1/test_login.py'])

2.   -v   表示输出用例执行详细信息

D:\demo>pytest -v ./pytest_1
=============================================================== test session starts ================================================================
platform win32 -- Python 3.7.4, pytest-6.2.4, py-1.10.0, pluggy-0.13.1 -- d:\program files\python\python37-32\python.exe
cachedir: .pytest_cache
metadata: {'Python': '3.7.4', 'Platform': 'Windows-10-10.0.17763-SP0', 'Packages': {'pytest': '6.2.4', 'py': '1.10.0', 'pluggy': '0.13.1'}, 'Plugins'
: {'allure-pytest': '2.9.43', 'forked': '1.3.0', 'html': '3.1.1', 'metadata': '1.11.0', 'ordering': '0.6', 'rerunfailures': '10.0', 'xdist': '2.3.0'}
, 'JAVA_HOME': 'D:\\Program Files\\Java\\jdk1.8.0_221'}
rootdir: D:\demo
plugins: allure-pytest-2.9.43, forked-1.3.0, html-3.1.1, metadata-1.11.0, ordering-0.6, rerunfailures-10.0, xdist-2.3.0
collected 1 item pytest_1/test_login.py::TestLogin::test_08_loogin1 PASSED [100%] ================================================================ 1 passed in 0.03s =================================================================

pytest -v ./pytest_1

pytest.main(['-v', './pytest_1/test_login.py'])

3.   -vs  表示既输出调试信息同时输出执行详细信息

D:\demo>pytest -vs ./pytest_1
=============================================================== test session starts ================================================================
platform win32 -- Python 3.7.4, pytest-6.2.4, py-1.10.0, pluggy-0.13.1 -- d:\program files\python\python37-32\python.exe
cachedir: .pytest_cache
metadata: {'Python': '3.7.4', 'Platform': 'Windows-10-10.0.17763-SP0', 'Packages': {'pytest': '6.2.4', 'py': '1.10.0', 'pluggy': '0.13.1'}, 'Plugins'
: {'allure-pytest': '2.9.43', 'forked': '1.3.0', 'html': '3.1.1', 'metadata': '1.11.0', 'ordering': '0.6', 'rerunfailures': '10.0', 'xdist': '2.3.0'}
, 'JAVA_HOME': 'D:\\Program Files\\Java\\jdk1.8.0_221'}
rootdir: D:\demo
plugins: allure-pytest-2.9.43, forked-1.3.0, html-3.1.1, metadata-1.11.0, ordering-0.6, rerunfailures-10.0, xdist-2.3.0
collected 1 item pytest_1/test_login.py::TestLogin::test_08_loogin1 登录1
PASSED ================================================================ 1 passed in 0.03s =================================================================

pytest -vs ./pytest_1

pytest.main(['-vs', './pytest_1/test_login.py'])

4.   -n   支持多线程或者分布式运行测试用例

D:\demo>pytest -vs ./pytest_1 -n 2
=============================================================== test session starts ================================================================
platform win32 -- Python 3.7.4, pytest-6.2.4, py-1.10.0, pluggy-0.13.1 -- d:\program files\python\python37-32\python.exe
cachedir: .pytest_cache
metadata: {'Python': '3.7.4', 'Platform': 'Windows-10-10.0.17763-SP0', 'Packages': {'pytest': '6.2.4', 'py': '1.10.0', 'pluggy': '0.13.1'}, 'Plugins'
: {'allure-pytest': '2.9.43', 'forked': '1.3.0', 'html': '3.1.1', 'metadata': '1.11.0', 'ordering': '0.6', 'rerunfailures': '10.0', 'xdist': '2.3.0'}
, 'JAVA_HOME': 'D:\\Program Files\\Java\\jdk1.8.0_221'}
rootdir: D:\demo
plugins: allure-pytest-2.9.43, forked-1.3.0, html-3.1.1, metadata-1.11.0, ordering-0.6, rerunfailures-10.0, xdist-2.3.0
[gw0] win32 Python 3.7.4 cwd: D:\demo
[gw1] win32 Python 3.7.4 cwd: D:\demo
[gw0] Python 3.7.4 (tags/v3.7.4:e09359112e, Jul 8 2019, 19:29:22) [MSC v.1916 32 bit (Intel)]
[gw1] Python 3.7.4 (tags/v3.7.4:e09359112e, Jul 8 2019, 19:29:22) [MSC v.1916 32 bit (Intel)]
gw0 [4] / gw1 [4]
scheduling tests via LoadScheduling pytest_1/test_login.py::TestLogin::test_07_login2
pytest_1/test_login.py::TestLogin::test_08_loogin1
[gw0] PASSED pytest_1/test_login.py::TestLogin::test_07_login2
pytest_1/test_login.py::TestLogin::test_09_login3
[gw1] PASSED pytest_1/test_login.py::TestLogin::test_08_loogin1
[gw0] PASSED pytest_1/test_login.py::TestLogin::test_09_login3
pytest_1/test_login.py::TestLogin::test_01_login4
[gw1] PASSED pytest_1/test_login.py::TestLogin::test_01_login4 ================================================================ 4 passed in 1.61s =================================================================

pytest -vs ./pytest_1 -n 2

pytest.main(['-vs', './pytest_1/test_login.py', '-n=2'])

5.  --reruns   失败用例重跑

D:\demo>pytest -vs ./pytest_1/test_login.py --reruns 2
=============================================================== test session starts ================================================================
platform win32 -- Python 3.7.4, pytest-6.2.4, py-1.10.0, pluggy-0.13.1 -- d:\program files\python\python37-32\python.exe
cachedir: .pytest_cache
metadata: {'Python': '3.7.4', 'Platform': 'Windows-10-10.0.17763-SP0', 'Packages': {'pytest': '6.2.4', 'py': '1.10.0', 'pluggy': '0.13.1'}, 'Plugins'
: {'allure-pytest': '2.9.43', 'forked': '1.3.0', 'html': '3.1.1', 'metadata': '1.11.0', 'ordering': '0.6', 'rerunfailures': '10.0', 'xdist': '2.3.0'}
, 'JAVA_HOME': 'D:\\Program Files\\Java\\jdk1.8.0_221'}
rootdir: D:\demo
plugins: allure-pytest-2.9.43, forked-1.3.0, html-3.1.1, metadata-1.11.0, ordering-0.6, rerunfailures-10.0, xdist-2.3.0
collected 1 item pytest_1/test_login.py::TestLogin::test_08_loogin1 登录1
RERUN
pytest_1/test_login.py::TestLogin::test_08_loogin1 登录1
RERUN
pytest_1/test_login.py::TestLogin::test_08_loogin1 登录1
FAILED ===================================================================== FAILURES =====================================================================
____________________________________________________________ TestLogin.test_08_loogin1 _____________________________________________________________ self = <pytest_1.test_login.TestLogin object at 0x04271DF0> @pytest.mark.run(order=3)
def test_08_loogin1(self):
print("登录1")
> assert 1 == 2
E assert 1 == 2
E +1
E -2 pytest_1\test_login.py:10: AssertionError
============================================================= short test summary info ==============================================================
FAILED pytest_1/test_login.py::TestLogin::test_08_loogin1 - assert 1 == 2
============================================================ 1 failed, 2 rerun in 0.11s ============================================================

pytest -vs ./pytest_1/test_login.py --reruns 2

pytest.main(['-vs', './pytest_1/test_login.py', '--reruns=2'])

6.   -x   只要存在失败用例则停止执行

D:\demo>pytest -vs ./pytest_1/test_login.py -x
=============================================================== test session starts ================================================================
platform win32 -- Python 3.7.4, pytest-6.2.4, py-1.10.0, pluggy-0.13.1 -- d:\program files\python\python37-32\python.exe
cachedir: .pytest_cache
metadata: {'Python': '3.7.4', 'Platform': 'Windows-10-10.0.17763-SP0', 'Packages': {'pytest': '6.2.4', 'py': '1.10.0', 'pluggy': '0.13.1'}, 'Plugins'
: {'allure-pytest': '2.9.43', 'forked': '1.3.0', 'html': '3.1.1', 'metadata': '1.11.0', 'ordering': '0.6', 'rerunfailures': '10.0', 'xdist': '2.3.0'}
, 'JAVA_HOME': 'D:\\Program Files\\Java\\jdk1.8.0_221'}
rootdir: D:\demo
plugins: allure-pytest-2.9.43, forked-1.3.0, html-3.1.1, metadata-1.11.0, ordering-0.6, rerunfailures-10.0, xdist-2.3.0
collected 4 items pytest_1/test_login.py::TestLogin::test_07_login2 登录2
PASSED
pytest_1/test_login.py::TestLogin::test_08_loogin1 登录1
FAILED ===================================================================== FAILURES =====================================================================
____________________________________________________________ TestLogin.test_08_loogin1 _____________________________________________________________ self = <pytest_1.test_login.TestLogin object at 0x0423D3D0> @pytest.mark.run(order=3)
def test_08_loogin1(self):
print("登录1")
> assert 1 == 2
E assert 1 == 2
E +1
E -2 pytest_1\test_login.py:10: AssertionError
============================================================= short test summary info ==============================================================
FAILED pytest_1/test_login.py::TestLogin::test_08_loogin1 - assert 1 == 2
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
=========================================================== 1 failed, 1 passed in 0.11s ============================================================

pytest -vs ./pytest_1/test_login.py -x

pytest.main(['-vs', './pytest_1/test_login.py', '-x'])

7.   --maxfail   只要存在max个失败用例则停止执行

D:\demo>pytest -vs ./pytest_1/test_login.py --maxfail 2
=============================================================== test session starts ================================================================
platform win32 -- Python 3.7.4, pytest-6.2.4, py-1.10.0, pluggy-0.13.1 -- d:\program files\python\python37-32\python.exe
cachedir: .pytest_cache
metadata: {'Python': '3.7.4', 'Platform': 'Windows-10-10.0.17763-SP0', 'Packages': {'pytest': '6.2.4', 'py': '1.10.0', 'pluggy': '0.13.1'}, 'Plugins'
: {'allure-pytest': '2.9.43', 'forked': '1.3.0', 'html': '3.1.1', 'metadata': '1.11.0', 'ordering': '0.6', 'rerunfailures': '10.0', 'xdist': '2.3.0'}
, 'JAVA_HOME': 'D:\\Program Files\\Java\\jdk1.8.0_221'}
rootdir: D:\demo
plugins: allure-pytest-2.9.43, forked-1.3.0, html-3.1.1, metadata-1.11.0, ordering-0.6, rerunfailures-10.0, xdist-2.3.0
collected 4 items pytest_1/test_login.py::TestLogin::test_07_login2 登录2
PASSED
pytest_1/test_login.py::TestLogin::test_08_loogin1 登录1
FAILED
pytest_1/test_login.py::TestLogin::test_09_login3 登录3
PASSED
pytest_1/test_login.py::TestLogin::test_01_login4 登录4
PASSED ===================================================================== FAILURES =====================================================================
____________________________________________________________ TestLogin.test_08_loogin1 _____________________________________________________________ self = <pytest_1.test_login.TestLogin object at 0x04CAEFB0> @pytest.mark.run(order=3)
def test_08_loogin1(self):
print("登录1")
> assert 1 == 2
E assert 1 == 2
E +1
E -2 pytest_1\test_login.py:10: AssertionError
============================================================= short test summary info ==============================================================
FAILED pytest_1/test_login.py::TestLogin::test_08_loogin1 - assert 1 == 2
=========================================================== 1 failed, 3 passed in 0.08s ============================================================

pytest -vs ./pytest_1/test_login.py --maxfail 2

pytest.main(['-vs', './pytest_1/test_login.py', '--maxfail=2'])

8.  -k   根据测试用例的部分字符串执行用例

D:\demo>pytest -vs ./pytest_1/test_login.py -k "oo"
=============================================================== test session starts ================================================================
platform win32 -- Python 3.7.4, pytest-6.2.4, py-1.10.0, pluggy-0.13.1 -- d:\program files\python\python37-32\python.exe
cachedir: .pytest_cache
metadata: {'Python': '3.7.4', 'Platform': 'Windows-10-10.0.17763-SP0', 'Packages': {'pytest': '6.2.4', 'py': '1.10.0', 'pluggy': '0.13.1'}, 'Plugins'
: {'allure-pytest': '2.9.43', 'forked': '1.3.0', 'html': '3.1.1', 'metadata': '1.11.0', 'ordering': '0.6', 'rerunfailures': '10.0', 'xdist': '2.3.0'}
, 'JAVA_HOME': 'D:\\Program Files\\Java\\jdk1.8.0_221'}
rootdir: D:\demo
plugins: allure-pytest-2.9.43, forked-1.3.0, html-3.1.1, metadata-1.11.0, ordering-0.6, rerunfailures-10.0, xdist-2.3.0
collected 4 items / 3 deselected / 1 selected pytest_1/test_login.py::TestLogin::test_08_loogin1 登录1
FAILED ===================================================================== FAILURES =====================================================================
____________________________________________________________ TestLogin.test_08_loogin1 _____________________________________________________________ self = <pytest_1.test_login.TestLogin object at 0x045420B0> @pytest.mark.run(order=3)
def test_08_loogin1(self):
print("登录1")
> assert 1 == 2
E assert 1 == 2
E +1
E -2 pytest_1\test_login.py:10: AssertionError
============================================================= short test summary info ==============================================================
FAILED pytest_1/test_login.py::TestLogin::test_08_loogin1 - assert 1 == 2
========================================================= 1 failed, 3 deselected in 0.07s ==========================================================

pytest -vs ./pytest_1/test_login.py -k "oo"

pytest.main(['-vs', './pytest_1/test_login.py', '-k=oo'])

9. --html 生成测试报告

D:\demo>pytest --html ./reports/report.html
=============================================================== test session starts ================================================================
platform win32 -- Python 3.7.4, pytest-6.2.4, py-1.10.0, pluggy-0.13.1 -- d:\program files\python\python37-32\python.exe
cachedir: .pytest_cache
metadata: {'Python': '3.7.4', 'Platform': 'Windows-10-10.0.17763-SP0', 'Packages': {'pytest': '6.2.4', 'py': '1.10.0', 'pluggy': '0.13.1'}, 'Plugins'
: {'allure-pytest': '2.9.43', 'forked': '1.3.0', 'html': '3.1.1', 'metadata': '1.11.0', 'ordering': '0.6', 'rerunfailures': '10.0', 'xdist': '2.3.0'}
, 'JAVA_HOME': 'D:\\Program Files\\Java\\jdk1.8.0_221'}
rootdir: D:\demo, configfile: pytest.ini, testpaths: ./pytest_1
plugins: allure-pytest-2.9.43, forked-1.3.0, html-3.1.1, metadata-1.11.0, ordering-0.6, rerunfailures-10.0, xdist-2.3.0
collected 4 items pytest_1/test_login.py::TestLogin::test_07_login2 登录2
PASSED
pytest_1/test_login.py::TestLogin::test_08_loogin1 登录1
PASSED
pytest_1/test_login.py::TestLogin::test_09_login3 SKIPPED (大于18跳过)
pytest_1/test_login.py::TestLogin::test_01_login4 登录4
PASSED ================================================================= warnings summary =================================================================
pytest_1\test_login.py:22
D:\demo\pytest_1\test_login.py:22: PytestUnknownMarkWarning: Unknown pytest.mark.usermanager - is this a typo? You can register custom marks to av
oid this warning - for details, see https://docs.pytest.org/en/stable/mark.html
@pytest.mark.usermanager -- Docs: https://docs.pytest.org/en/stable/warnings.html
--------------------------------------------- generated html file: file://D:\demo\reports\report.html ----------------------------------------------
===================================================== 3 passed, 1 skipped, 1 warning in 0.05s ======================================================

pytest --html ./reports/report.html

pytest常用参数汇总的更多相关文章

  1. hive set 常用参数汇总

    1. set hive.auto.convert.join = true; mapJoin的主要意思就是,当链接的两个表是一个比较小的表和一个特别大的表的时候,我们把比较小的table直接放到内存中去 ...

  2. Django框架ORM常用参数汇总_模型层

    primary_key 如果为True,那么这个字段就是模型的主键. 如果你没有指定任何一个字段的primary_key=True, Django就会自动添加一个IntegerField字段做为主键, ...

  3. 20145222《信息安全系统设计基础》Linux常用命令汇总

    学习Linux时常用命令汇总 通过Ctrl+f键可在该网页搜索到你想要的命令. Linux中命令格式为:command [options] [arguments] //中括号代表是可选的,即有些命令不 ...

  4. Oozie命令行常用命令汇总[转]

    Oozie命令行常用命令汇总 有时候脚本跑多了就不愿意在OozieWeb端去看脚本的运行情况了.还好Oozie提供了很多命令行命令.能通过命令行直接检索自己想看到的脚本信息.在这里简单进行一下总结.一 ...

  5. JavaScript之Array常用函数汇总

    [20141121]JavaScript之Array常用功能汇总 *:first-child { margin-top: 0 !important; } body>*:last-child { ...

  6. JVM参数汇总

    一.java启动参数共分为三类: 其一是标准参数(-),所有的JVM实现都必须实现这些参数的功能,而且向后兼容:其二是非标准参数(-X),默认jvm实现这些参数的功能,但是并不保证所有jvm实现都满足 ...

  7. 【PHP】最详细PHP从入门到精通(三)——PHP中的数组常用函数汇总

     PHP从入门到精通 之PHP中的数组常用函数详解 数组作为PHP中最常用的结构之一,PHP强大的数组函数功能,给数组的相关操作带来了极大的便利.今天给大家介绍的PHP中数组函数,是PHP数组中重要的 ...

  8. AngularJS进阶(十二)AngularJS常用知识汇总(不断更新中....)

    AngularJS常用知识汇总(不断更新中....) 注:请点击此处进行充电! app.controller('editCtrl',['$http','$location','$rootScope', ...

  9. hadoop记录-Hadoop参数汇总

    Hadoop参数汇总 linux参数 以下参数最好优化一下: 文件描述符ulimit -n 用户最大进程 nproc (hbase需要 hbse book) 关闭swap分区 设置合理的预读取缓冲区 ...

  10. Linux系统IO分析工具之iotop常用参数介绍

      Linux系统IO分析工具之iotop常用参数介绍 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 在一般运维工作中经常会遇到这么一个场景,服务器的IO负载很高(iostat中的 ...

随机推荐

  1. PAT (Basic Level) Practice 1004 成绩排名 分数 20

    读入 n(>0)名学生的姓名.学号.成绩,分别输出成绩最高和成绩最低学生的姓名和学号. 输入格式: 每个测试输入包含 1 个测试用例,格式为 第 1 行:正整数 n 第 2 行:第 1 个学生的 ...

  2. DateSet的应用

    一.知识描述 1.什么是DataSet? DataSet为一个数据集,可以看做是一个内存中的数据库,包括表.数据行.数据列以及表与表之间的关系. 创建一个DataSet后,它可以单独存在,不需要一直保 ...

  3. P7113 [NOIP2020] 排水系统 (拓扑排序)

    (不想打高精,也不想学习其他大佬的神仙写法,打了90分的错解). 本题容易想到用拓扑排序处理,涉及分数的加法,用long long会超时,不过通分时先除后乘卡一下也可以拿90分. 结构体真是个复杂的东 ...

  4. gradle项目对比maven项目的目录架构以及对gradle wrapper的理解

    转载请注明出处: 1.使用 idea 搭建 gradle项目 注意 type 选择 gradle 以及 language 选择 grooy                       搭建后的项目架构 ...

  5. RAID5 IO处理之对齐读代码详解

    1 总体流程 当一个读请求的覆盖范围落在一个chunk范围内时为对齐读,流程图如下所示: 2 入口 在RAID5的IO处理函数 make_request() 一开始进行了对齐读的判断和处理,代码如下所 ...

  6. 10.pygame-碰撞检测

    添加并监听英雄发射子弹事件 class Hero(GameSprite): def __init__(self): # 调用父类方法,设置image super().__init__('./image ...

  7. python删除某一文件夹下的重复文件

    #2022-10-28 import hashlib import os import time def getmd5(filename): """ 获取文件 md5 码 ...

  8. Mysql+Mycat+NFS+Rsync+LVS+DNS+IPtables综合实验

    1.环境准备 服务器 IP地址 作用 系统版本 Mysql-master eth0:10.0.0.58 主数据库 Rocky8.6 Mysql-slave1 eth0:10.0.0.68 备数据库 R ...

  9. Java 多线程写zip文件遇到的错误 write beyond end of stream!

    最近在写一个大量小文件直接压缩到一个zip的需求,由于zip中的entry每一个都是独立的,不需要追加写入,也就是一个entry文件,写一个内容, 因此直接使用了多线程来处理,结果就翻车了,代码给出了 ...

  10. 我要涨知识 —— TypeScript 常见面试题(一)

    1.ts 中的 any 和 unknown 有什么区别? unknown 和 any 的主要区别是 unknown 类型会更加严格:在对 unknown 类型的值执行大多数操作之前,我们必须进行某种形 ...