当前位置: 首页 > news >正文

浙江省建设部网站东莞常平社保局电话

浙江省建设部网站,东莞常平社保局电话,一站式网站管家,爱淘宝网页网站建设unittest_生成测试报告 测试报告为测试结果的统计即展示#xff0c;是自动化测试不可或缺的一部分#xff0c;利用unittest 可以生成测试报告 方式一、使用第三方 HTMLTestRunner 执行测试用例集#xff0c;生成网页版测试报告#xff08;推荐#xff09; HTMLTestRunn…unittest_生成测试报告 测试报告为测试结果的统计即展示是自动化测试不可或缺的一部分利用unittest 可以生成测试报告 方式一、使用第三方 HTMLTestRunner 执行测试用例集生成网页版测试报告推荐 HTMLTestRunner是Python标准库的unittest模块的一个扩展在使用该模块之前 要下载HTMLTestRunner.py文件并将该文件保存在python安装路径下的lib文件夹或者 是项目的子包中在python代码中通过 import HTMLTestRunner导入即可使用。 HTMLTestRunner常用参数介绍stream: 配置测试报告要保存的文件路径title测试报告标题description: 测试报告的描述信 代码示例 # 使用discover()来实现添加执行整个目录下所有的测试用例 import os import unittest import HTMLTestRunner import time# 获取当前路径 curren_path os.path.dirname(__file__) # 获取测试用例目录的路径 case_path os.path.join(curren_path,all_case)# 从当前路径回到上一层路径 # case_path os.path.abspath(os.path.dirname(os.path.dirname(__file__)))# 匹配测试用例路径下的所有的测试方法 discover unittest.defaultTestLoader.discover(start_dircase_path, # 用例路径pattern*_case*.py,top_level_dirNone) # 文件类型 # 创建主套件 main_suite unittest.TestSuite() # 把测试用例路径添加到主套件中 main_suite.addTest(discover) # 执行主套件里的测试用例如果要生成测试报告则不通过unittest.main()方法执行 # unittest.main(defaultTestmain_suite,verbosity2)# 执行并生成测试报告 # 加个时间戳 now time.strftime(%y-%m_%d_%H_%M_%S_,time.localtime(time.time())) # 创建html类型测试报告对象将执行的过程写入到file_obj中 file_obj open(D:/pythonProject/P7_P8_Requests/unittest框架/test_report/{}test_report.html.format(now),w,encodingutf-8) # 创建配置html测试报告的相关信息的对象 runner HTMLTestRunner.HTMLTestRunner(streamfile_obj,title第一次的测试报告,description我是测试报告的描述信息) # 生成html测试报告如果要生成测试报告则不通过unittest.main()方法执行 runner.run(main_suite) 查看执行结果 配置详细的html测试报告 在测试用例中加上注释信息即可在html报告中体现能更好的展示每个用例的信息 一、通过添加 3对双引号内容 通过在类的下面添加 3对双引号 测试类01的详细信息在测试方法下面添加 3对双引号 test_aaa方法的详细信息;如下图 在生成的测试报告中可更好的展示每条用例的作用 二、只在测试方法中添加 self._testMethodName设置测试用例名称self._testMethodDoc设置测试用例详情 注意上方下划线只有一个不要搞错 在测试用例方法中添加注释信息如下图 查看生成的测试报告 方式二、通过TextTestRunner()方法生成text类型的测试报告 代码示例 # 使用discover()来实现添加执行整个目录下所有的测试用例 import os import unittest import HTMLTestRunner import time# 获取当前路径 curren_path os.path.dirname(__file__) # 获取测试用例目录的路径 case_path os.path.join(curren_path,all_case)# 从当前路径回到上一层路径 # case_path os.path.abspath(os.path.dirname(os.path.dirname(__file__)))# 匹配测试用例路径下的所有的测试方法 discover unittest.defaultTestLoader.discover(start_dircase_path, # 用例路径pattern*_case*.py,top_level_dirNone) # 文件类型 # 创建主套件 main_suite unittest.TestSuite() # 把测试用例路径添加到主套件中 main_suite.addTest(discover) # 执行主套件里的测试用例如果要生成测试报告则不通过unittest.main()方法执行 # unittest.main(defaultTestmain_suite,verbosity2)# 生成text类型的测试报告 with open(./report/test_result.txt,w,encodingutf-8) as file:test_runner unittest.TextTestRunner(streamfile,descriptions执行用例的测试报告, verbosity2)test_runner.run(main_suite) 查看执行结果 实战案例 光学理论是没用的要学会跟着一起敲要动手实操才能将自己的所学运用到实际当中去这时候可以搞点实战案例来学习。 如果对你有帮助的话点个赞收个藏给作者一个鼓励。也方便你下次能够快速查找。 如有不懂还要咨询下方小卡片博主也希望和志同道合的测试人员一起学习进步 在适当的年龄选择适当的岗位尽量去发挥好自己的优势。 我的自动化测试开发之路一路走来都离不每个阶段的计划因为自己喜欢规划和总结 测试开发视频教程、学习笔记领取传送门
文章转载自:
http://www.morning.nxwk.cn.gov.cn.nxwk.cn
http://www.morning.mnnxt.cn.gov.cn.mnnxt.cn
http://www.morning.sbczr.cn.gov.cn.sbczr.cn
http://www.morning.lhyhx.cn.gov.cn.lhyhx.cn
http://www.morning.tkztx.cn.gov.cn.tkztx.cn
http://www.morning.dnmwl.cn.gov.cn.dnmwl.cn
http://www.morning.nstml.cn.gov.cn.nstml.cn
http://www.morning.fhlfp.cn.gov.cn.fhlfp.cn
http://www.morning.ptqpd.cn.gov.cn.ptqpd.cn
http://www.morning.lzqxb.cn.gov.cn.lzqxb.cn
http://www.morning.rknsp.cn.gov.cn.rknsp.cn
http://www.morning.rgwrl.cn.gov.cn.rgwrl.cn
http://www.morning.kkysz.cn.gov.cn.kkysz.cn
http://www.morning.fbtgp.cn.gov.cn.fbtgp.cn
http://www.morning.rnht.cn.gov.cn.rnht.cn
http://www.morning.plqqn.cn.gov.cn.plqqn.cn
http://www.morning.zcwtl.cn.gov.cn.zcwtl.cn
http://www.morning.fqqcd.cn.gov.cn.fqqcd.cn
http://www.morning.nmhpq.cn.gov.cn.nmhpq.cn
http://www.morning.rzbcz.cn.gov.cn.rzbcz.cn
http://www.morning.kqlrl.cn.gov.cn.kqlrl.cn
http://www.morning.cthkh.cn.gov.cn.cthkh.cn
http://www.morning.ptwqf.cn.gov.cn.ptwqf.cn
http://www.morning.lnrhk.cn.gov.cn.lnrhk.cn
http://www.morning.nqmkr.cn.gov.cn.nqmkr.cn
http://www.morning.ktcrr.cn.gov.cn.ktcrr.cn
http://www.morning.tjjkn.cn.gov.cn.tjjkn.cn
http://www.morning.bfnbn.cn.gov.cn.bfnbn.cn
http://www.morning.dfbeer.com.gov.cn.dfbeer.com
http://www.morning.shnqh.cn.gov.cn.shnqh.cn
http://www.morning.wqsjx.cn.gov.cn.wqsjx.cn
http://www.morning.hqgxz.cn.gov.cn.hqgxz.cn
http://www.morning.rtlg.cn.gov.cn.rtlg.cn
http://www.morning.qpmmg.cn.gov.cn.qpmmg.cn
http://www.morning.jqmmf.cn.gov.cn.jqmmf.cn
http://www.morning.dkmzr.cn.gov.cn.dkmzr.cn
http://www.morning.lznfl.cn.gov.cn.lznfl.cn
http://www.morning.hyxwh.cn.gov.cn.hyxwh.cn
http://www.morning.dmzzt.cn.gov.cn.dmzzt.cn
http://www.morning.pgkpt.cn.gov.cn.pgkpt.cn
http://www.morning.pkwwq.cn.gov.cn.pkwwq.cn
http://www.morning.fndmk.cn.gov.cn.fndmk.cn
http://www.morning.ntnml.cn.gov.cn.ntnml.cn
http://www.morning.cwknc.cn.gov.cn.cwknc.cn
http://www.morning.xflzm.cn.gov.cn.xflzm.cn
http://www.morning.krfpj.cn.gov.cn.krfpj.cn
http://www.morning.fesiy.com.gov.cn.fesiy.com
http://www.morning.nhgkm.cn.gov.cn.nhgkm.cn
http://www.morning.mdrnn.cn.gov.cn.mdrnn.cn
http://www.morning.plwfx.cn.gov.cn.plwfx.cn
http://www.morning.dbnpz.cn.gov.cn.dbnpz.cn
http://www.morning.jzfxk.cn.gov.cn.jzfxk.cn
http://www.morning.hlshn.cn.gov.cn.hlshn.cn
http://www.morning.jxfmn.cn.gov.cn.jxfmn.cn
http://www.morning.xhklb.cn.gov.cn.xhklb.cn
http://www.morning.yqjjn.cn.gov.cn.yqjjn.cn
http://www.morning.kqblk.cn.gov.cn.kqblk.cn
http://www.morning.hhxkl.cn.gov.cn.hhxkl.cn
http://www.morning.sbkb.cn.gov.cn.sbkb.cn
http://www.morning.jxgyg.cn.gov.cn.jxgyg.cn
http://www.morning.lgqdl.cn.gov.cn.lgqdl.cn
http://www.morning.yprjy.cn.gov.cn.yprjy.cn
http://www.morning.zlchy.cn.gov.cn.zlchy.cn
http://www.morning.czgtt.cn.gov.cn.czgtt.cn
http://www.morning.jmnfh.cn.gov.cn.jmnfh.cn
http://www.morning.hmlpn.cn.gov.cn.hmlpn.cn
http://www.morning.mghgl.cn.gov.cn.mghgl.cn
http://www.morning.hksxq.cn.gov.cn.hksxq.cn
http://www.morning.ccffs.cn.gov.cn.ccffs.cn
http://www.morning.brmbm.cn.gov.cn.brmbm.cn
http://www.morning.jtcq.cn.gov.cn.jtcq.cn
http://www.morning.gcdzp.cn.gov.cn.gcdzp.cn
http://www.morning.wkxsy.cn.gov.cn.wkxsy.cn
http://www.morning.pswzc.cn.gov.cn.pswzc.cn
http://www.morning.yfnjk.cn.gov.cn.yfnjk.cn
http://www.morning.cldgh.cn.gov.cn.cldgh.cn
http://www.morning.srckl.cn.gov.cn.srckl.cn
http://www.morning.smdnl.cn.gov.cn.smdnl.cn
http://www.morning.hous-e.com.gov.cn.hous-e.com
http://www.morning.rljr.cn.gov.cn.rljr.cn
http://www.tj-hxxt.cn/news/259281.html

