美文网首页
四.pytest生成allure报告

四.pytest生成allure报告

作者: TheRightPath1 | 来源:发表于2021-04-18 21:15 被阅读0次
  1. 安装allure-pytest: pip install allure-pytest
  2. 安装allure并配置环境变量:
    github地址:https://github.com/allure-framework/allure2/releases选择zip结尾的下载安装即可
  3. 使用allure生成json临时报告: 在运行测试脚本时添加参数,--alluredir 路径
  4. 生成allure报告: 在pytest.main()下面执行代码os.system('allure generate ./temp -o ./report')
    allure generate: 是执行命令固定的格式
    ./temp: 是json临时报告的路径
    -o: 表示输出的意思
    ./report: 是allure报告输出的路径
    运行代码时可能会出现关于allure的乱码错误: allure‘ �����ڲ����ⲿ���Ҳ
    解决该错误的方式是将代码IDE改为以管理员身份运行即可
    报告样例如下图


    报告样例如下图png.png

相关文章

网友评论

      本文标题:四.pytest生成allure报告

      本文链接:https://www.haomeiwen.com/subject/hczplltx.html