随笔分类 - Pytest
摘要:pytest自带报告 pytest可以生成junit格式的xml报告和HTML报告,命令如下: pytest test_demo.py --junitxml=report.xml pytest test_demo.py --html=report.html #需要安装插件:pip install p
阅读全文
摘要:pytest可以生成junit格式的xml报告和HTML报告,命令如下: pytest test_demo.py --junitxml=report.xml pytest test_demo.py --html=report.html #需要安装插件:pip install pytest-html
阅读全文
摘要:##问题现象 warnings summary f:\python3.7\lib\site-packages\urllib3\util\selectors.py:14 f:\python3.7\lib\site-packages\urllib3\util\selectors.py:14: Depre
阅读全文
摘要:##前言 Allure Framework是一种灵活的轻量级多语言测试报告工具,不仅可以以简洁的网络报告形式非常简洁地显示已测试的内容,而且还允许参与开发过程的每个人从日常执行中提取最大程度的有用信息。 ##安装 使用pip安装pytest和allure-pytest,加上--index-url地址
阅读全文
摘要:一、说明 平常在做功能测试的时候,经常会遇到某个模块不稳定,偶然会出现一些bug,对于这种问题我们会针对此用例反复执行多次,最终复现出问题来。自动化运行用例时候,也会出现偶然的bug,可以针对单个用例,或者针对某个模块的用例重复执行多次。 pytest自带失败重跑机制,在运行中传入参数即可。 --l
阅读全文
摘要:Pytest可以在多个级别上实现测试参数化 一.@pytest.fixture装饰器调用参数 示例 import pytest from selenium import webdriver from time import sleep @pytest.fixture(scope="module",p
阅读全文
摘要:学过unittest的setup和teardown,前置和后置执行功能。pytest也有此功能并且功能更强大,今天就来学习一下吧。 用例运行级别: 模块级(setup_module/teardown_module)开始于模块始末,全局的 函数级(setup_function/teardown_fun
阅读全文
摘要:pip安装 pip install pytest-html 编写脚本 import pytest class TestClass(object): def test_one(self): x = "this" assert 'h' in x def test_two(self): x = "hell
阅读全文
摘要:安装pytest 命令行输入: pip install -U pytest 检查是否安装了正确的版本: λ pytest --version This is pytest version 5.3.5, imported from e:\python37\lib\site-packages\pytes
阅读全文