相关文章:

  • 动漫网站建设前期策划电子购物网站的设计与实现
  • 品牌宣传网站制作电脑网站怎么制作
  • wordpress 多站点 合集wordpress logo 尺寸
  • 做网站需要哪些证书高中信息技术网站设计规划
  • 商务网站开发与建设论文最火的网页游戏排行
  • 新建南昌网站建设公司厦门城乡建设局网站
  • 知识付费微网站开发天津网站建设noajt
  • 企业怎样选择域名做网站wordpress E405
  • 做游戏网站打鱼电脑网站建设规划
  • 2019长沙企业网站建设优惠网站建设费税率是多少
  • 网站开发维护印花税生活服务类网站开发
  • 协会网站建设的作用顶尖设计吧官网
  • 网站建设业务方法石家庄做网站汉狮网络
  • php网站建设网站山西餐饮加盟网站建设
  • 网站的建设工具实施过程容桂网站制作价位
  • 网站备案手机号码永久免费的网站
  • 企业只有建立自己的网站网站建设哪家好服务
  • 南宁模板建站平台网站前台首页无法显示
  • 淮北哪里做网站新手做地方门户网站
  • 福州鼓楼区网站建设做wow宏的网站
  • 搜狗网站入口wordpress媒体文件
  • 外国人做的购物网站wordpress 黑色
  • 网站开发投入产出分析2016做网站还赚钱吗
  • 织梦手机网站模板下载网站模板免费下载云资源
  • wordpress 手册长沙网站seo外包
  • 爱站seo工具包免费版wordpress一键部署
  • 优惠建网站wordpress 替换域名
  • 网站开发项目总结wordpress之搜索标题
  • 南昌建站建设网站需要备案
  • 如何申请网站com域名国外的营销网站