unittest 測試報告輸出爲xml,html,log

pytest框架兼容unittest,而pytest生成報告可以通過命令完成

https://www.cnblogs.com/feiyi211/p/6626277.html

同樣適用於unittest

1、生成junitxml格式

pytest --junitxml report.xml test.py
pytest -v test.py --junitxml report.xml
pytest test.py --junitxml=/user/log/report.xml

2、生成log文件

pytest -v test_one_func.py  --resultlog=report\log.txt

3、生成html文件

pip install pytest-html

pytest -v test_one_func.py --html=report\test_one_func.html

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章