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/

Selenium 生成HTML的测试报告

上一篇:微信公众平台开发(十二) 发送客服消息


下一篇:微信的尚方宝剑——互联网闭环