(引用 )自动化测试报告HTMLtestrunner
1>下载HTMLTestRunner.py文件,地址为:




# -*- coding: utf-8 -*-from selenium import webdriverimport unittestimport time,sysimport HTMLTestRunnerreload(sys)sys.setdefaultencoding("utf-8")class Baidu(unittest.TestCase):"""百度首页搜索测试用例"""def setUp(self):self.driver = webdriver.Chrome()self.driver.implicitly_wait(30)self.base_url = "http://www.baidu.com"def test_baidu_search(self):driver = self.driverprint u"========【case_0001】 百度搜索============="driver.get(self.base_url + "/")driver.find_element_by_id("kw").clear()driver.find_element_by_id("kw").send_keys(u"林志玲")driver.find_element_by_id("su").click()now = time.strftime("%Y-%m-%d-%H_%M_%S", time.localtime(time.time()))#必须要打印路径HTMLTestRunner才能捕获并且生成路径,\image\**.png 是获取路径的条件,必须这样的目录
pic_path='..\\result\\image\\'+now+'.png'print pic_pathdriver.save_screenshot(pic_path)time.sleep(2)def tearDown(self):self.driver.quit()if __name__ == "__main__":now = time.strftime("%Y-%m-%d-%H_%M_%S", time.localtime(time.time()))testunit = unittest.TestSuite()testunit.addTest(Baidu("test_baidu_search"))HtmlFile = "..\\result\\"+now+"HTMLtemplate.html"print HtmlFilefp = file(HtmlFile, "wb")runner = HTMLTestRunner.HTMLTestRunner(stream=fp, title=u"百度测试报告", description=u"用例测试情况")runner.run(testunit)
- 引用地址:http://www.cnblogs.com/hero-blog/p/4128575.html
(引用 )自动化测试报告HTMLtestrunner的更多相关文章
- Python 自动化测试报告HTMLTestRunner
HTMLTestRunner 是Python的一个测试报告 参考网址: http://tungwaiyip.info/software/HTMLTestRunner.html https://pypi ...
- Python&Selenium借助HTMLTestRunner生成自动化测试报告
一.摘要 本篇博文介绍Python和Selenium进行自动化测试时,借助著名的HTMLTestRunner生成自动化测试报告 HTMLTestRunner.py百度很多,版本也很多,自行搜索下载放到 ...
- HTMLTESTRunner自动化测试报告增加截图功能
我们都知道HTMLTESTRunner自动化测试报告,是Unittest单元测试框架报告,那么在做ui测试的时候就有点不适用了. 我们需要出错截图功能. 以下是我改的,增加了截图功能,先展示界面,再展 ...
- Python+Selenium----使用HTMLTestRunner.py生成自动化测试报告2(使用PyCharm )
1.说明 在我前一篇文件(Python+Selenium----使用HTMLTestRunner.py生成自动化测试报告1(使用IDLE ))中简单的写明了,如何生产测试报告,但是使用IDLE很麻烦, ...
- Python+Selenium----使用HTMLTestRunner.py生成自动化测试报告1(使用IDLE)
1.说明 自动化测试报告是一个很重要的测试数据,网上看了一下,使用HTMLTestRunner.py生成自动化测试报告使用的比较多,但是呢,小白刚刚入手,不太懂,看了很多博客,终于生成了一个测试报告, ...
- Python2 HTMLTestRunner自动化测试报告美化
python2 的测试报告美化,需要的同学直接用 #coding=utf-8 """ A TestRunner for use with the Python unit ...
- Python&Selenium借助html-testRunner生成自动化测试报告
一.摘要 本博文将介绍Python和Selenium进行自动化测试时,借助html-testRunner 生成自动化测试报告 安装命令:pip install html-testRunner 二.测试 ...
- 3.5 unittest生成测试报告HTMLTestRunner
3.5 unittest生成测试报告HTMLTestRunner 前言批量执行完用例后,生成的测试报告是文本形式的,不够直观,为了更好的展示测试报告,最好是生成HTML格式的.unittest里面是不 ...
- Python+Selenium框架 ---自动化测试报告的生成
本文来介绍如何生成自动化测试报告,前面文章尾部提到了利用HTMLTestRunner.py来生成自动化测试报告.关于HTMLTestRunner不过多介绍,只需要知道是一个能生成一个HTML格式的网页 ...
随机推荐
- python string
string比较连接 >>> s1="python string" >>> len(s) 13 >>> s2=" p ...
- [Spring MVC] - Interceptor 拦截器
Spring MVC中的Interceptor与Struts2的差不多. 下面是一个简单的Interceptor登陆验证例子: 1.需要在spring的配置文件中加入这段: <!-- 自定义拦截 ...
- 【python】类的继承和多态
比如,我们已经编写了一个名为Animal的class,有一个run()方法可以直接打印: class Animal(object): def run(self): print 'Animal is r ...
- 建立一个简单的SpringMVC程序
首先,所建立的程序是一个web程序,所以在web.xml文件中进行如下的配置: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 ...
- JDBC使用步骤
JDBC编程步骤 加载驱动程序:Class.forName(driverClass) 加载Mysql驱动:Class.forName("com.mysql.jdbc.Driver" ...
- 字符串连接,数字tostring,写入文件
#include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) { int x=2410; in ...
- bootstrap-面包屑和分页
<div class="container"> <div class="row"> <ul class="breadcr ...
- E:in-range伪类选择器与E:out-of-range伪类选择器
E:in-range伪类选择器用来指定当元素的有效值被限定在一段范围之内(通常通过min属性值与max属性值来限定),且实际输入值在该范围内时使用的样式.E:out-of-range伪类选择器用来指定 ...
- 使用gson解析,生成Json
包:gson-2.3.jarJson文本解析为Java对象:Java对象生成为Json文本 import com.google.gson.Gson; public class TestGson { c ...
- postman+newman+jenkins
1.postman: http://itfish.net/article/59864.html(网上参考资料) 1)安装(要用爬墙软件): 进入下面地址https://chrome.google.co ...