随笔分类 - pytest
摘要:1:下载zip包 https://github.com/allure-framework/allure2/releases 2:解压allure,并把bin目录配置环境变量,allure --version验证 3:安装allure-pytest python3 -m pip install all
阅读全文
摘要:一:conftest文件(必须与要运行的用例在同一包下,并且有__init__py文件)import pytest1:#那个用例执行传函数名@pytest.fixture()def login01(): print('登录')2:#全部用例都自动执行@pytest.fixture(autouse=T
阅读全文
摘要:1:安装yaml python3 -m pip install pyyaml 2:加载yaml文件 yaml.safe_load(open('./data.yaml') 3:yaml文件 1:大小写敏感 2:缩进的空格数不重要,只要相同层级的元素左对齐即可 3:'#'表示注释 列表-后面要加一个空格
阅读全文
摘要:fixture的优势 命名方式灵活,不局限于 setup 和teardown 这几个命名 conftest.py 配置里可以实现数据共享,不需要 import 就能自动找到fixture scope="module" 可以实现多个.py 跨文件共享前置 scope="session" 以实现多个.p
阅读全文
摘要:1:多线程执行(用例没有依赖,没有顺序,独立运行) 1:安装 python3 -m pip install pytest-xdist 2:运行 -n 3(指定并行数) pytest -v -n 2 2:Pytest-html生成报告 1:安装 python3 -m pip install pytes
阅读全文
摘要:1:pytest安装 python3 -m pip install pytest 验证:pytest --version 2:pytest测试用例的识别与运行 识别: 1:测试文件(模块)以test_*.py或*_test.py 2:测试类以Test*命名,测试用例以test_*的方法, 3:不在测
阅读全文