資源簡介
Python+Selenium自動化測試優化后的HTMLTestRunner測試報告
代碼片段和文件信息
#?coding=utf-8
“““
A?TestRunner?for?use?with?the?Python?unit?testing?framework.?It
generates?a?HTML?report?to?show?the?result?at?a?glance.
The?simplest?way?to?use?this?is?to?invoke?its?main?method.?E.g.
????import?unittest
????import?HTMLTestRunner
????...?define?your?tests?...
????if?__name__?==?‘__main__‘:
????????HTMLTestRunner.main()
For?more?customization?options?instantiates?a?HTMLTestRunner?object.
HTMLTestRunner?is?a?counterpart?to?unittest‘s?TextTestRunner.?E.g.
????#?output?to?a?file
????fp?=?file(‘my_report.html‘?‘wb‘)
????runner?=?HTMLTestRunner.HTMLTestRunner(
????????????????stream=fp
????????????????title=‘My?unit?test‘
????????????????description=‘This?demonstrates?the?report?output?by?HTMLTestRunner.‘
????????????????)
????#?Use?an?external?stylesheet.
????#?Se
- 上一篇:百度api語音識別代碼
- 下一篇:Python實現文件瀏覽器
評論
共有 條評論