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. 标题,ico动态化

    //获取ico元素 var link = document.querySelector("link[rel*='icon']"); link.href = "image/ ...

  2. SQL日期查询语句

    --查询当天(1: select * from ShopOrder where datediff(day,ordTime,getdate()-1)=0 --查询当天(2:select * from i ...

  3. POJ3342 Party at Hali-Bula(树形DP)

    dp[u][0]表示不选u时在以u为根的子树中最大人数,dp[u][1]则是选了u后的最大人数: f[u][0]表示不选u时的唯一性,f[u][1]是选了u后的唯一性,值为1代表唯一,0代表不唯一. ...

  4. 洛谷P4197 Peaks (Kruskal重构树)

    读题,只经过困难值小于等于x的路径,容易想到用Kruskal重构树:又要查询第k高的山峰,我们选择用主席树求解. 先做一棵重构树,跑一遍dfs,重构树中每一个非叶子节点对应一段区间,我们开range[ ...

  5. MatrixOne从入门到实践08——SSB性能测试

    MatrixOne从入门到实践--SSB性能测试 SSB 星型模式基准测试是 OLAP 数据库性能测试的常用场景,通过本篇教程,您可以了解到如何在 MatrixOne 中实现 SSB 测试. 测试环境 ...

  6. AVX图像算法优化系列二: 使用AVX2指令集加速查表算法。

    查表算法,无疑也是一种非常常用.有效而且快捷的算法,我们在很多算法的加速过程中都能看到他的影子,在图像处理中,尤其常用,比如我们常见的各种基于直方图的增强,可以说,在photoshop中的调整菜单里8 ...

  7. python基础-较复杂数据类型预览

    1.初识列表   列表就是队列:   列表是一种有序的,且内容可重复的数据类型:   用list代表列表,也可以用list()定义一个列表,同时定义列表可以直接使用 [ ]:   python中列表是 ...

  8. Python编程之定时任务(crontab)详解

    引言 python-crontab是python模块,提供了对cron任务的访问,并使得我们可以通过python对crontab文件进行修改. 安装 pip install python-cronta ...

  9. Ubuntu 环境下安装 Docker

    系统要求 Docker目前只能运行在64位平台上,并且要求内核版本不低于3.10,实际上内核越新越好,过低的内核版本容易造成功能不稳定. 用户可以通过如下命令检查自己的内核版本详细信息: $ unam ...

  10. 方法的重写(override / overwrite)

    1.重写:子类继承父类以后,可以对父类中同名同参数的方法,进行覆盖操作 2.应用:重写以后,当创建子类对象以后,通过子类对象调用子父类中的同名同参数的方法时,实际执行的是子类重写父类的方法. 重写的规 ...