下載地址:http://tungwaiyip.info/software/HTMLTestRunner.html
1、第一步:Download下點擊HTMLTestRunner.py

2、第二步:鼠標右擊另存為下載

3、第三步:把下載的HTMLTestRunner.py保存到Python安裝路徑下的lib文件夾中,再到pycharm中import HTMLTestRunner成功即可

4、第四步:python3中用HTMLTestRunner.py會報importError“:No module named 'StringIO'錯誤,解決辦法如下:
打開下載的HTMLTestRunner.py文件,修改對應行代碼:
第94行: import StringIO 改為 import io
第118行:self.fp.write(s) 改為 self.fp.write(bytes(s,'UTF-8'))
第539行:self.outputBuffer = StringIO.StringIO() 改為self.outputBuffer = io.BytesIO()
第631行:print >>sys.stderr, '\nTime Elapsed: %s' % (self.stopTime-self.startTime) 改成 print('\nTime Elapsed: %s' % (self.stopTime-self.startTime),file=sys.stderr)
第642行:if not rmap.has_key(cls): 改為 if not cls in rmap:
第766行:uo = o.decode ('latin-1') 改成 uo=o
第768行:uo = o 改成 uo = o.decode('utf-8')
第772行:ue = e.decode('latin-1') 改成 ue = e
第774行:ue = e 改成 ue = e.decode('utf-8')
