摘要: 作用 实现前置步骤功能,方便用例调用 使用 装饰器:@pytest.fixture() import pytest @pytest.fixture() def fixture1(): print("\nfixture function 1") @pytest.fixture() def fixtur 阅读全文
posted @ 2021-12-06 10:32 漓白白" 阅读(42) 评论(0) 推荐(0) 编辑
摘要: 功能、步骤命名 功能名称:@allure.feature("功能名称") 子功能名称:@allure.story("子功能名称") 步骤细节:@allure.step("步骤细节") 按名称选择用例 根据功能名称选择:pytest 文件名 --allure-features "功能名称" 根据子功能 阅读全文
posted @ 2021-12-06 03:46 漓白白" 阅读(93) 评论(0) 推荐(0) 编辑
摘要: 先看看 allure 命令的帮助文档 cmd 敲 allure -h allure 命令的语法格式 allure [options] [command] [command options] options 列表 Options: --help 命令行帮助文档 -q, --quiet 切换至安静模式 阅读全文
posted @ 2021-12-06 00:14 漓白白" 阅读(98) 评论(0) 推荐(0) 编辑
摘要: java jdk 作用:allure运行依赖java jdk,否则运行allure时会报错 下载:java_jdk_1.8.0 allure 作用:allure服务,展示测试报告 下载:allure-commandline allure-pytest 作用:python代码中调用pytest,完成测 阅读全文
posted @ 2021-12-05 11:14 漓白白" 阅读(32) 评论(0) 推荐(0) 编辑
摘要: 参数化装饰器:@pytest.mark.parametrize("参数", 参数列表, ids=用例命名) import pytest import yaml # 单个参数 @pytest.mark.parametrize('num', [1, 2, 3, 4, 5]) def test_serch 阅读全文
posted @ 2021-12-05 02:11 漓白白" 阅读(31) 评论(0) 推荐(0) 编辑
摘要: 总览 执行顺序 类外 setup_moudle setup_function case teardown_function teardown_moudle 类中 setup_moudle setup_class setup_method setup case teardown teardown_me 阅读全文
posted @ 2021-12-05 02:03 漓白白" 阅读(37) 评论(0) 推荐(0) 编辑
摘要: #pytest执行 选择用例 执行所有用例:pytest 包名/模块名 执行某个类用例:pytest 文件名.py类名 执行某个方法用例:pytest 文件名.py类名方法名 执行某个函数用例:pytest 文件名.py函数名 执行参数 查看帮助文档:pytest --help 打印执行详情:pyt 阅读全文
posted @ 2021-12-05 01:50 漓白白" 阅读(106) 评论(0) 推荐(0) 编辑
摘要: 文件:test_开头、_test结尾 类名:Test 开头 方法/函数:test_开头 pytest运行时,会自动查找符合命名规范的代码,执行用例 阅读全文
posted @ 2021-12-05 01:47 漓白白" 阅读(46) 评论(0) 推荐(0) 编辑
摘要: python文件:demo.py # content of test_sample.py def inc(x): return x + 1 def test_answer(): assert inc(3) == 5 运行方法 在终端中,执行pytest demo.py 阅读全文
posted @ 2021-12-03 18:35 漓白白" 阅读(30) 评论(0) 推荐(0) 编辑
摘要: 下载 pip install pytest 运行 修改pycharm默认执行方式 阅读全文
posted @ 2021-12-03 18:33 漓白白" 阅读(26) 评论(0) 推荐(0) 编辑