随笔分类 -  pytest

allure的介绍和使用
摘要:一、allure的介绍 二、allure报告概览 https://demo.qameta.io/allure/# 三、allure报告安装 下图为mac安装后的截图: 四、使用allure2生成更加精美的测试报告 安装allure-pytest插件: pip install allure-pytes 阅读全文

posted @ 2021-06-10 15:50 crystal1126 阅读(2025) 评论(0) 推荐(0)

pytest运行流程
摘要:pytest的整个测试分成如下6个阶段: pytest_configure 插件和conftest.py文件配置初始化等,创建session。 2、pytest_sessionstart 创建session完以后,执行collection之前的阶段。会调用pytest_report_header向t 阅读全文

posted @ 2020-07-13 14:32 crystal1126 阅读(2501) 评论(1) 推荐(1)

【转】pytest+allure详细版
摘要:转载自:https://blog.csdn.net/qq_42610167/article/details/101204066 感谢博主:天蝎座的测试之旅 文章目录 一:pytest的介绍,安装,框架结构,执行方式 1,特点 2,安装 3, pytest的框架结构 4,执行方式 二:Pytest - 阅读全文

posted @ 2020-03-30 09:52 crystal1126 阅读(9502) 评论(0) 推荐(1)

pytest失败重跑
摘要:失败重跑需要依赖pytest-rerunfailures插件,使用pip安装就行 pip install pytest-rerunfailures 用例失败重跑的方法: 在用例上添加装饰器@pytest.mark.flaky(reruns=2, reruns_delay=4) reruns为次数,r 阅读全文

posted @ 2020-03-27 13:52 crystal1126 阅读(794) 评论(0) 推荐(0)

pytest之参数化
摘要:方法: parametrize(argnames, argvalues, indirect=False, ids=None, scope=None) 常用参数: argnames:参数名 argvalues:参数对应值,类型必须为list 当参数为一个时格式:[value] 当参数个数大于一个时,格 阅读全文

posted @ 2020-03-03 16:26 crystal1126 阅读(340) 评论(0) 推荐(0)

pytest之fixture
摘要:1、定义 fixture修饰器来标记固定的工厂函数,在其他函数,模块,类或整个工程调用它时会被激活并优先执行, 通常会被用于完成预置处理和重复操作。方法:fixture(scope="function", params=None, autouse=False, ids=None, name=None 阅读全文

posted @ 2020-03-03 16:20 crystal1126 阅读(177) 评论(0) 推荐(0)

pytest常用插件
摘要:1.pytest-html: 生成测试报告 安装:pip3 install pytest-html 使用:跟在命令行里,pytest 测试文件 --html=路径/xx.html 2.pytest-ordering: 控制测试函数运行顺序 使用:@pytest.mark.run(order=x) x 阅读全文

posted @ 2020-03-01 22:11 crystal1126 阅读(181) 评论(0) 推荐(0)

pytest配置文件
摘要:pytest的配置文件通常放在测试目录下,名称为pytest.ini,命令行运行时会使用该配置文件中的配置. 配置pytest命令行运行参数 [pytest] addopts = -s ... # 空格分隔,可添加多个命令行参数 -所有参数均为插件包的参数 配置测试搜索的路径 [pytest] te 阅读全文

posted @ 2020-03-01 22:08 crystal1126 阅读(225) 评论(0) 推荐(0)

pytest用例运行及skip、xfail的使用
摘要:如何执行测试用例 (1)命令行运行pytest 运行目录下的所有用例 pytest test_reg.py 运行指定模块中的所有用例 pytest test_reg.py::TestClass::test_method 运行指定模块指定类指定用例 pytest -m tag 运行包含指定标签的所有用 阅读全文

posted @ 2020-01-21 11:32 crystal1126 阅读(616) 评论(0) 推荐(0)

标签不生效的处理方法:PytestUnknownMarkWarning: Unknown pytest.mark.wallet - is this a typo?...
摘要:今天在写代码的过程中遇到了这样一个warning:PytestUnknownMarkWarning: Unknown pytest.mark.test - is this a typo? 处理办法: 参考文档:https://docs.pytest.org/en/latest/mark.html 单 阅读全文

posted @ 2020-01-20 14:05 crystal1126 阅读(2014) 评论(0) 推荐(0)

driver在不同fixture之间共享
摘要:前言: 如果要用到fixture函数的返回值,先return出来,用例传fixture对象就能直接调用了。 fixture参数共享driver 实现场景: 1、用例开始前只打开一次浏览器 2、每个用例开始前,都打开首页,从首页开始运行 3、用例执行完成最后,关闭浏览器 实现方法 1、先定义一个dri 阅读全文

posted @ 2020-01-19 16:18 crystal1126 阅读(645) 评论(0) 推荐(1)

用例设计及运行规则
摘要:用例设计原则 文件名以test_*.py文件和*_test.py 以test_开头的函数 以Test开头的类 以test_开头的方法 所有的包pakege必须要有__init__.py文件 Cmd执行Pytest用例 1)pytest(推荐) 2)py.pytest 3)python -m pyte 阅读全文

posted @ 2020-01-19 15:27 crystal1126 阅读(195) 评论(0) 推荐(0)

导航