#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2018/11/14 3:37 PM # @Author : jiayu.chen import os import sys import unittest import HTMLTestRunner import time sys.path.append(os.path.abspath('..')) from utils import zip_dir from conf.sysconfig import doc_path_conf from utils.send_email import SendMail # 定义需要执行的用例文件夹 test_dir = doc_path_conf.settle_case_path # 获取测试套件,pattern参数表示被执行文件的规则 suite = unittest.defaultTestLoader.discover(start_dir=test_dir, pattern='test*.py') def run(): ''' 执行目标文件夹中所有以test开头.py结尾的测试用例 :return: ''' now = time.strftime('%Y-%m-%d_%H_%M_%S') reportname = doc_path_conf.report_path + '/' + now + 'SettleSingleTestResult' + '.html' # 定义报告的名称和路径 with open(reportname, 'wb') as f: runner = HTMLTestRunner.HTMLTestRunner( stream=f, title='测试报告', description='结算系统单功能测试用例' ) runner.run(suite) f.close() # 压缩目标路径中的所有文件到zip包 zip_dir.ZipDir(doc_path_conf.screenshot_path, doc_path_conf.output_path + '/' + now + '_img.zip') time.sleep(3) # 发送邮件,设置邮件主题 mail = SendMail(subject="结算系统单功能测试用例") mail.send() if __name__ == '__main__': run()
网站首页 > 技术文章 正文
猜你喜欢
- 2025-05-05 python unittest 基本用法(python3 unittest)
- 2025-05-05 使用pytest进行单元测试(pytest详解)
- 2025-05-05 用扣子开发一个图灵测试游戏(用扣子开发一个图灵测试游戏的软件)
- 2025-05-05 Python进阶-day19: 测试与调试(python测验)
- 2025-05-05 零起点Python机器学习快速入门-4-3-字符串常用方法
- 2025-05-05 Python + Unittest 之 DDT 的原理解析
- 2025-05-05 shell脚本基本语法(上)看完这个麻麻再也不担心我不会Linux了
- 2025-05-05 软件测试员必看!数据库知识mysql查询语句大全
- 2025-05-05 Python 什么情况下会生成 pyc 文件?
- 2025-05-05 Learn Python If Statements: Basics and Examples for Beginners
- 1506℃桌面软件开发新体验!用 Blazor Hybrid 打造简洁高效的视频处理工具
- 482℃MySQL service启动脚本浅析(r12笔记第59天)
- 461℃启用MySQL查询缓存(mysql8.0查询缓存)
- 458℃服务器异常重启,导致mysql启动失败,问题解决过程记录
- 447℃Dify工具使用全场景:dify-sandbox沙盒的原理(源码篇·第2期)
- 441℃「赵强老师」MySQL的闪回(赵强iso是哪个大学毕业的)
- 420℃mysql服务怎么启动和关闭?(mysql服务怎么启动和关闭)
- 416℃MySQL server PID file could not be found!失败
- 最近发表
- 标签列表
-
- cmd/c (64)
- c++中::是什么意思 (83)
- 标签用于 (65)
- 主键只能有一个吗 (66)
- c#console.writeline不显示 (75)
- pythoncase语句 (81)
- es6includes (73)
- windowsscripthost (67)
- apt-getinstall-y (86)
- node_modules怎么生成 (76)
- chromepost (65)
- c++int转char (75)
- static函数和普通函数 (76)
- el-date-picker开始日期早于结束日期 (70)
- js判断是否是json字符串 (67)
- localstorage.removeitem (74)
- vector线程安全吗 (70)
- & (66)
- java (73)
- js数组插入 (83)
- linux删除一个文件夹 (65)
- mac安装java (72)
- eacces (67)
- 查看mysql是否启动 (70)
- 无效的列索引 (74)