将unitest整合和python发送测试报告
废话少说先上代码
# -*- coding:UTF-8 -*-
__autor__ = 'zhouli'
__date__ = '2018/11/12 21:29' import unittest
import unittest_import, test_suite def create_suite():
print('开始测试')
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(unittest_import.UserTestCase)) # 加上测试用例中类的名称即可
suite.addTest(unittest.makeSuite(test_suite.UserTestCase)) # 加上测试用例中类的名称即可
return suite if __name__ == "__main__":
suite = create_suite()
file_prefix = time.strftime("%Y-%m-%d", time.localtime())
print(file_prefix)
with open("./" + file_prefix + "_result.html", "wb") as f:
runner = HTMLTestRunner.HTMLTestRunner(stream=f, title=u"zl测试", description=u"执行情况")
runner.run(suite)
值得注意的是其他模块的测试是通过addTest来完成的
将unitest整合和python发送测试报告的更多相关文章
- python发送GET或POST请求以便干一些趣事
适合级别:入门,中级 关键字 :python, http, GET, POST, 安全, 模拟, 浏览器, 验证码,图片识别, google 1 此文不是关于黑客或安全话题的! 2 使用脚本程序发 ...
- aritest发送测试报告到邮件
#!/usr/bin/env python # -*- coding=utf-8 -*- __CreateAt__ = '2020/4/19-17:34' import shutil from air ...
- python webdriver测试报告
python webdriver测试报告 即将开始一系列的自动化项目实践,很多公共类和属性都需要提前搞定.今天,解决了测试报告的一些难题,参照了很多博文,最终觉得HTMLTestRunner非常不错, ...
- 使用python发送简单的邮件
from:http://blog.csdn.net/zhaoweikid/article/details/125898 前些时间,论坛上有人讨论怎么用python发送需要认证的邮件,我在我的FreeB ...
- [Python] 发送email的几种方式
python发送email还是比較简单的,能够通过登录邮件服务来发送,linux下也能够使用调用sendmail命令来发送,还能够使用本地或者是远程的smtp服务来发送邮件,无论是单个,群发,还是抄送 ...
- python发送post和get请求
python发送post和get请求 get请求: 使用get方式时,请求数据直接放在url中. 方法一. import urllib import urllib2 url = "http: ...
- python 发送附件至邮箱
python 发送附件至邮箱 import smtplibfrom email.MIMEText import MIMETextfrom email.MIMEMultipart import MIME ...
- python 发送post和get请求
摘自:http://blog.163.com/xychenbaihu@yeah/blog/static/132229655201231085444250/ 测试用CGI,名字为test.py,放在ap ...
- Java+Selenium3框架设计篇5-如何实现邮件发送测试报告
https://blog.csdn.net/u011541946/article/details/77278837 本篇继续回答网友的问题,这个主题是如何通过邮件发送测试报告.通过邮件发送测试报告,这 ...
随机推荐
- 获取本机内网、外网ip(C++)<转>
基础知识 电脑在局域网内,通过网关/路由器连接到Internet则ip分为内网ip.外网ip.通过ipconfig得到的为局域网ip. 电脑直接拨号连接等,则本机通过ipconfig得到的就是外网ip ...
- python redis客户端使用lua脚本
有一个需求,为一个key设置一个field存储时间戳,每当有新数据,判断新数据时间戳是否大于之前的时间戳,如果是,更新时间戳,由于依赖中间执行结果,所以使用lua减少客户端和服务端通信次数. #!/u ...
- B树、B-树、B+树、B*树的定义和区分
MySQL是基于B+树聚集索引组织表 B树 即二叉搜索树: 1.所有非叶子结点至多拥有两个儿子(Left和Right): 2.所有结点存储一个关键字: 3.非叶子结点的左指针指向小于其关键字的子树,右 ...
- bug提单规范
一.提单模板 标题:[项目组][模块][子模块][发生原因]问题简要描述描述:[预置条件] 有就写清楚,没有就写无[操作步骤]1.XXXXX2.XXXXXX3.XXXXX[实际结果] XXXXX[预期 ...
- 拓展jquery js动态添加html代码 初始化数据
1 /** * 新增数据筛选 */ (function () { $.filterEvent = function(options){ var _this = this; var defaults = ...
- c++之enum(枚举)可以没有枚举名
转载自https://blog.csdn.net/u013591613/article/details/71215000 C_enum(枚举)可以没有枚举名 如果声明枚举类型时没有指定枚举名,其作用就 ...
- 吴裕雄 python 爬虫(1)
from urllib.parse import urlparse url = 'http://www.pm25x.com/city/beijing.htm' o = urlparse(url) pr ...
- 升级tensorflow1.0到1.3,报错ImportError: libcudnn.so.6: cannot open shared object file: No such file or directory Failed to load the native TensorFlow runtime.
先定位问题,发现在 /usr/local/cuda/include/ /usr/local/cuda/lib64/ 下面只有 libcudnn.so.5 因此,只要下载cudnn6.*版本的文件分别覆 ...
- quast-lg
1.官网简介 http://cab.spbu.ru/software/quast-lg/ QUAST- lg是QUAST的一个扩展,用于评估大型基因组装配(直至哺乳动物大小).QUAST- lg从5. ...
- 05_ssm基础(三)之Spring基础
11.spring入门引导 12.spring_HelloWord程序 实现步骤: 0.找到spring压缩包,并解压 1.拷贝jar包 2.添加主配置文件(官方文档约28页) 3.在测试中使用 13 ...