資源簡介
網上流傳的HTMLTestRunner生成報告是英文的,而且樣式比較難看,比較亂,我進行了簡單調整,輸出中文格式報告,而且采用bootstrap調整了樣式,優化了一下
代碼片段和文件信息
#?-*-?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.
- 上一篇:tensorflow提取圖片特征-
- 下一篇:銀行卡制作腳本
評論
共有 條評論