py.test 多次测试运行的聚合结果

use*_*458 5 python automation pytest

我正在运行几个实例,pytest.main()一旦它们全部完成,我想快速查看所有运行中的失败,而无需遍历所有单独的报告。我怎样才能做到这一点?

我是否必须解析文本报告,或者我可以让 py.test 返回包含失败数据的对象吗?(据我所知它只返回一个整数)

小智 2

我为此使用 Allure 报告(https://docs.qameta.io/allure/#_pytest )。

您可以使用选项 --alluredir= 运行每个 pytest.main(),其中每个实例都有不同的路径,例如 /path/to/reports/report1、/path/to/reports/report2。

所有运行完成后,您可以通过运行命令 allureserve /path/to/reports 生成一份合并报告。有关此处生成报告的更多信息:https ://docs.qameta.io/allure/#_get_started