增加测试框架对allure测试报告的支持,已完成初版,能用户通过-report参数指定生成的是pytest-html报告还是allure报告
This commit is contained in:
+75
-8
@@ -11,14 +11,17 @@
|
||||
CASE_FILE_TYPE = 0
|
||||
|
||||
# 0表示默认不发送任何通知, 1代表钉钉通知,2代表企业微信通知, 3代表邮件通知, 4代表所有途径都发送通知
|
||||
SEND_RESULT_TYPE = 3
|
||||
SEND_RESULT_TYPE = 4
|
||||
|
||||
# 测试报告的定制化信息展示
|
||||
REPORT_TITLE = "自动化测试报告"
|
||||
REPORT_NAME = f"apiautotest-report-"
|
||||
PROJECT_NAME = "GitLink 确实开源"
|
||||
TESTER = "测试人员:陈银花"
|
||||
DEPARTMENT = "所属部门: 开源中心"
|
||||
# 这个需要写入到allure测试结果集的environment.properties(不支持中文)
|
||||
ENV_INFO = {
|
||||
"report_title": "Auto Test Report",
|
||||
"report_name": "autotestreport_",
|
||||
"project_name": "GitLink",
|
||||
"tester": "floraachy",
|
||||
"department": "OpenSource"
|
||||
}
|
||||
|
||||
# 指定日志收集级别
|
||||
LOG_LEVEL = "INFO"
|
||||
@@ -58,18 +61,83 @@ email = {
|
||||
"host": "smtp.qq.com",
|
||||
"to": ["******", "******"] # 收件人邮箱
|
||||
}
|
||||
# ------------------------------------ 邮件通知内容 ----------------------------------------------------#
|
||||
email_subject = f"{ENV_INFO.get('project_name', None)} 接口自动化报告"
|
||||
email_content = """
|
||||
各位同事, 大家好:
|
||||
|
||||
自动化用例于 <strong>${start_time} </strong> 开始运行,运行时长:<strong>${run_time} s</strong>, 目前已执行完成。
|
||||
---------------------------------------------------------------------------------------------------------------
|
||||
测试人:<strong> ${tester} </strong>
|
||||
所属部门:<strong> ${department} </strong>
|
||||
项目环境:<strong> ${project_env} </strong>
|
||||
---------------------------------------------------------------------------------------------------------------
|
||||
执行结果如下:
|
||||
用例运行总数:<strong> ${total} 个</strong>
|
||||
通过用例个数(passed): <strong><font color="green" >${passed} 个</font></strong>
|
||||
失败用例个数(failed): <strong><font color="red" >${failed} 个</font></strong>
|
||||
异常用例个数(error): <strong><font color="orange" >${broken} 个</font></strong>
|
||||
跳过用例个数(skipped): <strong><font color="grey" >${skipped} 个</font></strong>
|
||||
失败重试用例个数 * 次数之和(rerun): <strong>${rerun} 个</strong>
|
||||
成 功 率:<strong> <font color="green" >${pass_rate} %</font></strong>
|
||||
|
||||
**********************************
|
||||
附件为具体的测试报告,详细情况可下载附件查看, 非相关负责人员可忽略此消息。谢谢。
|
||||
"""
|
||||
# ------------------------------------ 钉钉相关配置 ----------------------------------------------------#
|
||||
ding_talk = {
|
||||
"webhook_url": "https://oapi.dingtalk.com/robot/send?access_token=***********",
|
||||
"secret": "***********"
|
||||
}
|
||||
# ------------------------------------ 钉钉通知内容 ----------------------------------------------------#
|
||||
ding_talk_title = f"{ENV_INFO.get('project_name', None)} 接口自动化报告"
|
||||
ding_talk_content = """
|
||||
各位同事, 大家好:
|
||||
|
||||
### 自动化用例于 ${start_time} 开始运行,运行时长:${run_time} s, 目前已执行完成。
|
||||
---------------------------------------------------------------------------------------------------------------
|
||||
#### 测试人: ${tester}
|
||||
#### 所属部门: ${department}
|
||||
#### 项目环境:${project_env}
|
||||
---------------------------------------------------------------------------------------------------------------
|
||||
#### 执行结果如下:
|
||||
- 用例运行总数: ${total} 个
|
||||
- 通过用例个数(passed): ${passed} 个
|
||||
- 失败用例个数(failed): ${failed} 个
|
||||
- 异常用例个数(error): ${broken} 个
|
||||
- 跳过用例个数(skipped): ${skipped} 个
|
||||
- 失败重试用例个数 * 次数之和(rerun): ${rerun} 个
|
||||
- 成 功 率: ${pass_rate} %
|
||||
|
||||
**********************************
|
||||
附件为具体的测试报告,详细情况可下载附件查看, 非相关负责人员可忽略此消息。谢谢。
|
||||
"""
|
||||
# ------------------------------------ 企业微信相关配置 ----------------------------------------------------#
|
||||
wechat = {
|
||||
"webhook_url": "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=********",
|
||||
}
|
||||
# ------------------------------------ 企业微信通知内容 ----------------------------------------------------#
|
||||
wechat_content = """
|
||||
各位同事, 大家好:
|
||||
|
||||
### 自动化用例于 ${start_time} 开始运行,运行时长:${run_time} s, 目前已执行完成。
|
||||
--------------------------------
|
||||
#### 测试人: ${tester}
|
||||
#### 所属部门: ${department}
|
||||
#### 项目环境:${project_env}
|
||||
--------------------------------
|
||||
#### 执行结果如下:
|
||||
- 用例运行总数: ${total} 个
|
||||
- 通过用例个数(passed):<font color=\"info\"> ${passed} 个</font>
|
||||
- 失败用例个数(failed): <font color=\"warning\"> ${failed} 个</font>
|
||||
- 异常用例个数(error): <font color=\"warning\"> ${broken} 个</font>
|
||||
- 跳过用例个数(skipped): <font color=\"comment\"> ${skipped} 个</font>
|
||||
- 失败重试用例个数 * 次数之和(rerun): <font color=\"comment\"> ${rerun} 个</font>
|
||||
- 成 功 率: <font color=\"info\"> ${pass_rate} % </font>
|
||||
|
||||
**********************************
|
||||
附件为具体的测试报告,详细情况可下载附件查看, 非相关负责人员可忽略此消息。谢谢。
|
||||
"""
|
||||
# ------------------------------------ 数据库相关配置 ----------------------------------------------------#
|
||||
db_info = {
|
||||
"test": {
|
||||
@@ -87,7 +155,6 @@ db_info = {
|
||||
},
|
||||
"live": {
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user