Selenium 生成HTML的测试报告

1、下载HTMLTestRunner.py文件;

2、在代码中导入HTMLTestRunner.py文档;

出现的问题:setUp()、teardown()函数集成的时候报错:

ERROR: tearDown (__main__.Test)

Traceback (most recent call last):
  File "E:\eclipse\PythonCase\src\Survey_test\Surveyor_link02.py", line 90, in tearDown
    self.driver.quit()
  File "D:\Python27\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 82, in quit
    self.service.stop()
  File "D:\Python27\lib\site-packages\selenium\webdriver\chrome\service.py", line 97, in stop
    url_request.urlopen("http://127.0.0.1:%d/shutdown" % self.port)
  File "D:\Python27\lib\urllib2.py", line 127, in urlopen
    return _opener.open(url, data, timeout)
  File "D:\Python27\lib\urllib2.py", line 404, in open
    response = self._open(req, data)
  File "D:\Python27\lib\urllib2.py", line 422, in _open
    ‘_open‘, req)
  File "D:\Python27\lib\urllib2.py", line 382, in _call_chain
    result = func(*args)
  File "D:\Python27\lib\urllib2.py", line 1214, in http_open
    return self.do_open(httplib.HTTPConnection, req)
  File "D:\Python27\lib\urllib2.py", line 1184, in do_open
    raise URLError(err)
URLError: <urlopen error [Errno 10061] >

解决方案:

suit.addTests(unittest.defaultTestLoader.loadTestsFromTestCase(Testlist))

参考资料:http://my.oschina.net/hcp/blog/40776http://blog.163.com/yang_jianli/blog/static/161990006201110941859845/

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。