allure

发布时间 2023-03-30 11:09:54作者: 石墨方

allure

生成报告

if __name__ == '__main__':
    # 会自动扫描当前目录下的pytest.ini
    # 根据配置文件中的配置来执行测试
    pytest.main(["--alluredir=report/html"])
    # 执行命令,生成测试报告
    os.system('allure generate ./report/data -o ./report/html --clean')

查看报告

allure-report下index.html文件是不能直接打开

allure使用了两种方式来渲染页面。分别是 allure open 和 allure serve。

allure open用于在本地渲染和查看结果

allure open report/

allure serve用于在本地渲染后对外展示结果

allure serve data/