From 0f8d3b626b5ba43f684282cd8b3cb091c0424c10 Mon Sep 17 00:00:00 2001 From: Wu Clan Date: Thu, 29 Aug 2024 11:43:22 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0Jenkins=E6=8A=A5=E5=91=8A?= =?UTF-8?q?=E9=93=BE=E6=8E=A5=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- httpfpt/core/conf.toml | 2 ++ httpfpt/core/get_conf.py | 1 + httpfpt/templates/email_notification.html | 4 ++-- httpfpt/utils/send_report/dingding.py | 2 +- httpfpt/utils/send_report/feishu.py | 2 +- httpfpt/utils/send_report/wechat.py | 2 +- 6 files changed, 8 insertions(+), 5 deletions(-) diff --git a/httpfpt/core/conf.toml b/httpfpt/core/conf.toml index a3facab..f53fb0d 100644 --- a/httpfpt/core/conf.toml +++ b/httpfpt/core/conf.toml @@ -6,6 +6,8 @@ name = 'test_project' [report] title = "自动化测试报告" tester_name = '123' +# jenkins allure +jenkins_url = 'https://foryourself' # mysql 数据库 [mysql] diff --git a/httpfpt/core/get_conf.py b/httpfpt/core/get_conf.py index ab6365b..56a196a 100644 --- a/httpfpt/core/get_conf.py +++ b/httpfpt/core/get_conf.py @@ -21,6 +21,7 @@ def __init__(self) -> None: # 测试报告 self.TEST_REPORT_TITLE = glom(self.settings, 'report.title') self.TESTER_NAME = glom(self.settings, 'report.tester_name') + self.JENKINS_URL = glom(self.settings, 'report.jenkins_url') # mysql 数据库 self.MYSQL_HOST = glom(self.settings, 'mysql.host') diff --git a/httpfpt/templates/email_notification.html b/httpfpt/templates/email_notification.html index 70ae797..e52f462 100644 --- a/httpfpt/templates/email_notification.html +++ b/httpfpt/templates/email_notification.html @@ -2,7 +2,7 @@ - HttpFpt Run Exception + HTTPFPT Run Exception
- HttpFpt 运行异常通知 + HTTPFPT 运行异常通知

测试运行异常,报错信息如下:

diff --git a/httpfpt/utils/send_report/dingding.py b/httpfpt/utils/send_report/dingding.py index ee91514..ac47138 100644 --- a/httpfpt/utils/send_report/dingding.py +++ b/httpfpt/utils/send_report/dingding.py @@ -26,7 +26,7 @@ def send(self) -> None: f"> ⚠️ 跳过用例: {self.content['skipped']}\n\n" f"> ⌛ 开始时间: {self.content['started_time']}\n\n" f"> ⏱️ 执行耗时: {self.content['elapsed']}\n\n" - f"> ➡️ [查看详情](https://foryourself)", + f"> ➡️ [查看详情]({httpfpt_config.JENKINS_URL})", }, } response = requests.session().post( diff --git a/httpfpt/utils/send_report/feishu.py b/httpfpt/utils/send_report/feishu.py index df7e947..aca1517 100644 --- a/httpfpt/utils/send_report/feishu.py +++ b/httpfpt/utils/send_report/feishu.py @@ -29,7 +29,7 @@ def send(self) -> None: [{'tag': 'text', 'text': f"⚠️ 跳过用例: {self.content['skipped']}"}], [{'tag': 'text', 'text': f"⌛ 开始时间: {self.content['started_time']}"}], [{'tag': 'text', 'text': f"⏱️ 执行耗时: {self.content['elapsed']}"}], - [{'tag': 'a', 'text': '➡️ 查看详情', 'href': 'https://foryourself'}], + [{'tag': 'a', 'text': '➡️ 查看详情', 'href': f'{httpfpt_config.JENKINS_URL}'}], ], } } diff --git a/httpfpt/utils/send_report/wechat.py b/httpfpt/utils/send_report/wechat.py index 825251e..76edbe6 100644 --- a/httpfpt/utils/send_report/wechat.py +++ b/httpfpt/utils/send_report/wechat.py @@ -26,7 +26,7 @@ def send(self) -> None: f"> ⚠️ 跳过用例: **{self.content['skipped']}**\n" f"> ⌛ 开始时间: **{self.content['started_time']}**\n" f"> ⏱️ 执行耗时: **{self.content['elapsed']}**\n" - "> ➡️ 查看报告: [点击跳转](https://foryourself)" + f"> ➡️ 查看报告: [点击跳转]({httpfpt_config.JENKINS_URL})" }, } response = requests.session().post(