在使用pytest+allure生成报告时踩了无数据的坑

先说环境

  • win10
  • pycharm=2019.1
  • pytest=5.3.2
  • allure-pytest=2.8.9
  • allure=2.7.0

that is all

用pytest跑了101条用例,allure生成的报告,没有报错,全程正常跑完的,内网机智能用图片的形式里表达

命令与截图

步骤如上截图,打开报告结果是0,我不管是通过服务器的形式启动还是直接打开index.html都是这个结果,搜索无果,暂时没有找到解决办法,希望各位大佬解答 :joy: :joy:

先把问题拆解
试试,新建一个干净简单的项目,加一些allure的参数。然后执行allure的命令看看结果是什么。如果结果也是这个,那就是allure的配置问题或者是你的使用问题。先要排除其他因素的干扰

1 个赞

是不是少装了个库,allure-python-commons ?

不是,这个装了的,不然allure-pytest装不上的

文件夹内创建一个test_allure.py 文件,文件内代码如下

import pytest
class TestAllure:

    def test_all1(self):
        print("aaaaaa")

    def test_all2(self):
        print("aaaaaa")

    def test_all3(self):
        print("aaaaaa")

然后再terminal执行下面两行命令

pytest test_allure.py --alluredir=./allure-xml
 allure serve ./allure-xml

我本地有结果,如果你本地没有结果的话,考虑更换allure以及pytest版本

Python 3.7.5, pytest-5.0.1, allure-pytest-2.8.11,这是我的版本

你pytest运行时指定的allure数据文件错了

感谢大佬,居然是小白错误