pytest+alluredir在代碼中進行報告轉換

import os

import pytest

if __name__ == '__main__':
    pytest.main(["-s", "--alluredir", "./report/result"])  # 以alluredir運行生成報告,並保存在result文件中
    allure_cmd = "allure generate ./report/result -o ./report/html --clean"  # 將報告轉換成html格式文件的命令
    p = os.popen(allure_cmd, mode="r")  # 運行命令
    print(p.read())  # 打印查看結果

僅作爲記錄方便查閱

發佈了34 篇原創文章 · 獲贊 11 · 訪問量 1萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章