我已经在Pytest中找到了诱人报告的解决方案。但我需要用python-unittest生成诱人报告。有可能吗?
发布于 2020-06-17 22:32:40
通过添加诱人的装饰器
例如
def test_nameOfTheTest(self):
with allure.step("Open browser"):或您可以使用的定义
@allure.step("Open application")
def open_application(self):用于运行测试的:
python -m pytest nameOftheFile.py(considering its in the root) --alluredir ./results获取结果:
allure serve ./results/希望这能对你有所帮助
发布于 2021-07-07 22:58:56
import sys, os, pytest, subprocess
if __name__ == "__main__":
#Run allure report of this file, export report to PJ/Reports
pytest.main(['-s', '-q','--alluredir','path_store_allure_report,'Test.py'])
#Open allue report via browser
subprocess.run([r'powershell.exe', r'allure ' + 'serve ' + 'path_store_allure_report'])我使用这段代码到我的Test_runner.py,它可以在完成代码后导出并在浏览器上打开报告
https://stackoverflow.com/questions/57196649
复制相似问题