diff --git a/common/models.py b/common/models.py
index 8919485..1661920 100644
--- a/common/models.py
+++ b/common/models.py
@@ -16,6 +16,7 @@ class TestMetrics:
""" 用例结果数据 """
total: int
passed: int
+ rerun: int
failed: int
skipped: int
xfailed: int
diff --git a/common/settings.py b/common/settings.py
index 9ef6c6c..459241b 100644
--- a/common/settings.py
+++ b/common/settings.py
@@ -61,6 +61,7 @@ email_content = """
执行结果如下:
用例运行总数: ${total}条
通过用例数(passed): ${passed}条
+ 重试通过用例数(rerun): ${rerun}条
失败用例数(failed): ${failed}条
报错用例数(error): ${error}条
跳过用例数(skipped): ${skipped}条
@@ -86,6 +87,7 @@ wechat_content = """******用例执行结果统计******
> 测试环境:%s
> 总用例数:${total}条
> 通过用例数:${passed}条
+ > 重试通过用例数:${rerun}条
> 失败用例数:${failed}条
> 报错用例数:${error}条
> 跳过用例数:${skipped}条
diff --git a/conftest.py b/conftest.py
index b72adc8..73aae9d 100644
--- a/conftest.py
+++ b/conftest.py
@@ -82,6 +82,7 @@ def pytest_terminal_summary(terminalreporter, exitstatus, config):
print("******用例执行结果统计******")
print(f"总用例数:{pytest_result.total}条")
print(f"通过:{pytest_result.passed}条")
+ print(f"重试后通过:{pytest_result.rerun}条")
print(f"失败:{pytest_result.failed}条")
print(f"跳过:{pytest_result.skipped}条")
print(f"预期失败:{pytest_result.xfailed}条")
diff --git a/utils/report_data_handle.py b/utils/report_data_handle.py
index 10dcb74..42210b2 100644
--- a/utils/report_data_handle.py
+++ b/utils/report_data_handle.py
@@ -29,6 +29,7 @@ class ReportDataHandle:
case_count["total"] = pytest_result['summary'].get("total", 0) # 用例总数
case_count["passed"] = pytest_result["summary"].get("passed", 0) # 通过用例数
case_count["failed"] = pytest_result["summary"].get("failed", 0) # 失败用例数
+ case_count["rerun"] = pytest_result["summary"].get("rerun", 0) # 重试通过用例数
case_count["skipped"] = pytest_result["summary"].get("skipped", 0) # 跳过用例数
case_count["xfailed"] = pytest_result["summary"].get("xfailed", 0) # 预期失败用例数
case_count["xpassed"] = pytest_result["summary"].get("xpassed", 0) # 预期成功用例数
@@ -37,7 +38,7 @@ class ReportDataHandle:
if case_count["total"] > 0:
# 计算成功率
case_count["pass_rate"] = round(
- (case_count["passed"] + case_count["xpassed"]) / case_count["total"] * 100, 2)
+ (case_count["passed"] + case_count["rerun"] + case_count["xpassed"]) / case_count["total"] * 100, 2)
else:
# 如果未运行用例,则成功率为 0.0
case_count["pass_rate"] = 0.0