From 71e466810cb0d7e7956874f1be509de781c498c9 Mon Sep 17 00:00:00 2001 From: fit2-zhao Date: Fri, 19 Jan 2024 14:45:20 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):?= =?UTF-8?q?=20=E8=B0=83=E6=95=B4=E6=8A=A5=E5=91=8A=E6=8C=87=E6=A0=87?= =?UTF-8?q?=E8=AE=A1=E7=AE=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/metersphere/api/domain/ApiReport.java | 22 +- .../api/domain/ApiReportExample.java | 196 +++++++++++++++--- .../api/domain/ApiScenarioReport.java | 22 +- .../api/domain/ApiScenarioReportExample.java | 196 +++++++++++++++--- .../api/mapper/ApiReportMapper.xml | 82 ++++++-- .../api/mapper/ApiScenarioReportMapper.xml | 82 ++++++-- .../3.0.0/ddl/V3.0.0_5__api_test.sql | 8 +- .../sdk/dto/api/result/ProcessResultDTO.java | 42 +--- 8 files changed, 505 insertions(+), 145 deletions(-) diff --git a/backend/framework/domain/src/main/java/io/metersphere/api/domain/ApiReport.java b/backend/framework/domain/src/main/java/io/metersphere/api/domain/ApiReport.java index 54d87ce0ba..47e2471b0c 100644 --- a/backend/framework/domain/src/main/java/io/metersphere/api/domain/ApiReport.java +++ b/backend/framework/domain/src/main/java/io/metersphere/api/domain/ApiReport.java @@ -119,10 +119,20 @@ public class ApiReport implements Serializable { @NotNull(message = "{api_report.assertion_success_count.not_blank}", groups = {Created.class}) private Long assertionSuccessCount; - @Schema(description = "请求执行率", requiredMode = Schema.RequiredMode.REQUIRED) - @NotBlank(message = "{api_report.request_execution_rate.not_blank}", groups = {Created.class}) - @Size(min = 1, max = 20, message = "{api_report.request_execution_rate.length_range}", groups = {Created.class, Updated.class}) - private String requestExecutionRate; + @Schema(description = "请求失败率", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "{api_report.request_error_rate.not_blank}", groups = {Created.class}) + @Size(min = 1, max = 20, message = "{api_report.request_error_rate.length_range}", groups = {Created.class, Updated.class}) + private String requestErrorRate; + + @Schema(description = "请求未执行率", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "{api_report.request_pending_rate.not_blank}", groups = {Created.class}) + @Size(min = 1, max = 20, message = "{api_report.request_pending_rate.length_range}", groups = {Created.class, Updated.class}) + private String requestPendingRate; + + @Schema(description = "请求误报率", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "{api_report.request_fake_error_rate.not_blank}", groups = {Created.class}) + @Size(min = 1, max = 20, message = "{api_report.request_fake_error_rate.length_range}", groups = {Created.class, Updated.class}) + private String requestFakeErrorRate; @Schema(description = "请求通过率", requiredMode = Schema.RequiredMode.REQUIRED) @NotBlank(message = "{api_report.request_pass_rate.not_blank}", groups = {Created.class}) @@ -167,7 +177,9 @@ public class ApiReport implements Serializable { successCount("success_count", "successCount", "BIGINT", false), assertionCount("assertion_count", "assertionCount", "BIGINT", false), assertionSuccessCount("assertion_success_count", "assertionSuccessCount", "BIGINT", false), - requestExecutionRate("request_execution_rate", "requestExecutionRate", "VARCHAR", false), + requestErrorRate("request_error_rate", "requestErrorRate", "VARCHAR", false), + requestPendingRate("request_pending_rate", "requestPendingRate", "VARCHAR", false), + requestFakeErrorRate("request_fake_error_rate", "requestFakeErrorRate", "VARCHAR", false), requestPassRate("request_pass_rate", "requestPassRate", "VARCHAR", false), assertionPassRate("assertion_pass_rate", "assertionPassRate", "VARCHAR", false), scriptIdentifier("script_identifier", "scriptIdentifier", "VARCHAR", false); diff --git a/backend/framework/domain/src/main/java/io/metersphere/api/domain/ApiReportExample.java b/backend/framework/domain/src/main/java/io/metersphere/api/domain/ApiReportExample.java index 7c53d3a2cb..370ed54a48 100644 --- a/backend/framework/domain/src/main/java/io/metersphere/api/domain/ApiReportExample.java +++ b/backend/framework/domain/src/main/java/io/metersphere/api/domain/ApiReportExample.java @@ -1864,73 +1864,213 @@ public class ApiReportExample { return (Criteria) this; } - public Criteria andRequestExecutionRateIsNull() { - addCriterion("request_execution_rate is null"); + public Criteria andRequestErrorRateIsNull() { + addCriterion("request_error_rate is null"); return (Criteria) this; } - public Criteria andRequestExecutionRateIsNotNull() { - addCriterion("request_execution_rate is not null"); + public Criteria andRequestErrorRateIsNotNull() { + addCriterion("request_error_rate is not null"); return (Criteria) this; } - public Criteria andRequestExecutionRateEqualTo(String value) { - addCriterion("request_execution_rate =", value, "requestExecutionRate"); + public Criteria andRequestErrorRateEqualTo(String value) { + addCriterion("request_error_rate =", value, "requestErrorRate"); return (Criteria) this; } - public Criteria andRequestExecutionRateNotEqualTo(String value) { - addCriterion("request_execution_rate <>", value, "requestExecutionRate"); + public Criteria andRequestErrorRateNotEqualTo(String value) { + addCriterion("request_error_rate <>", value, "requestErrorRate"); return (Criteria) this; } - public Criteria andRequestExecutionRateGreaterThan(String value) { - addCriterion("request_execution_rate >", value, "requestExecutionRate"); + public Criteria andRequestErrorRateGreaterThan(String value) { + addCriterion("request_error_rate >", value, "requestErrorRate"); return (Criteria) this; } - public Criteria andRequestExecutionRateGreaterThanOrEqualTo(String value) { - addCriterion("request_execution_rate >=", value, "requestExecutionRate"); + public Criteria andRequestErrorRateGreaterThanOrEqualTo(String value) { + addCriterion("request_error_rate >=", value, "requestErrorRate"); return (Criteria) this; } - public Criteria andRequestExecutionRateLessThan(String value) { - addCriterion("request_execution_rate <", value, "requestExecutionRate"); + public Criteria andRequestErrorRateLessThan(String value) { + addCriterion("request_error_rate <", value, "requestErrorRate"); return (Criteria) this; } - public Criteria andRequestExecutionRateLessThanOrEqualTo(String value) { - addCriterion("request_execution_rate <=", value, "requestExecutionRate"); + public Criteria andRequestErrorRateLessThanOrEqualTo(String value) { + addCriterion("request_error_rate <=", value, "requestErrorRate"); return (Criteria) this; } - public Criteria andRequestExecutionRateLike(String value) { - addCriterion("request_execution_rate like", value, "requestExecutionRate"); + public Criteria andRequestErrorRateLike(String value) { + addCriterion("request_error_rate like", value, "requestErrorRate"); return (Criteria) this; } - public Criteria andRequestExecutionRateNotLike(String value) { - addCriterion("request_execution_rate not like", value, "requestExecutionRate"); + public Criteria andRequestErrorRateNotLike(String value) { + addCriterion("request_error_rate not like", value, "requestErrorRate"); return (Criteria) this; } - public Criteria andRequestExecutionRateIn(List values) { - addCriterion("request_execution_rate in", values, "requestExecutionRate"); + public Criteria andRequestErrorRateIn(List values) { + addCriterion("request_error_rate in", values, "requestErrorRate"); return (Criteria) this; } - public Criteria andRequestExecutionRateNotIn(List values) { - addCriterion("request_execution_rate not in", values, "requestExecutionRate"); + public Criteria andRequestErrorRateNotIn(List values) { + addCriterion("request_error_rate not in", values, "requestErrorRate"); return (Criteria) this; } - public Criteria andRequestExecutionRateBetween(String value1, String value2) { - addCriterion("request_execution_rate between", value1, value2, "requestExecutionRate"); + public Criteria andRequestErrorRateBetween(String value1, String value2) { + addCriterion("request_error_rate between", value1, value2, "requestErrorRate"); return (Criteria) this; } - public Criteria andRequestExecutionRateNotBetween(String value1, String value2) { - addCriterion("request_execution_rate not between", value1, value2, "requestExecutionRate"); + public Criteria andRequestErrorRateNotBetween(String value1, String value2) { + addCriterion("request_error_rate not between", value1, value2, "requestErrorRate"); + return (Criteria) this; + } + + public Criteria andRequestPendingRateIsNull() { + addCriterion("request_pending_rate is null"); + return (Criteria) this; + } + + public Criteria andRequestPendingRateIsNotNull() { + addCriterion("request_pending_rate is not null"); + return (Criteria) this; + } + + public Criteria andRequestPendingRateEqualTo(String value) { + addCriterion("request_pending_rate =", value, "requestPendingRate"); + return (Criteria) this; + } + + public Criteria andRequestPendingRateNotEqualTo(String value) { + addCriterion("request_pending_rate <>", value, "requestPendingRate"); + return (Criteria) this; + } + + public Criteria andRequestPendingRateGreaterThan(String value) { + addCriterion("request_pending_rate >", value, "requestPendingRate"); + return (Criteria) this; + } + + public Criteria andRequestPendingRateGreaterThanOrEqualTo(String value) { + addCriterion("request_pending_rate >=", value, "requestPendingRate"); + return (Criteria) this; + } + + public Criteria andRequestPendingRateLessThan(String value) { + addCriterion("request_pending_rate <", value, "requestPendingRate"); + return (Criteria) this; + } + + public Criteria andRequestPendingRateLessThanOrEqualTo(String value) { + addCriterion("request_pending_rate <=", value, "requestPendingRate"); + return (Criteria) this; + } + + public Criteria andRequestPendingRateLike(String value) { + addCriterion("request_pending_rate like", value, "requestPendingRate"); + return (Criteria) this; + } + + public Criteria andRequestPendingRateNotLike(String value) { + addCriterion("request_pending_rate not like", value, "requestPendingRate"); + return (Criteria) this; + } + + public Criteria andRequestPendingRateIn(List values) { + addCriterion("request_pending_rate in", values, "requestPendingRate"); + return (Criteria) this; + } + + public Criteria andRequestPendingRateNotIn(List values) { + addCriterion("request_pending_rate not in", values, "requestPendingRate"); + return (Criteria) this; + } + + public Criteria andRequestPendingRateBetween(String value1, String value2) { + addCriterion("request_pending_rate between", value1, value2, "requestPendingRate"); + return (Criteria) this; + } + + public Criteria andRequestPendingRateNotBetween(String value1, String value2) { + addCriterion("request_pending_rate not between", value1, value2, "requestPendingRate"); + return (Criteria) this; + } + + public Criteria andRequestFakeErrorRateIsNull() { + addCriterion("request_fake_error_rate is null"); + return (Criteria) this; + } + + public Criteria andRequestFakeErrorRateIsNotNull() { + addCriterion("request_fake_error_rate is not null"); + return (Criteria) this; + } + + public Criteria andRequestFakeErrorRateEqualTo(String value) { + addCriterion("request_fake_error_rate =", value, "requestFakeErrorRate"); + return (Criteria) this; + } + + public Criteria andRequestFakeErrorRateNotEqualTo(String value) { + addCriterion("request_fake_error_rate <>", value, "requestFakeErrorRate"); + return (Criteria) this; + } + + public Criteria andRequestFakeErrorRateGreaterThan(String value) { + addCriterion("request_fake_error_rate >", value, "requestFakeErrorRate"); + return (Criteria) this; + } + + public Criteria andRequestFakeErrorRateGreaterThanOrEqualTo(String value) { + addCriterion("request_fake_error_rate >=", value, "requestFakeErrorRate"); + return (Criteria) this; + } + + public Criteria andRequestFakeErrorRateLessThan(String value) { + addCriterion("request_fake_error_rate <", value, "requestFakeErrorRate"); + return (Criteria) this; + } + + public Criteria andRequestFakeErrorRateLessThanOrEqualTo(String value) { + addCriterion("request_fake_error_rate <=", value, "requestFakeErrorRate"); + return (Criteria) this; + } + + public Criteria andRequestFakeErrorRateLike(String value) { + addCriterion("request_fake_error_rate like", value, "requestFakeErrorRate"); + return (Criteria) this; + } + + public Criteria andRequestFakeErrorRateNotLike(String value) { + addCriterion("request_fake_error_rate not like", value, "requestFakeErrorRate"); + return (Criteria) this; + } + + public Criteria andRequestFakeErrorRateIn(List values) { + addCriterion("request_fake_error_rate in", values, "requestFakeErrorRate"); + return (Criteria) this; + } + + public Criteria andRequestFakeErrorRateNotIn(List values) { + addCriterion("request_fake_error_rate not in", values, "requestFakeErrorRate"); + return (Criteria) this; + } + + public Criteria andRequestFakeErrorRateBetween(String value1, String value2) { + addCriterion("request_fake_error_rate between", value1, value2, "requestFakeErrorRate"); + return (Criteria) this; + } + + public Criteria andRequestFakeErrorRateNotBetween(String value1, String value2) { + addCriterion("request_fake_error_rate not between", value1, value2, "requestFakeErrorRate"); return (Criteria) this; } diff --git a/backend/framework/domain/src/main/java/io/metersphere/api/domain/ApiScenarioReport.java b/backend/framework/domain/src/main/java/io/metersphere/api/domain/ApiScenarioReport.java index d1b574b57f..6c49cc097c 100644 --- a/backend/framework/domain/src/main/java/io/metersphere/api/domain/ApiScenarioReport.java +++ b/backend/framework/domain/src/main/java/io/metersphere/api/domain/ApiScenarioReport.java @@ -119,10 +119,20 @@ public class ApiScenarioReport implements Serializable { @NotNull(message = "{api_scenario_report.assertion_success_count.not_blank}", groups = {Created.class}) private Long assertionSuccessCount; - @Schema(description = "请求执行率", requiredMode = Schema.RequiredMode.REQUIRED) - @NotBlank(message = "{api_scenario_report.request_execution_rate.not_blank}", groups = {Created.class}) - @Size(min = 1, max = 20, message = "{api_scenario_report.request_execution_rate.length_range}", groups = {Created.class, Updated.class}) - private String requestExecutionRate; + @Schema(description = "请求失败率", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "{api_scenario_report.request_error_rate.not_blank}", groups = {Created.class}) + @Size(min = 1, max = 20, message = "{api_scenario_report.request_error_rate.length_range}", groups = {Created.class, Updated.class}) + private String requestErrorRate; + + @Schema(description = "请求未执行率", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "{api_scenario_report.request_pending_rate.not_blank}", groups = {Created.class}) + @Size(min = 1, max = 20, message = "{api_scenario_report.request_pending_rate.length_range}", groups = {Created.class, Updated.class}) + private String requestPendingRate; + + @Schema(description = "请求误报率", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "{api_scenario_report.request_fake_error_rate.not_blank}", groups = {Created.class}) + @Size(min = 1, max = 20, message = "{api_scenario_report.request_fake_error_rate.length_range}", groups = {Created.class, Updated.class}) + private String requestFakeErrorRate; @Schema(description = "请求通过率", requiredMode = Schema.RequiredMode.REQUIRED) @NotBlank(message = "{api_scenario_report.request_pass_rate.not_blank}", groups = {Created.class}) @@ -167,7 +177,9 @@ public class ApiScenarioReport implements Serializable { successCount("success_count", "successCount", "BIGINT", false), assertionCount("assertion_count", "assertionCount", "BIGINT", false), assertionSuccessCount("assertion_success_count", "assertionSuccessCount", "BIGINT", false), - requestExecutionRate("request_execution_rate", "requestExecutionRate", "VARCHAR", false), + requestErrorRate("request_error_rate", "requestErrorRate", "VARCHAR", false), + requestPendingRate("request_pending_rate", "requestPendingRate", "VARCHAR", false), + requestFakeErrorRate("request_fake_error_rate", "requestFakeErrorRate", "VARCHAR", false), requestPassRate("request_pass_rate", "requestPassRate", "VARCHAR", false), assertionPassRate("assertion_pass_rate", "assertionPassRate", "VARCHAR", false), scriptIdentifier("script_identifier", "scriptIdentifier", "VARCHAR", false); diff --git a/backend/framework/domain/src/main/java/io/metersphere/api/domain/ApiScenarioReportExample.java b/backend/framework/domain/src/main/java/io/metersphere/api/domain/ApiScenarioReportExample.java index 03bf95c4de..7e300046bd 100644 --- a/backend/framework/domain/src/main/java/io/metersphere/api/domain/ApiScenarioReportExample.java +++ b/backend/framework/domain/src/main/java/io/metersphere/api/domain/ApiScenarioReportExample.java @@ -1864,73 +1864,213 @@ public class ApiScenarioReportExample { return (Criteria) this; } - public Criteria andRequestExecutionRateIsNull() { - addCriterion("request_execution_rate is null"); + public Criteria andRequestErrorRateIsNull() { + addCriterion("request_error_rate is null"); return (Criteria) this; } - public Criteria andRequestExecutionRateIsNotNull() { - addCriterion("request_execution_rate is not null"); + public Criteria andRequestErrorRateIsNotNull() { + addCriterion("request_error_rate is not null"); return (Criteria) this; } - public Criteria andRequestExecutionRateEqualTo(String value) { - addCriterion("request_execution_rate =", value, "requestExecutionRate"); + public Criteria andRequestErrorRateEqualTo(String value) { + addCriterion("request_error_rate =", value, "requestErrorRate"); return (Criteria) this; } - public Criteria andRequestExecutionRateNotEqualTo(String value) { - addCriterion("request_execution_rate <>", value, "requestExecutionRate"); + public Criteria andRequestErrorRateNotEqualTo(String value) { + addCriterion("request_error_rate <>", value, "requestErrorRate"); return (Criteria) this; } - public Criteria andRequestExecutionRateGreaterThan(String value) { - addCriterion("request_execution_rate >", value, "requestExecutionRate"); + public Criteria andRequestErrorRateGreaterThan(String value) { + addCriterion("request_error_rate >", value, "requestErrorRate"); return (Criteria) this; } - public Criteria andRequestExecutionRateGreaterThanOrEqualTo(String value) { - addCriterion("request_execution_rate >=", value, "requestExecutionRate"); + public Criteria andRequestErrorRateGreaterThanOrEqualTo(String value) { + addCriterion("request_error_rate >=", value, "requestErrorRate"); return (Criteria) this; } - public Criteria andRequestExecutionRateLessThan(String value) { - addCriterion("request_execution_rate <", value, "requestExecutionRate"); + public Criteria andRequestErrorRateLessThan(String value) { + addCriterion("request_error_rate <", value, "requestErrorRate"); return (Criteria) this; } - public Criteria andRequestExecutionRateLessThanOrEqualTo(String value) { - addCriterion("request_execution_rate <=", value, "requestExecutionRate"); + public Criteria andRequestErrorRateLessThanOrEqualTo(String value) { + addCriterion("request_error_rate <=", value, "requestErrorRate"); return (Criteria) this; } - public Criteria andRequestExecutionRateLike(String value) { - addCriterion("request_execution_rate like", value, "requestExecutionRate"); + public Criteria andRequestErrorRateLike(String value) { + addCriterion("request_error_rate like", value, "requestErrorRate"); return (Criteria) this; } - public Criteria andRequestExecutionRateNotLike(String value) { - addCriterion("request_execution_rate not like", value, "requestExecutionRate"); + public Criteria andRequestErrorRateNotLike(String value) { + addCriterion("request_error_rate not like", value, "requestErrorRate"); return (Criteria) this; } - public Criteria andRequestExecutionRateIn(List values) { - addCriterion("request_execution_rate in", values, "requestExecutionRate"); + public Criteria andRequestErrorRateIn(List values) { + addCriterion("request_error_rate in", values, "requestErrorRate"); return (Criteria) this; } - public Criteria andRequestExecutionRateNotIn(List values) { - addCriterion("request_execution_rate not in", values, "requestExecutionRate"); + public Criteria andRequestErrorRateNotIn(List values) { + addCriterion("request_error_rate not in", values, "requestErrorRate"); return (Criteria) this; } - public Criteria andRequestExecutionRateBetween(String value1, String value2) { - addCriterion("request_execution_rate between", value1, value2, "requestExecutionRate"); + public Criteria andRequestErrorRateBetween(String value1, String value2) { + addCriterion("request_error_rate between", value1, value2, "requestErrorRate"); return (Criteria) this; } - public Criteria andRequestExecutionRateNotBetween(String value1, String value2) { - addCriterion("request_execution_rate not between", value1, value2, "requestExecutionRate"); + public Criteria andRequestErrorRateNotBetween(String value1, String value2) { + addCriterion("request_error_rate not between", value1, value2, "requestErrorRate"); + return (Criteria) this; + } + + public Criteria andRequestPendingRateIsNull() { + addCriterion("request_pending_rate is null"); + return (Criteria) this; + } + + public Criteria andRequestPendingRateIsNotNull() { + addCriterion("request_pending_rate is not null"); + return (Criteria) this; + } + + public Criteria andRequestPendingRateEqualTo(String value) { + addCriterion("request_pending_rate =", value, "requestPendingRate"); + return (Criteria) this; + } + + public Criteria andRequestPendingRateNotEqualTo(String value) { + addCriterion("request_pending_rate <>", value, "requestPendingRate"); + return (Criteria) this; + } + + public Criteria andRequestPendingRateGreaterThan(String value) { + addCriterion("request_pending_rate >", value, "requestPendingRate"); + return (Criteria) this; + } + + public Criteria andRequestPendingRateGreaterThanOrEqualTo(String value) { + addCriterion("request_pending_rate >=", value, "requestPendingRate"); + return (Criteria) this; + } + + public Criteria andRequestPendingRateLessThan(String value) { + addCriterion("request_pending_rate <", value, "requestPendingRate"); + return (Criteria) this; + } + + public Criteria andRequestPendingRateLessThanOrEqualTo(String value) { + addCriterion("request_pending_rate <=", value, "requestPendingRate"); + return (Criteria) this; + } + + public Criteria andRequestPendingRateLike(String value) { + addCriterion("request_pending_rate like", value, "requestPendingRate"); + return (Criteria) this; + } + + public Criteria andRequestPendingRateNotLike(String value) { + addCriterion("request_pending_rate not like", value, "requestPendingRate"); + return (Criteria) this; + } + + public Criteria andRequestPendingRateIn(List values) { + addCriterion("request_pending_rate in", values, "requestPendingRate"); + return (Criteria) this; + } + + public Criteria andRequestPendingRateNotIn(List values) { + addCriterion("request_pending_rate not in", values, "requestPendingRate"); + return (Criteria) this; + } + + public Criteria andRequestPendingRateBetween(String value1, String value2) { + addCriterion("request_pending_rate between", value1, value2, "requestPendingRate"); + return (Criteria) this; + } + + public Criteria andRequestPendingRateNotBetween(String value1, String value2) { + addCriterion("request_pending_rate not between", value1, value2, "requestPendingRate"); + return (Criteria) this; + } + + public Criteria andRequestFakeErrorRateIsNull() { + addCriterion("request_fake_error_rate is null"); + return (Criteria) this; + } + + public Criteria andRequestFakeErrorRateIsNotNull() { + addCriterion("request_fake_error_rate is not null"); + return (Criteria) this; + } + + public Criteria andRequestFakeErrorRateEqualTo(String value) { + addCriterion("request_fake_error_rate =", value, "requestFakeErrorRate"); + return (Criteria) this; + } + + public Criteria andRequestFakeErrorRateNotEqualTo(String value) { + addCriterion("request_fake_error_rate <>", value, "requestFakeErrorRate"); + return (Criteria) this; + } + + public Criteria andRequestFakeErrorRateGreaterThan(String value) { + addCriterion("request_fake_error_rate >", value, "requestFakeErrorRate"); + return (Criteria) this; + } + + public Criteria andRequestFakeErrorRateGreaterThanOrEqualTo(String value) { + addCriterion("request_fake_error_rate >=", value, "requestFakeErrorRate"); + return (Criteria) this; + } + + public Criteria andRequestFakeErrorRateLessThan(String value) { + addCriterion("request_fake_error_rate <", value, "requestFakeErrorRate"); + return (Criteria) this; + } + + public Criteria andRequestFakeErrorRateLessThanOrEqualTo(String value) { + addCriterion("request_fake_error_rate <=", value, "requestFakeErrorRate"); + return (Criteria) this; + } + + public Criteria andRequestFakeErrorRateLike(String value) { + addCriterion("request_fake_error_rate like", value, "requestFakeErrorRate"); + return (Criteria) this; + } + + public Criteria andRequestFakeErrorRateNotLike(String value) { + addCriterion("request_fake_error_rate not like", value, "requestFakeErrorRate"); + return (Criteria) this; + } + + public Criteria andRequestFakeErrorRateIn(List values) { + addCriterion("request_fake_error_rate in", values, "requestFakeErrorRate"); + return (Criteria) this; + } + + public Criteria andRequestFakeErrorRateNotIn(List values) { + addCriterion("request_fake_error_rate not in", values, "requestFakeErrorRate"); + return (Criteria) this; + } + + public Criteria andRequestFakeErrorRateBetween(String value1, String value2) { + addCriterion("request_fake_error_rate between", value1, value2, "requestFakeErrorRate"); + return (Criteria) this; + } + + public Criteria andRequestFakeErrorRateNotBetween(String value1, String value2) { + addCriterion("request_fake_error_rate not between", value1, value2, "requestFakeErrorRate"); return (Criteria) this; } diff --git a/backend/framework/domain/src/main/java/io/metersphere/api/mapper/ApiReportMapper.xml b/backend/framework/domain/src/main/java/io/metersphere/api/mapper/ApiReportMapper.xml index 0646c4b635..552f62deb1 100644 --- a/backend/framework/domain/src/main/java/io/metersphere/api/mapper/ApiReportMapper.xml +++ b/backend/framework/domain/src/main/java/io/metersphere/api/mapper/ApiReportMapper.xml @@ -29,7 +29,9 @@ - + + + @@ -97,7 +99,8 @@ update_user, update_time, start_time, end_time, request_duration, `status`, trigger_mode, run_mode, pool_id, version_id, integrated, project_id, environment_id, error_count, fake_error_count, pending_count, success_count, assertion_count, assertion_success_count, - request_execution_rate, request_pass_rate, assertion_pass_rate, script_identifier + request_error_rate, request_pending_rate, request_fake_error_rate, request_pass_rate, + assertion_pass_rate, script_identifier select @@ -139,8 +142,9 @@ integrated, project_id, environment_id, error_count, fake_error_count, pending_count, success_count, assertion_count, assertion_success_count, - request_execution_rate, request_pass_rate, - assertion_pass_rate, script_identifier) + request_error_rate, request_pending_rate, request_fake_error_rate, + request_pass_rate, assertion_pass_rate, script_identifier + ) values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{scenarioId,jdbcType=VARCHAR}, #{testPlanId,jdbcType=VARCHAR}, #{createUser,jdbcType=VARCHAR}, #{deleteTime,jdbcType=BIGINT}, #{deleteUser,jdbcType=VARCHAR}, #{deleted,jdbcType=BIT}, #{updateUser,jdbcType=VARCHAR}, @@ -150,8 +154,9 @@ #{integrated,jdbcType=BIT}, #{projectId,jdbcType=VARCHAR}, #{environmentId,jdbcType=VARCHAR}, #{errorCount,jdbcType=BIGINT}, #{fakeErrorCount,jdbcType=BIGINT}, #{pendingCount,jdbcType=BIGINT}, #{successCount,jdbcType=BIGINT}, #{assertionCount,jdbcType=BIGINT}, #{assertionSuccessCount,jdbcType=BIGINT}, - #{requestExecutionRate,jdbcType=VARCHAR}, #{requestPassRate,jdbcType=VARCHAR}, - #{assertionPassRate,jdbcType=VARCHAR}, #{scriptIdentifier,jdbcType=VARCHAR}) + #{requestErrorRate,jdbcType=VARCHAR}, #{requestPendingRate,jdbcType=VARCHAR}, #{requestFakeErrorRate,jdbcType=VARCHAR}, + #{requestPassRate,jdbcType=VARCHAR}, #{assertionPassRate,jdbcType=VARCHAR}, #{scriptIdentifier,jdbcType=VARCHAR} + ) insert into api_scenario_report @@ -237,8 +242,14 @@ assertion_success_count, - - request_execution_rate, + + request_error_rate, + + + request_pending_rate, + + + request_fake_error_rate, request_pass_rate, @@ -332,8 +343,14 @@ #{assertionSuccessCount,jdbcType=BIGINT}, - - #{requestExecutionRate,jdbcType=VARCHAR}, + + #{requestErrorRate,jdbcType=VARCHAR}, + + + #{requestPendingRate,jdbcType=VARCHAR}, + + + #{requestFakeErrorRate,jdbcType=VARCHAR}, #{requestPassRate,jdbcType=VARCHAR}, @@ -436,8 +453,14 @@ assertion_success_count = #{record.assertionSuccessCount,jdbcType=BIGINT}, - - request_execution_rate = #{record.requestExecutionRate,jdbcType=VARCHAR}, + + request_error_rate = #{record.requestErrorRate,jdbcType=VARCHAR}, + + + request_pending_rate = #{record.requestPendingRate,jdbcType=VARCHAR}, + + + request_fake_error_rate = #{record.requestFakeErrorRate,jdbcType=VARCHAR}, request_pass_rate = #{record.requestPassRate,jdbcType=VARCHAR}, @@ -482,7 +505,9 @@ success_count = #{record.successCount,jdbcType=BIGINT}, assertion_count = #{record.assertionCount,jdbcType=BIGINT}, assertion_success_count = #{record.assertionSuccessCount,jdbcType=BIGINT}, - request_execution_rate = #{record.requestExecutionRate,jdbcType=VARCHAR}, + request_error_rate = #{record.requestErrorRate,jdbcType=VARCHAR}, + request_pending_rate = #{record.requestPendingRate,jdbcType=VARCHAR}, + request_fake_error_rate = #{record.requestFakeErrorRate,jdbcType=VARCHAR}, request_pass_rate = #{record.requestPassRate,jdbcType=VARCHAR}, assertion_pass_rate = #{record.assertionPassRate,jdbcType=VARCHAR}, script_identifier = #{record.scriptIdentifier,jdbcType=VARCHAR} @@ -571,8 +596,14 @@ assertion_success_count = #{assertionSuccessCount,jdbcType=BIGINT}, - - request_execution_rate = #{requestExecutionRate,jdbcType=VARCHAR}, + + request_error_rate = #{requestErrorRate,jdbcType=VARCHAR}, + + + request_pending_rate = #{requestPendingRate,jdbcType=VARCHAR}, + + + request_fake_error_rate = #{requestFakeErrorRate,jdbcType=VARCHAR}, request_pass_rate = #{requestPassRate,jdbcType=VARCHAR}, @@ -614,7 +645,9 @@ success_count = #{successCount,jdbcType=BIGINT}, assertion_count = #{assertionCount,jdbcType=BIGINT}, assertion_success_count = #{assertionSuccessCount,jdbcType=BIGINT}, - request_execution_rate = #{requestExecutionRate,jdbcType=VARCHAR}, + request_error_rate = #{requestErrorRate,jdbcType=VARCHAR}, + request_pending_rate = #{requestPendingRate,jdbcType=VARCHAR}, + request_fake_error_rate = #{requestFakeErrorRate,jdbcType=VARCHAR}, request_pass_rate = #{requestPassRate,jdbcType=VARCHAR}, assertion_pass_rate = #{assertionPassRate,jdbcType=VARCHAR}, script_identifier = #{scriptIdentifier,jdbcType=VARCHAR} @@ -626,8 +659,8 @@ update_user, update_time, start_time, end_time, request_duration, `status`, trigger_mode, run_mode, pool_id, version_id, integrated, project_id, environment_id, error_count, fake_error_count, pending_count, success_count, assertion_count, assertion_success_count, - request_execution_rate, request_pass_rate, assertion_pass_rate, script_identifier - ) + request_error_rate, request_pending_rate, request_fake_error_rate, request_pass_rate, + assertion_pass_rate, script_identifier) values (#{item.id,jdbcType=VARCHAR}, #{item.name,jdbcType=VARCHAR}, #{item.scenarioId,jdbcType=VARCHAR}, @@ -639,7 +672,8 @@ #{item.integrated,jdbcType=BIT}, #{item.projectId,jdbcType=VARCHAR}, #{item.environmentId,jdbcType=VARCHAR}, #{item.errorCount,jdbcType=BIGINT}, #{item.fakeErrorCount,jdbcType=BIGINT}, #{item.pendingCount,jdbcType=BIGINT}, #{item.successCount,jdbcType=BIGINT}, #{item.assertionCount,jdbcType=BIGINT}, #{item.assertionSuccessCount,jdbcType=BIGINT}, - #{item.requestExecutionRate,jdbcType=VARCHAR}, #{item.requestPassRate,jdbcType=VARCHAR}, + #{item.requestErrorRate,jdbcType=VARCHAR}, #{item.requestPendingRate,jdbcType=VARCHAR}, + #{item.requestFakeErrorRate,jdbcType=VARCHAR}, #{item.requestPassRate,jdbcType=VARCHAR}, #{item.assertionPassRate,jdbcType=VARCHAR}, #{item.scriptIdentifier,jdbcType=VARCHAR} ) @@ -735,8 +769,14 @@ #{item.assertionSuccessCount,jdbcType=BIGINT} - - #{item.requestExecutionRate,jdbcType=VARCHAR} + + #{item.requestErrorRate,jdbcType=VARCHAR} + + + #{item.requestPendingRate,jdbcType=VARCHAR} + + + #{item.requestFakeErrorRate,jdbcType=VARCHAR} #{item.requestPassRate,jdbcType=VARCHAR} diff --git a/backend/framework/domain/src/main/resources/migration/3.0.0/ddl/V3.0.0_5__api_test.sql b/backend/framework/domain/src/main/resources/migration/3.0.0/ddl/V3.0.0_5__api_test.sql index 50e6a1c1ef..5e7d075543 100644 --- a/backend/framework/domain/src/main/resources/migration/3.0.0/ddl/V3.0.0_5__api_test.sql +++ b/backend/framework/domain/src/main/resources/migration/3.0.0/ddl/V3.0.0_5__api_test.sql @@ -126,7 +126,9 @@ CREATE TABLE IF NOT EXISTS api_report( `success_count` BIGINT NOT NULL DEFAULT 0 COMMENT '成功数' , `assertion_count` BIGINT NOT NULL DEFAULT 0 COMMENT '总断言数' , `assertion_success_count` BIGINT NOT NULL DEFAULT 0 COMMENT '成功断言数' , - `request_execution_rate` VARCHAR(20) NOT NULL DEFAULT 'Calculating' COMMENT '请求执行率' , + `request_error_rate` VARCHAR(20) NOT NULL DEFAULT 'Calculating' COMMENT '请求失败率' , + `request_pending_rate` VARCHAR(20) NOT NULL DEFAULT 'Calculating' COMMENT '请求未执行率' , + `request_fake_error_rate` VARCHAR(20) NOT NULL DEFAULT 'Calculating' COMMENT '请求误报率' , `request_pass_rate` VARCHAR(20) NOT NULL DEFAULT 'Calculating' COMMENT '请求通过率' , `assertion_pass_rate` VARCHAR(20) NOT NULL DEFAULT 'Calculating' COMMENT '断言通过率' , `script_identifier` VARCHAR(255) COMMENT '脚本标识' , @@ -365,7 +367,9 @@ CREATE TABLE IF NOT EXISTS api_scenario_report( `success_count` BIGINT NOT NULL DEFAULT 0 COMMENT '成功数' , `assertion_count` BIGINT NOT NULL DEFAULT 0 COMMENT '总断言数' , `assertion_success_count` BIGINT NOT NULL DEFAULT 0 COMMENT '成功断言数' , - `request_execution_rate` VARCHAR(20) NOT NULL DEFAULT 'Calculating' COMMENT '请求执行率' , + `request_error_rate` VARCHAR(20) NOT NULL DEFAULT 'Calculating' COMMENT '请求失败率' , + `request_pending_rate` VARCHAR(20) NOT NULL DEFAULT 'Calculating' COMMENT '请求未执行率' , + `request_fake_error_rate` VARCHAR(20) NOT NULL DEFAULT 'Calculating' COMMENT '请求误报率' , `request_pass_rate` VARCHAR(20) NOT NULL DEFAULT 'Calculating' COMMENT '请求通过率' , `assertion_pass_rate` VARCHAR(20) NOT NULL DEFAULT 'Calculating' COMMENT '断言通过率' , `script_identifier` VARCHAR(255) COMMENT '脚本标识' , diff --git a/backend/framework/sdk/src/main/java/io/metersphere/sdk/dto/api/result/ProcessResultDTO.java b/backend/framework/sdk/src/main/java/io/metersphere/sdk/dto/api/result/ProcessResultDTO.java index c9b330a398..068a61e5a5 100644 --- a/backend/framework/sdk/src/main/java/io/metersphere/sdk/dto/api/result/ProcessResultDTO.java +++ b/backend/framework/sdk/src/main/java/io/metersphere/sdk/dto/api/result/ProcessResultDTO.java @@ -19,16 +19,15 @@ public class ProcessResultDTO { // TODO 根据初始步骤大小,在执行过程中进行标记; 初始大小 - 过程标记步骤 private long pendingCount; + // 断言总数 private long assertionCount; + // 成功断言数总数 private long successAssertionCount; - // 请求执行率 - private String requestExecutionRate; - // 请求通过率 - private String requestPassRate; - // 断言通过率 - private String assertionPassRate; + + // 请求总时长 + private long requestDuration; public void computerTotal() { this.total = this.pendingCount + this.errorCount + this.successCount; @@ -54,35 +53,8 @@ public class ProcessResultDTO { this.successAssertionCount += successAssertion; } - /** - * 整体执行完成后调用计算执行率 - * (成功+失败 ) /总量* 100 - */ - public void computerRequestExecutionRate() { - long count = this.successCount + this.errorCount; - if (this.total > 0 && count > 0) { - double executionRate = (double) count / this.total * 100; - this.requestExecutionRate = String.format("%.2f", executionRate); - } - } - - /** - * 整体完成后调用计算通过率 - * 成功总数 / 总量 * 100 - */ - public void computerRequestPassRate() { - if (this.total > 0 && this.successCount > 0) { - this.requestPassRate = String.format("%.2f", (double) this.successCount / this.total * 100); - } - } - - /** - * 整体完成后调用计算断言通过率 - */ - public void computerAssertionPassRate() { - if (this.assertionCount > 0 && successAssertionCount > 0) { - this.assertionPassRate = String.format("%.2f", (double) successAssertionCount / this.assertionCount * 100); - } + public void computerRequestDuration(long requestDuration) { + this.requestDuration += requestDuration; } }