上一页 1 2 3 4 5 6 ··· 10 下一页
摘要: 并行测试 多cpu并行执行用例,直接加个-n参数即可,后面num参数就是并行数量,比如num设置为3: pytest -n 3 使用pytest-xdist插件也能生成html报告,完美支持pytest-html插件 pytest -n 3 --html=report.html --self-con 阅读全文
posted @ 2020-07-04 15:53 wakey 阅读(356) 评论(0) 推荐(0) 编辑
摘要: pytest -h 命令行输入pytest -h,找到里面两个命令行参数: --lf 和 --ff --lf, --last-failed 只重新运行上次运行失败的用例(或如果没有失败的话会全部跑) --ff, --failed-first 运行所有测试,但首先运行上次运行失败的测试(这可能会重新测 阅读全文
posted @ 2020-07-04 15:40 wakey 阅读(206) 评论(0) 推荐(0) 编辑
摘要: 使用pip安装pytest-repeat pip install pytest -repeat 重复执行--count 命令行执行:pytest baidu/test_1_baidu.py -s --count=5 文件中写参数执行 在代码中标记要重复多次的测试 @pytest.mark.repea 阅读全文
posted @ 2020-07-04 15:26 wakey 阅读(1413) 评论(0) 推荐(0) 编辑
摘要: 1、bson.ObjectId转为str: 取'_id'中的值 2、通过_id 查询数据库 from bson import ObjectId 阅读全文
posted @ 2020-07-03 22:23 wakey 阅读(473) 评论(0) 推荐(0) 编辑
摘要: 将用装饰器传参的参数值打印到报告中 步骤1: ids是一个list,且里面每一个元素都要是str ids = ['{}'.format(data) for data in testData] #testData 为参数列表 @pytest.mark.parametrize("datajson",te 阅读全文
posted @ 2020-06-30 13:55 wakey 阅读(446) 评论(0) 推荐(0) 编辑
摘要: 在conftest.py中实现 @pytest.mark.optionalhookdef pytest_html_results_summary(prefix, summary, postfix): prefix.extend([html.p("测试人: 电商测试组")])@pytest.mark. 阅读全文
posted @ 2020-06-28 23:47 wakey 阅读(1229) 评论(1) 推荐(1) 编辑
摘要: 1、打开cmd,cd到需要执行pytest用例的目录,执行指令:pytest --html=report.html 2、指定报告的path 执行指令: pytest --html=./report/report.html #相对路径,也可指定绝对路径 报告独立显示 上面方法生成的报告,css是独立的 阅读全文
posted @ 2020-06-28 23:05 wakey 阅读(185) 评论(0) 推荐(0) 编辑
摘要: fixture里面有个参数autouse,默认是Fasle没开启的,可以设置为True开启自动使用fixture功能,这样用例就不用每次都去传参了 调用fixture三种方法 1.函数或类里面方法直接传fixture的函数参数名称 2.使用装饰器@pytest.mark.usefixtures()修 阅读全文
posted @ 2020-06-28 22:23 wakey 阅读(2983) 评论(0) 推荐(0) 编辑
摘要: # -*- coding: utf-8 -*-from httprunner.api import HttpRunnerfrom httprunner.report import gen_html_report# 1、创建HttpRunner对象# failfast当用例执行失败之后,会自动暂停,默 阅读全文
posted @ 2020-06-28 13:38 wakey 阅读(772) 评论(0) 推荐(0) 编辑
摘要: mark标记 1.以下用例,标记test_send_http()为webtest # content of test_server.py import pytest @pytest.mark.webtest def test_send_http(): pass # perform some webt 阅读全文
posted @ 2020-06-27 23:20 wakey 阅读(357) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 ··· 10 下一页