pytest allure

安装使用

1、安装allure

  下载allure

  解压

  配置环境变量:打开vim ~/.bash_profile,配置环境变量

  source ~/.bash_profile

  allure --version

2、安装allure-pytest

  pip install allure-pytest

3、使用

  执行:python do_test.py

  # --clean-alluredir: 表示每次运行前会清理上一次的json报告

4、allure注解说明

 参考:https://zhuanlan.zhihu.com/p/555114726  

 

问题

1、执行报错:error: unrecognized arguments: --alluredir

1、pip list | grep allure-pytest 确认是否已成功安装allure-pytest插件

2、检查allure-pytest版本与python版本是否兼容

  2、执行报错:Allure comond not found

https://blog.csdn.net/qq_45689860/article/details/127811544 

3、如何把pytest.mark.parametrize参数传递给allure.severity

参考:https://blog.csdn.net/shashakuku/article/details/126750733

4、如何解决 allure生成的报告中的中文乱码

     解决办法:在pytest.ini 中添加 disable_test_id_escaping_and_forfeit_all_rights_to_community_support = True

    # 注意:如果没有pytest.ini就在项目根目录下创建一个,pycharm会同时要求安装.ini插件,完成之后添加如下内容

    [pytest]
    disable_test_id_escaping_and_forfeit_all_rights_to_community_support = True

   5、【接口自动化测试】python Pytest(1) 框架介绍 插件介绍 fixture 装饰器 allure 报告 yaml 数据驱动

    参考:https://zhuanlan.zhihu.com/p/623609865?utm_id=0

posted @ 2024-01-26 11:38  小嘉欣  阅读(45)  评论(0编辑  收藏  举报