http://tungwaiyip.info/software/HTMLTestRunner.html
下载,将下载后的文件放在python的Lib目录下

 # -*- coding:utf-8 -*-

 import HTMLTestRunner
import unittest
from selenium import webdriver class ResultDemo(unittest.TestCase): def setUp(self):
self.driver = webdriver.Firefox()
self.url = 'http://www.51testing.com' def test_login(self):
driver = self.driver
driver.get(self.url) driver.find_element_by_id('username').clear()
driver.find_element_by_id('username').send_keys('xxxxxx') driver.find_element_by_id('userpass').clear()
driver.find_element_by_id('userpass').send_keys('xxxxxx') driver.find_element_by_id('dologin').click() driver.find_element_by_id('xspace-seccode').clear()
input_seccode = raw_input('请输入验证码,并按 Enter 键:')
driver.find_element_by_id('xspace-seccode').send_keys(input_seccode)
driver.find_element_by_id('securitysubmit').click() def tearDown(self):
self.driver.quit()
#pass if __name__ == "__main__":
testsuite = unittest.TestSuite()
#添加测试用例到测试集中
testsuite.addTest(ResultDemo("test_login")) #生成测试报告文件
file_name = "D:/result.html"
fp = file(file_name, 'wb') renner = HTMLTestRunner.HTMLTestRunner(stream=fp, title='测试结果', description='测试报告')
renner.run(testsuite)

HTMLTestRunner 自动化测试报告的更多相关文章

  1. HTMLTESTRunner自动化测试报告增加截图功能

    我们都知道HTMLTESTRunner自动化测试报告,是Unittest单元测试框架报告,那么在做ui测试的时候就有点不适用了. 我们需要出错截图功能. 以下是我改的,增加了截图功能,先展示界面,再展 ...

  2. Python2 HTMLTestRunner自动化测试报告美化

    python2 的测试报告美化,需要的同学直接用 #coding=utf-8 """ A TestRunner for use with the Python unit ...

  3. Python3 HTMLTestRunner自动化测试报告美化

    # FileName : MyHTMLTestRunner.py # Author : wangyinghao # DateTime : 2019/1/9 21:04 # SoftWare : PyC ...

  4. Python+Selenium----使用HTMLTestRunner.py生成自动化测试报告2(使用PyCharm )

    1.说明 在我前一篇文件(Python+Selenium----使用HTMLTestRunner.py生成自动化测试报告1(使用IDLE ))中简单的写明了,如何生产测试报告,但是使用IDLE很麻烦, ...

  5. Python+Selenium----使用HTMLTestRunner.py生成自动化测试报告1(使用IDLE)

    1.说明 自动化测试报告是一个很重要的测试数据,网上看了一下,使用HTMLTestRunner.py生成自动化测试报告使用的比较多,但是呢,小白刚刚入手,不太懂,看了很多博客,终于生成了一个测试报告, ...

  6. Python&Selenium借助HTMLTestRunner生成自动化测试报告

    一.摘要 本篇博文介绍Python和Selenium进行自动化测试时,借助著名的HTMLTestRunner生成自动化测试报告 HTMLTestRunner.py百度很多,版本也很多,自行搜索下载放到 ...

  7. Python&Selenium借助html-testRunner生成自动化测试报告

    一.摘要 本博文将介绍Python和Selenium进行自动化测试时,借助html-testRunner 生成自动化测试报告 安装命令:pip install html-testRunner 二.测试 ...

  8. Python+Selenium框架 ---自动化测试报告的生成

    本文来介绍如何生成自动化测试报告,前面文章尾部提到了利用HTMLTestRunner.py来生成自动化测试报告.关于HTMLTestRunner不过多介绍,只需要知道是一个能生成一个HTML格式的网页 ...

  9. unittest接口自动化测试报告

    unittest接口自动化测试报告 展示: 代码: __author__ = "Wai Yip Tung, Findyou" __version__ = "0.8.2.1 ...

随机推荐

  1. 销毁session

    session运行在服务器是单用户,每个session都有一个唯一的sessionid 用法:session.setAttribute("userName", "张三丰& ...

  2. 淘宝可以传照片搜索商品,verygood.雅客VC多味水果糖

    奶奶喜欢吃点硬糖.在当地买了些说是不好.到是一个亲戚买的一种糖比较满意(好久了都快融化了). 但是我只有照片,能知道品牌,在jd没这样一样的商品了. 还好借助淘宝的传照片功能,找到了.

  3. IOS 学习笔记 20150314

    Objective--C 类与对象 1 关键字 @interace 类定义 @end 类结束 @implementation 类实现 : 继承 @public 公用 @private 私有 @prot ...

  4. spark-shell 执行脚本并传入参数

    使用方法: ./spark-script.sh your_file.scala first_arg second_arg third_arg 脚本: scala_file=$ arguments=$@ ...

  5. checkbox在jquery版本1.9 以上用attr不可重复操作的问题【附解决方案】

    最近做个项目,需要重复多次更改checkbox的状态,使用jquery 1.10.2的最新版本时发现,对checkbox的选中状态无法多次选中.测试代码如下: <!DOCTYPE html PU ...

  6. 几个常用方法有效优化ASP.NET的性能

    一. 数据库访问性能优化 1),数据库的连接和关闭 访问数据库资源需要创建连接.打开连接和关闭连接几个操作.这些过程需要多次与数据库交换信息以通过身份验证,比较耗费服务器资源.ASP.NET中提供了连 ...

  7. yii2 gii页面404和debug调试栏无法显示解决方法

    在debug和gii配置项中加一项: 'allowedIPs' => ['127.0.0.1', '::1', '*.*.*.*']即可 注:因为yii默认只让127.0.0.1访问

  8. HTML 中<style>中</style>里面<!-- -->标签是干嘛的

    baidu:没什么用,这个主要是针对低版本的浏览器<!-- -->是html的注释标签,高版本的浏览器会识别<style>标签是样式表,并忽略里面的html注释标签,会解析它, ...

  9. 使用reinterpret_cast的危险

    关键字: c++ cast // Cast.cpp : Defines the entry point for the console application. // #include "s ...

  10. Poco库之XML操作

    平台ubuntu14.04LTS     Poco版本:Poco1.6.1 #include <Poco/DOM/Text.h>#include <Poco/DOM/Element. ...