python中dir命令_Pytes及Allure常用命令

pytest常用命令:

pytest --help:查看帮助文档,当不记得命令时,使用此命令即可,常用

c39615352901a9b9234341be08b08f64.png

参数:-s

运行过程中执行print打印函数:pytest -s

61dec0544dbbd1e1496dde78f0d7fcc2.png

参数: --collect-only 或 --co

收集将要执行的用例,但不会执行用例:pytest --collcet-onty,可以使用这个参数查看一下命令是否正确,是否能够收集到指定的测试用例

cfa7996bc2120831c4c795dcecd730aa.png

参数:-k args(可以是py文件名,也可以是函数名)

运行包含关键词的用例:pytest -k change,如图:

cb3d6ea1fe48bc30c7d26912942c5432.png

参数:-v / --verbose 或 -q / --quiet

打印用例执行的详细或简略过程,pytest -v ,pytest -q

3795a412548cc5868c56b5c075282ae7.png

参数:pytest --html=path

生成简易html报告,path是存储报告的路径。

2a173150605b3b340854e9ec63086a40.png

参数:--alluredir=DIR 和 --clean-alluredir

--alluredir=DIR:在指定目录DIR生成allure报告

--clean-alluredir:清除alluredir如果目录存在的化

一般结合 --alluredir=DIR 命令一起使用 pytest --alluredir=./report/html --clean-alluredir

参数:-x

用例运行失败则立即停止执行

681ea0c94c29dd60b7b6567838bfb25a.png

参数:--maxfail=num

用例运行时 允许的最大失败次数,超过则立即停止,pytest --maxfail=3

f15d13569e252af116f5dead0cb19b3e.png

参数:-m 'mark1 and not mark2'

--markers 显示所有mark标记

用例运行带有mark1标记的并且不运行mark2标记的

参数:--tb=选项(选项:'auto', 'long', 'short', 'no', 'line', 'native')

用例运行失败时,展示错误的详细程度

参数:-l 或--showlocals

用例运行失败时,打印相关的局部变量,pytest -l

参数:--lf, --last-failed

只执行上次执行失败的测试

参数:--ff, --failed-first

先执行完上次失败的测试后,再执行上次正常的测试

参数:运行指定的函数(使用两对冒号 : 分隔)

pytest 模块名::类名::函数名,pytest test.py::check_ui

Allure命令:

commond: generate

生成allure报告

示例:allure generate ./report/xlm -o ./report/html -c ./report/html

参数:-c, --clean

在生成新的Allure报告之前,先清除该目录

参数: -o, --report-dir, --output

指定目录生成allure报告

commond:open

打开生成的报告,本地查看

示例:allure open ./report/html

参数:-h, --host

指定域名地址

参数:-p, --port

指定端口号

commond:serve

打开生成的报告,可对外提供在线展示

示例:allure serve./report/html

参数:-h, --host

指定域名地址

参数:-p, --port

指定端口号

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值