測試報告
- 運行測試用例后,為了保存結果,我們需要生成測試報告,同時可以把運行的測試報告發送相關人員查閱,這時需要安裝一個插件(pytest-html)
- pytest-html插件安裝
pip install -U pytest-html
- 編寫測試用例
#coding: UTF-8 import pytest class TestClass(): def test_one(self): x = "this" assert 'h' in x def test_two(self): x = "hello" assert 'a' in x if __name__ == '__main__': pytest.main("--html=test_report.html")#通過在main中添加命令--html=test_report.html
- 運行用例得到測試報告
歡迎一起交流與指正: