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 0ef0804861..459e41dea5 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 @@ -111,21 +111,24 @@ public class ApiReport implements Serializable { @NotNull(message = "{api_report.assertion_count.not_blank}", groups = {Created.class}) private Long assertionCount; - @Schema(description = "失败断言数", requiredMode = Schema.RequiredMode.REQUIRED) - @NotNull(message = "{api_report.pass_assertions_count.not_blank}", groups = {Created.class}) - private Long passAssertionsCount; + @Schema(description = "通过断言数", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "{api_report.assertion_success_count.not_blank}", groups = {Created.class}) + private Long assertionSuccessCount; @Schema(description = "请求执行率", requiredMode = Schema.RequiredMode.REQUIRED) - @NotNull(message = "{api_report.request_execution_rate.not_blank}", groups = {Created.class}) - private Long requestExecutionRate; + @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) - @NotNull(message = "{api_report.request_approval_rate.not_blank}", groups = {Created.class}) - private Long requestApprovalRate; + @NotBlank(message = "{api_report.request_pass_rate.not_blank}", groups = {Created.class}) + @Size(min = 1, max = 20, message = "{api_report.request_pass_rate.length_range}", groups = {Created.class, Updated.class}) + private String requestPassRate; @Schema(description = "断言通过率", requiredMode = Schema.RequiredMode.REQUIRED) - @NotNull(message = "{api_report.assertion_pass_rate.not_blank}", groups = {Created.class}) - private Long assertionPassRate; + @NotBlank(message = "{api_report.assertion_pass_rate.not_blank}", groups = {Created.class}) + @Size(min = 1, max = 20, message = "{api_report.assertion_pass_rate.length_range}", groups = {Created.class, Updated.class}) + private String assertionPassRate; @Schema(description = "脚本标识") private String scriptIdentifier; @@ -158,10 +161,10 @@ public class ApiReport implements Serializable { pendingCount("pending_count", "pendingCount", "BIGINT", false), successCount("success_count", "successCount", "BIGINT", false), assertionCount("assertion_count", "assertionCount", "BIGINT", false), - passAssertionsCount("pass_assertions_count", "passAssertionsCount", "BIGINT", false), - requestExecutionRate("request_execution_rate", "requestExecutionRate", "BIGINT", false), - requestApprovalRate("request_approval_rate", "requestApprovalRate", "BIGINT", false), - assertionPassRate("assertion_pass_rate", "assertionPassRate", "BIGINT", false), + assertionSuccessCount("assertion_success_count", "assertionSuccessCount", "BIGINT", false), + requestExecutionRate("request_execution_rate", "requestExecutionRate", "VARCHAR", false), + requestPassRate("request_pass_rate", "requestPassRate", "VARCHAR", false), + assertionPassRate("assertion_pass_rate", "assertionPassRate", "VARCHAR", false), scriptIdentifier("script_identifier", "scriptIdentifier", "VARCHAR", false); private static final String BEGINNING_DELIMITER = "`"; 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 f9bbc7f706..8f49ddfcb2 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 @@ -1734,63 +1734,63 @@ public class ApiReportExample { return (Criteria) this; } - public Criteria andPassAssertionsCountIsNull() { - addCriterion("pass_assertions_count is null"); + public Criteria andAssertionSuccessCountIsNull() { + addCriterion("assertion_success_count is null"); return (Criteria) this; } - public Criteria andPassAssertionsCountIsNotNull() { - addCriterion("pass_assertions_count is not null"); + public Criteria andAssertionSuccessCountIsNotNull() { + addCriterion("assertion_success_count is not null"); return (Criteria) this; } - public Criteria andPassAssertionsCountEqualTo(Long value) { - addCriterion("pass_assertions_count =", value, "passAssertionsCount"); + public Criteria andAssertionSuccessCountEqualTo(Long value) { + addCriterion("assertion_success_count =", value, "assertionSuccessCount"); return (Criteria) this; } - public Criteria andPassAssertionsCountNotEqualTo(Long value) { - addCriterion("pass_assertions_count <>", value, "passAssertionsCount"); + public Criteria andAssertionSuccessCountNotEqualTo(Long value) { + addCriterion("assertion_success_count <>", value, "assertionSuccessCount"); return (Criteria) this; } - public Criteria andPassAssertionsCountGreaterThan(Long value) { - addCriterion("pass_assertions_count >", value, "passAssertionsCount"); + public Criteria andAssertionSuccessCountGreaterThan(Long value) { + addCriterion("assertion_success_count >", value, "assertionSuccessCount"); return (Criteria) this; } - public Criteria andPassAssertionsCountGreaterThanOrEqualTo(Long value) { - addCriterion("pass_assertions_count >=", value, "passAssertionsCount"); + public Criteria andAssertionSuccessCountGreaterThanOrEqualTo(Long value) { + addCriterion("assertion_success_count >=", value, "assertionSuccessCount"); return (Criteria) this; } - public Criteria andPassAssertionsCountLessThan(Long value) { - addCriterion("pass_assertions_count <", value, "passAssertionsCount"); + public Criteria andAssertionSuccessCountLessThan(Long value) { + addCriterion("assertion_success_count <", value, "assertionSuccessCount"); return (Criteria) this; } - public Criteria andPassAssertionsCountLessThanOrEqualTo(Long value) { - addCriterion("pass_assertions_count <=", value, "passAssertionsCount"); + public Criteria andAssertionSuccessCountLessThanOrEqualTo(Long value) { + addCriterion("assertion_success_count <=", value, "assertionSuccessCount"); return (Criteria) this; } - public Criteria andPassAssertionsCountIn(List values) { - addCriterion("pass_assertions_count in", values, "passAssertionsCount"); + public Criteria andAssertionSuccessCountIn(List values) { + addCriterion("assertion_success_count in", values, "assertionSuccessCount"); return (Criteria) this; } - public Criteria andPassAssertionsCountNotIn(List values) { - addCriterion("pass_assertions_count not in", values, "passAssertionsCount"); + public Criteria andAssertionSuccessCountNotIn(List values) { + addCriterion("assertion_success_count not in", values, "assertionSuccessCount"); return (Criteria) this; } - public Criteria andPassAssertionsCountBetween(Long value1, Long value2) { - addCriterion("pass_assertions_count between", value1, value2, "passAssertionsCount"); + public Criteria andAssertionSuccessCountBetween(Long value1, Long value2) { + addCriterion("assertion_success_count between", value1, value2, "assertionSuccessCount"); return (Criteria) this; } - public Criteria andPassAssertionsCountNotBetween(Long value1, Long value2) { - addCriterion("pass_assertions_count not between", value1, value2, "passAssertionsCount"); + public Criteria andAssertionSuccessCountNotBetween(Long value1, Long value2) { + addCriterion("assertion_success_count not between", value1, value2, "assertionSuccessCount"); return (Criteria) this; } @@ -1804,113 +1804,133 @@ public class ApiReportExample { return (Criteria) this; } - public Criteria andRequestExecutionRateEqualTo(Long value) { + public Criteria andRequestExecutionRateEqualTo(String value) { addCriterion("request_execution_rate =", value, "requestExecutionRate"); return (Criteria) this; } - public Criteria andRequestExecutionRateNotEqualTo(Long value) { + public Criteria andRequestExecutionRateNotEqualTo(String value) { addCriterion("request_execution_rate <>", value, "requestExecutionRate"); return (Criteria) this; } - public Criteria andRequestExecutionRateGreaterThan(Long value) { + public Criteria andRequestExecutionRateGreaterThan(String value) { addCriterion("request_execution_rate >", value, "requestExecutionRate"); return (Criteria) this; } - public Criteria andRequestExecutionRateGreaterThanOrEqualTo(Long value) { + public Criteria andRequestExecutionRateGreaterThanOrEqualTo(String value) { addCriterion("request_execution_rate >=", value, "requestExecutionRate"); return (Criteria) this; } - public Criteria andRequestExecutionRateLessThan(Long value) { + public Criteria andRequestExecutionRateLessThan(String value) { addCriterion("request_execution_rate <", value, "requestExecutionRate"); return (Criteria) this; } - public Criteria andRequestExecutionRateLessThanOrEqualTo(Long value) { + public Criteria andRequestExecutionRateLessThanOrEqualTo(String value) { addCriterion("request_execution_rate <=", value, "requestExecutionRate"); return (Criteria) this; } - public Criteria andRequestExecutionRateIn(List values) { + public Criteria andRequestExecutionRateLike(String value) { + addCriterion("request_execution_rate like", value, "requestExecutionRate"); + return (Criteria) this; + } + + public Criteria andRequestExecutionRateNotLike(String value) { + addCriterion("request_execution_rate not like", value, "requestExecutionRate"); + return (Criteria) this; + } + + public Criteria andRequestExecutionRateIn(List values) { addCriterion("request_execution_rate in", values, "requestExecutionRate"); return (Criteria) this; } - public Criteria andRequestExecutionRateNotIn(List values) { + public Criteria andRequestExecutionRateNotIn(List values) { addCriterion("request_execution_rate not in", values, "requestExecutionRate"); return (Criteria) this; } - public Criteria andRequestExecutionRateBetween(Long value1, Long value2) { + public Criteria andRequestExecutionRateBetween(String value1, String value2) { addCriterion("request_execution_rate between", value1, value2, "requestExecutionRate"); return (Criteria) this; } - public Criteria andRequestExecutionRateNotBetween(Long value1, Long value2) { + public Criteria andRequestExecutionRateNotBetween(String value1, String value2) { addCriterion("request_execution_rate not between", value1, value2, "requestExecutionRate"); return (Criteria) this; } - public Criteria andRequestApprovalRateIsNull() { - addCriterion("request_approval_rate is null"); + public Criteria andRequestPassRateIsNull() { + addCriterion("request_pass_rate is null"); return (Criteria) this; } - public Criteria andRequestApprovalRateIsNotNull() { - addCriterion("request_approval_rate is not null"); + public Criteria andRequestPassRateIsNotNull() { + addCriterion("request_pass_rate is not null"); return (Criteria) this; } - public Criteria andRequestApprovalRateEqualTo(Long value) { - addCriterion("request_approval_rate =", value, "requestApprovalRate"); + public Criteria andRequestPassRateEqualTo(String value) { + addCriterion("request_pass_rate =", value, "requestPassRate"); return (Criteria) this; } - public Criteria andRequestApprovalRateNotEqualTo(Long value) { - addCriterion("request_approval_rate <>", value, "requestApprovalRate"); + public Criteria andRequestPassRateNotEqualTo(String value) { + addCriterion("request_pass_rate <>", value, "requestPassRate"); return (Criteria) this; } - public Criteria andRequestApprovalRateGreaterThan(Long value) { - addCriterion("request_approval_rate >", value, "requestApprovalRate"); + public Criteria andRequestPassRateGreaterThan(String value) { + addCriterion("request_pass_rate >", value, "requestPassRate"); return (Criteria) this; } - public Criteria andRequestApprovalRateGreaterThanOrEqualTo(Long value) { - addCriterion("request_approval_rate >=", value, "requestApprovalRate"); + public Criteria andRequestPassRateGreaterThanOrEqualTo(String value) { + addCriterion("request_pass_rate >=", value, "requestPassRate"); return (Criteria) this; } - public Criteria andRequestApprovalRateLessThan(Long value) { - addCriterion("request_approval_rate <", value, "requestApprovalRate"); + public Criteria andRequestPassRateLessThan(String value) { + addCriterion("request_pass_rate <", value, "requestPassRate"); return (Criteria) this; } - public Criteria andRequestApprovalRateLessThanOrEqualTo(Long value) { - addCriterion("request_approval_rate <=", value, "requestApprovalRate"); + public Criteria andRequestPassRateLessThanOrEqualTo(String value) { + addCriterion("request_pass_rate <=", value, "requestPassRate"); return (Criteria) this; } - public Criteria andRequestApprovalRateIn(List values) { - addCriterion("request_approval_rate in", values, "requestApprovalRate"); + public Criteria andRequestPassRateLike(String value) { + addCriterion("request_pass_rate like", value, "requestPassRate"); return (Criteria) this; } - public Criteria andRequestApprovalRateNotIn(List values) { - addCriterion("request_approval_rate not in", values, "requestApprovalRate"); + public Criteria andRequestPassRateNotLike(String value) { + addCriterion("request_pass_rate not like", value, "requestPassRate"); return (Criteria) this; } - public Criteria andRequestApprovalRateBetween(Long value1, Long value2) { - addCriterion("request_approval_rate between", value1, value2, "requestApprovalRate"); + public Criteria andRequestPassRateIn(List values) { + addCriterion("request_pass_rate in", values, "requestPassRate"); return (Criteria) this; } - public Criteria andRequestApprovalRateNotBetween(Long value1, Long value2) { - addCriterion("request_approval_rate not between", value1, value2, "requestApprovalRate"); + public Criteria andRequestPassRateNotIn(List values) { + addCriterion("request_pass_rate not in", values, "requestPassRate"); + return (Criteria) this; + } + + public Criteria andRequestPassRateBetween(String value1, String value2) { + addCriterion("request_pass_rate between", value1, value2, "requestPassRate"); + return (Criteria) this; + } + + public Criteria andRequestPassRateNotBetween(String value1, String value2) { + addCriterion("request_pass_rate not between", value1, value2, "requestPassRate"); return (Criteria) this; } @@ -1924,52 +1944,62 @@ public class ApiReportExample { return (Criteria) this; } - public Criteria andAssertionPassRateEqualTo(Long value) { + public Criteria andAssertionPassRateEqualTo(String value) { addCriterion("assertion_pass_rate =", value, "assertionPassRate"); return (Criteria) this; } - public Criteria andAssertionPassRateNotEqualTo(Long value) { + public Criteria andAssertionPassRateNotEqualTo(String value) { addCriterion("assertion_pass_rate <>", value, "assertionPassRate"); return (Criteria) this; } - public Criteria andAssertionPassRateGreaterThan(Long value) { + public Criteria andAssertionPassRateGreaterThan(String value) { addCriterion("assertion_pass_rate >", value, "assertionPassRate"); return (Criteria) this; } - public Criteria andAssertionPassRateGreaterThanOrEqualTo(Long value) { + public Criteria andAssertionPassRateGreaterThanOrEqualTo(String value) { addCriterion("assertion_pass_rate >=", value, "assertionPassRate"); return (Criteria) this; } - public Criteria andAssertionPassRateLessThan(Long value) { + public Criteria andAssertionPassRateLessThan(String value) { addCriterion("assertion_pass_rate <", value, "assertionPassRate"); return (Criteria) this; } - public Criteria andAssertionPassRateLessThanOrEqualTo(Long value) { + public Criteria andAssertionPassRateLessThanOrEqualTo(String value) { addCriterion("assertion_pass_rate <=", value, "assertionPassRate"); return (Criteria) this; } - public Criteria andAssertionPassRateIn(List values) { + public Criteria andAssertionPassRateLike(String value) { + addCriterion("assertion_pass_rate like", value, "assertionPassRate"); + return (Criteria) this; + } + + public Criteria andAssertionPassRateNotLike(String value) { + addCriterion("assertion_pass_rate not like", value, "assertionPassRate"); + return (Criteria) this; + } + + public Criteria andAssertionPassRateIn(List values) { addCriterion("assertion_pass_rate in", values, "assertionPassRate"); return (Criteria) this; } - public Criteria andAssertionPassRateNotIn(List values) { + public Criteria andAssertionPassRateNotIn(List values) { addCriterion("assertion_pass_rate not in", values, "assertionPassRate"); return (Criteria) this; } - public Criteria andAssertionPassRateBetween(Long value1, Long value2) { + public Criteria andAssertionPassRateBetween(String value1, String value2) { addCriterion("assertion_pass_rate between", value1, value2, "assertionPassRate"); return (Criteria) this; } - public Criteria andAssertionPassRateNotBetween(Long value1, Long value2) { + public Criteria andAssertionPassRateNotBetween(String value1, String value2) { addCriterion("assertion_pass_rate not between", value1, value2, "assertionPassRate"); 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 9d7cc96488..298c3f42d3 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 @@ -111,21 +111,24 @@ public class ApiScenarioReport implements Serializable { @NotNull(message = "{api_scenario_report.assertion_count.not_blank}", groups = {Created.class}) private Long assertionCount; - @Schema(description = "失败断言数", requiredMode = Schema.RequiredMode.REQUIRED) - @NotNull(message = "{api_scenario_report.pass_assertions_count.not_blank}", groups = {Created.class}) - private Long passAssertionsCount; + @Schema(description = "通过断言数", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "{api_scenario_report.assertion_success_count.not_blank}", groups = {Created.class}) + private Long assertionSuccessCount; @Schema(description = "请求执行率", requiredMode = Schema.RequiredMode.REQUIRED) - @NotNull(message = "{api_scenario_report.request_execution_rate.not_blank}", groups = {Created.class}) - private Long requestExecutionRate; + @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) - @NotNull(message = "{api_scenario_report.request_approval_rate.not_blank}", groups = {Created.class}) - private Long requestApprovalRate; + @NotBlank(message = "{api_scenario_report.request_pass_rate.not_blank}", groups = {Created.class}) + @Size(min = 1, max = 20, message = "{api_scenario_report.request_pass_rate.length_range}", groups = {Created.class, Updated.class}) + private String requestPassRate; @Schema(description = "断言通过率", requiredMode = Schema.RequiredMode.REQUIRED) - @NotNull(message = "{api_scenario_report.assertion_pass_rate.not_blank}", groups = {Created.class}) - private Long assertionPassRate; + @NotBlank(message = "{api_scenario_report.assertion_pass_rate.not_blank}", groups = {Created.class}) + @Size(min = 1, max = 20, message = "{api_scenario_report.assertion_pass_rate.length_range}", groups = {Created.class, Updated.class}) + private String assertionPassRate; @Schema(description = "脚本标识") private String scriptIdentifier; @@ -158,10 +161,10 @@ public class ApiScenarioReport implements Serializable { pendingCount("pending_count", "pendingCount", "BIGINT", false), successCount("success_count", "successCount", "BIGINT", false), assertionCount("assertion_count", "assertionCount", "BIGINT", false), - passAssertionsCount("pass_assertions_count", "passAssertionsCount", "BIGINT", false), - requestExecutionRate("request_execution_rate", "requestExecutionRate", "BIGINT", false), - requestApprovalRate("request_approval_rate", "requestApprovalRate", "BIGINT", false), - assertionPassRate("assertion_pass_rate", "assertionPassRate", "BIGINT", false), + assertionSuccessCount("assertion_success_count", "assertionSuccessCount", "BIGINT", false), + requestExecutionRate("request_execution_rate", "requestExecutionRate", "VARCHAR", false), + requestPassRate("request_pass_rate", "requestPassRate", "VARCHAR", false), + assertionPassRate("assertion_pass_rate", "assertionPassRate", "VARCHAR", false), scriptIdentifier("script_identifier", "scriptIdentifier", "VARCHAR", false); private static final String BEGINNING_DELIMITER = "`"; 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 990f2f66a0..468903b70f 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 @@ -1734,63 +1734,63 @@ public class ApiScenarioReportExample { return (Criteria) this; } - public Criteria andPassAssertionsCountIsNull() { - addCriterion("pass_assertions_count is null"); + public Criteria andAssertionSuccessCountIsNull() { + addCriterion("assertion_success_count is null"); return (Criteria) this; } - public Criteria andPassAssertionsCountIsNotNull() { - addCriterion("pass_assertions_count is not null"); + public Criteria andAssertionSuccessCountIsNotNull() { + addCriterion("assertion_success_count is not null"); return (Criteria) this; } - public Criteria andPassAssertionsCountEqualTo(Long value) { - addCriterion("pass_assertions_count =", value, "passAssertionsCount"); + public Criteria andAssertionSuccessCountEqualTo(Long value) { + addCriterion("assertion_success_count =", value, "assertionSuccessCount"); return (Criteria) this; } - public Criteria andPassAssertionsCountNotEqualTo(Long value) { - addCriterion("pass_assertions_count <>", value, "passAssertionsCount"); + public Criteria andAssertionSuccessCountNotEqualTo(Long value) { + addCriterion("assertion_success_count <>", value, "assertionSuccessCount"); return (Criteria) this; } - public Criteria andPassAssertionsCountGreaterThan(Long value) { - addCriterion("pass_assertions_count >", value, "passAssertionsCount"); + public Criteria andAssertionSuccessCountGreaterThan(Long value) { + addCriterion("assertion_success_count >", value, "assertionSuccessCount"); return (Criteria) this; } - public Criteria andPassAssertionsCountGreaterThanOrEqualTo(Long value) { - addCriterion("pass_assertions_count >=", value, "passAssertionsCount"); + public Criteria andAssertionSuccessCountGreaterThanOrEqualTo(Long value) { + addCriterion("assertion_success_count >=", value, "assertionSuccessCount"); return (Criteria) this; } - public Criteria andPassAssertionsCountLessThan(Long value) { - addCriterion("pass_assertions_count <", value, "passAssertionsCount"); + public Criteria andAssertionSuccessCountLessThan(Long value) { + addCriterion("assertion_success_count <", value, "assertionSuccessCount"); return (Criteria) this; } - public Criteria andPassAssertionsCountLessThanOrEqualTo(Long value) { - addCriterion("pass_assertions_count <=", value, "passAssertionsCount"); + public Criteria andAssertionSuccessCountLessThanOrEqualTo(Long value) { + addCriterion("assertion_success_count <=", value, "assertionSuccessCount"); return (Criteria) this; } - public Criteria andPassAssertionsCountIn(List values) { - addCriterion("pass_assertions_count in", values, "passAssertionsCount"); + public Criteria andAssertionSuccessCountIn(List values) { + addCriterion("assertion_success_count in", values, "assertionSuccessCount"); return (Criteria) this; } - public Criteria andPassAssertionsCountNotIn(List values) { - addCriterion("pass_assertions_count not in", values, "passAssertionsCount"); + public Criteria andAssertionSuccessCountNotIn(List values) { + addCriterion("assertion_success_count not in", values, "assertionSuccessCount"); return (Criteria) this; } - public Criteria andPassAssertionsCountBetween(Long value1, Long value2) { - addCriterion("pass_assertions_count between", value1, value2, "passAssertionsCount"); + public Criteria andAssertionSuccessCountBetween(Long value1, Long value2) { + addCriterion("assertion_success_count between", value1, value2, "assertionSuccessCount"); return (Criteria) this; } - public Criteria andPassAssertionsCountNotBetween(Long value1, Long value2) { - addCriterion("pass_assertions_count not between", value1, value2, "passAssertionsCount"); + public Criteria andAssertionSuccessCountNotBetween(Long value1, Long value2) { + addCriterion("assertion_success_count not between", value1, value2, "assertionSuccessCount"); return (Criteria) this; } @@ -1804,113 +1804,133 @@ public class ApiScenarioReportExample { return (Criteria) this; } - public Criteria andRequestExecutionRateEqualTo(Long value) { + public Criteria andRequestExecutionRateEqualTo(String value) { addCriterion("request_execution_rate =", value, "requestExecutionRate"); return (Criteria) this; } - public Criteria andRequestExecutionRateNotEqualTo(Long value) { + public Criteria andRequestExecutionRateNotEqualTo(String value) { addCriterion("request_execution_rate <>", value, "requestExecutionRate"); return (Criteria) this; } - public Criteria andRequestExecutionRateGreaterThan(Long value) { + public Criteria andRequestExecutionRateGreaterThan(String value) { addCriterion("request_execution_rate >", value, "requestExecutionRate"); return (Criteria) this; } - public Criteria andRequestExecutionRateGreaterThanOrEqualTo(Long value) { + public Criteria andRequestExecutionRateGreaterThanOrEqualTo(String value) { addCriterion("request_execution_rate >=", value, "requestExecutionRate"); return (Criteria) this; } - public Criteria andRequestExecutionRateLessThan(Long value) { + public Criteria andRequestExecutionRateLessThan(String value) { addCriterion("request_execution_rate <", value, "requestExecutionRate"); return (Criteria) this; } - public Criteria andRequestExecutionRateLessThanOrEqualTo(Long value) { + public Criteria andRequestExecutionRateLessThanOrEqualTo(String value) { addCriterion("request_execution_rate <=", value, "requestExecutionRate"); return (Criteria) this; } - public Criteria andRequestExecutionRateIn(List values) { + public Criteria andRequestExecutionRateLike(String value) { + addCriterion("request_execution_rate like", value, "requestExecutionRate"); + return (Criteria) this; + } + + public Criteria andRequestExecutionRateNotLike(String value) { + addCriterion("request_execution_rate not like", value, "requestExecutionRate"); + return (Criteria) this; + } + + public Criteria andRequestExecutionRateIn(List values) { addCriterion("request_execution_rate in", values, "requestExecutionRate"); return (Criteria) this; } - public Criteria andRequestExecutionRateNotIn(List values) { + public Criteria andRequestExecutionRateNotIn(List values) { addCriterion("request_execution_rate not in", values, "requestExecutionRate"); return (Criteria) this; } - public Criteria andRequestExecutionRateBetween(Long value1, Long value2) { + public Criteria andRequestExecutionRateBetween(String value1, String value2) { addCriterion("request_execution_rate between", value1, value2, "requestExecutionRate"); return (Criteria) this; } - public Criteria andRequestExecutionRateNotBetween(Long value1, Long value2) { + public Criteria andRequestExecutionRateNotBetween(String value1, String value2) { addCriterion("request_execution_rate not between", value1, value2, "requestExecutionRate"); return (Criteria) this; } - public Criteria andRequestApprovalRateIsNull() { - addCriterion("request_approval_rate is null"); + public Criteria andRequestPassRateIsNull() { + addCriterion("request_pass_rate is null"); return (Criteria) this; } - public Criteria andRequestApprovalRateIsNotNull() { - addCriterion("request_approval_rate is not null"); + public Criteria andRequestPassRateIsNotNull() { + addCriterion("request_pass_rate is not null"); return (Criteria) this; } - public Criteria andRequestApprovalRateEqualTo(Long value) { - addCriterion("request_approval_rate =", value, "requestApprovalRate"); + public Criteria andRequestPassRateEqualTo(String value) { + addCriterion("request_pass_rate =", value, "requestPassRate"); return (Criteria) this; } - public Criteria andRequestApprovalRateNotEqualTo(Long value) { - addCriterion("request_approval_rate <>", value, "requestApprovalRate"); + public Criteria andRequestPassRateNotEqualTo(String value) { + addCriterion("request_pass_rate <>", value, "requestPassRate"); return (Criteria) this; } - public Criteria andRequestApprovalRateGreaterThan(Long value) { - addCriterion("request_approval_rate >", value, "requestApprovalRate"); + public Criteria andRequestPassRateGreaterThan(String value) { + addCriterion("request_pass_rate >", value, "requestPassRate"); return (Criteria) this; } - public Criteria andRequestApprovalRateGreaterThanOrEqualTo(Long value) { - addCriterion("request_approval_rate >=", value, "requestApprovalRate"); + public Criteria andRequestPassRateGreaterThanOrEqualTo(String value) { + addCriterion("request_pass_rate >=", value, "requestPassRate"); return (Criteria) this; } - public Criteria andRequestApprovalRateLessThan(Long value) { - addCriterion("request_approval_rate <", value, "requestApprovalRate"); + public Criteria andRequestPassRateLessThan(String value) { + addCriterion("request_pass_rate <", value, "requestPassRate"); return (Criteria) this; } - public Criteria andRequestApprovalRateLessThanOrEqualTo(Long value) { - addCriterion("request_approval_rate <=", value, "requestApprovalRate"); + public Criteria andRequestPassRateLessThanOrEqualTo(String value) { + addCriterion("request_pass_rate <=", value, "requestPassRate"); return (Criteria) this; } - public Criteria andRequestApprovalRateIn(List values) { - addCriterion("request_approval_rate in", values, "requestApprovalRate"); + public Criteria andRequestPassRateLike(String value) { + addCriterion("request_pass_rate like", value, "requestPassRate"); return (Criteria) this; } - public Criteria andRequestApprovalRateNotIn(List values) { - addCriterion("request_approval_rate not in", values, "requestApprovalRate"); + public Criteria andRequestPassRateNotLike(String value) { + addCriterion("request_pass_rate not like", value, "requestPassRate"); return (Criteria) this; } - public Criteria andRequestApprovalRateBetween(Long value1, Long value2) { - addCriterion("request_approval_rate between", value1, value2, "requestApprovalRate"); + public Criteria andRequestPassRateIn(List values) { + addCriterion("request_pass_rate in", values, "requestPassRate"); return (Criteria) this; } - public Criteria andRequestApprovalRateNotBetween(Long value1, Long value2) { - addCriterion("request_approval_rate not between", value1, value2, "requestApprovalRate"); + public Criteria andRequestPassRateNotIn(List values) { + addCriterion("request_pass_rate not in", values, "requestPassRate"); + return (Criteria) this; + } + + public Criteria andRequestPassRateBetween(String value1, String value2) { + addCriterion("request_pass_rate between", value1, value2, "requestPassRate"); + return (Criteria) this; + } + + public Criteria andRequestPassRateNotBetween(String value1, String value2) { + addCriterion("request_pass_rate not between", value1, value2, "requestPassRate"); return (Criteria) this; } @@ -1924,52 +1944,62 @@ public class ApiScenarioReportExample { return (Criteria) this; } - public Criteria andAssertionPassRateEqualTo(Long value) { + public Criteria andAssertionPassRateEqualTo(String value) { addCriterion("assertion_pass_rate =", value, "assertionPassRate"); return (Criteria) this; } - public Criteria andAssertionPassRateNotEqualTo(Long value) { + public Criteria andAssertionPassRateNotEqualTo(String value) { addCriterion("assertion_pass_rate <>", value, "assertionPassRate"); return (Criteria) this; } - public Criteria andAssertionPassRateGreaterThan(Long value) { + public Criteria andAssertionPassRateGreaterThan(String value) { addCriterion("assertion_pass_rate >", value, "assertionPassRate"); return (Criteria) this; } - public Criteria andAssertionPassRateGreaterThanOrEqualTo(Long value) { + public Criteria andAssertionPassRateGreaterThanOrEqualTo(String value) { addCriterion("assertion_pass_rate >=", value, "assertionPassRate"); return (Criteria) this; } - public Criteria andAssertionPassRateLessThan(Long value) { + public Criteria andAssertionPassRateLessThan(String value) { addCriterion("assertion_pass_rate <", value, "assertionPassRate"); return (Criteria) this; } - public Criteria andAssertionPassRateLessThanOrEqualTo(Long value) { + public Criteria andAssertionPassRateLessThanOrEqualTo(String value) { addCriterion("assertion_pass_rate <=", value, "assertionPassRate"); return (Criteria) this; } - public Criteria andAssertionPassRateIn(List values) { + public Criteria andAssertionPassRateLike(String value) { + addCriterion("assertion_pass_rate like", value, "assertionPassRate"); + return (Criteria) this; + } + + public Criteria andAssertionPassRateNotLike(String value) { + addCriterion("assertion_pass_rate not like", value, "assertionPassRate"); + return (Criteria) this; + } + + public Criteria andAssertionPassRateIn(List values) { addCriterion("assertion_pass_rate in", values, "assertionPassRate"); return (Criteria) this; } - public Criteria andAssertionPassRateNotIn(List values) { + public Criteria andAssertionPassRateNotIn(List values) { addCriterion("assertion_pass_rate not in", values, "assertionPassRate"); return (Criteria) this; } - public Criteria andAssertionPassRateBetween(Long value1, Long value2) { + public Criteria andAssertionPassRateBetween(String value1, String value2) { addCriterion("assertion_pass_rate between", value1, value2, "assertionPassRate"); return (Criteria) this; } - public Criteria andAssertionPassRateNotBetween(Long value1, Long value2) { + public Criteria andAssertionPassRateNotBetween(String value1, String value2) { addCriterion("assertion_pass_rate not between", value1, value2, "assertionPassRate"); 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 e631de2da1..186bf511ca 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 @@ -27,10 +27,10 @@ - - - - + + + + @@ -95,8 +95,8 @@ id, `name`, resource_id, create_user, delete_time, delete_user, deleted, 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, pass_assertions_count, request_execution_rate, - request_approval_rate, assertion_pass_rate, script_identifier + pending_count, success_count, assertion_count, assertion_success_count, request_execution_rate, + request_pass_rate, assertion_pass_rate, script_identifier select @@ -137,8 +137,8 @@ pool_id, version_id, integrated, project_id, environment_id, error_count, fake_error_count, pending_count, success_count, - assertion_count, pass_assertions_count, request_execution_rate, - request_approval_rate, assertion_pass_rate, script_identifier + assertion_count, assertion_success_count, request_execution_rate, + request_pass_rate, assertion_pass_rate, script_identifier ) values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{scenarioId,jdbcType=VARCHAR}, #{createUser,jdbcType=VARCHAR}, #{deleteTime,jdbcType=BIGINT}, #{deleteUser,jdbcType=VARCHAR}, @@ -148,8 +148,8 @@ #{poolId,jdbcType=VARCHAR}, #{versionId,jdbcType=VARCHAR}, #{integrated,jdbcType=BIT}, #{projectId,jdbcType=VARCHAR}, #{environmentId,jdbcType=VARCHAR}, #{errorCount,jdbcType=BIGINT}, #{fakeErrorCount,jdbcType=BIGINT}, #{pendingCount,jdbcType=BIGINT}, #{successCount,jdbcType=BIGINT}, - #{assertionCount,jdbcType=BIGINT}, #{passAssertionsCount,jdbcType=BIGINT}, #{requestExecutionRate,jdbcType=BIGINT}, - #{requestApprovalRate,jdbcType=BIGINT}, #{assertionPassRate,jdbcType=BIGINT}, #{scriptIdentifier,jdbcType=VARCHAR} + #{assertionCount,jdbcType=BIGINT}, #{assertionSuccessCount,jdbcType=BIGINT}, #{requestExecutionRate,jdbcType=VARCHAR}, + #{requestPassRate,jdbcType=VARCHAR}, #{assertionPassRate,jdbcType=VARCHAR}, #{scriptIdentifier,jdbcType=VARCHAR} ) @@ -230,14 +230,14 @@ assertion_count, - - pass_assertions_count, + + assertion_success_count, request_execution_rate, - - request_approval_rate, + + request_pass_rate, assertion_pass_rate, @@ -322,17 +322,17 @@ #{assertionCount,jdbcType=BIGINT}, - - #{passAssertionsCount,jdbcType=BIGINT}, + + #{assertionSuccessCount,jdbcType=BIGINT}, - #{requestExecutionRate,jdbcType=BIGINT}, + #{requestExecutionRate,jdbcType=VARCHAR}, - - #{requestApprovalRate,jdbcType=BIGINT}, + + #{requestPassRate,jdbcType=VARCHAR}, - #{assertionPassRate,jdbcType=BIGINT}, + #{assertionPassRate,jdbcType=VARCHAR}, #{scriptIdentifier,jdbcType=VARCHAR}, @@ -423,17 +423,17 @@ assertion_count = #{record.assertionCount,jdbcType=BIGINT}, - - pass_assertions_count = #{record.passAssertionsCount,jdbcType=BIGINT}, + + assertion_success_count = #{record.assertionSuccessCount,jdbcType=BIGINT}, - request_execution_rate = #{record.requestExecutionRate,jdbcType=BIGINT}, + request_execution_rate = #{record.requestExecutionRate,jdbcType=VARCHAR}, - - request_approval_rate = #{record.requestApprovalRate,jdbcType=BIGINT}, + + request_pass_rate = #{record.requestPassRate,jdbcType=VARCHAR}, - assertion_pass_rate = #{record.assertionPassRate,jdbcType=BIGINT}, + assertion_pass_rate = #{record.assertionPassRate,jdbcType=VARCHAR}, script_identifier = #{record.scriptIdentifier,jdbcType=VARCHAR}, @@ -470,10 +470,10 @@ pending_count = #{record.pendingCount,jdbcType=BIGINT}, success_count = #{record.successCount,jdbcType=BIGINT}, assertion_count = #{record.assertionCount,jdbcType=BIGINT}, - pass_assertions_count = #{record.passAssertionsCount,jdbcType=BIGINT}, - request_execution_rate = #{record.requestExecutionRate,jdbcType=BIGINT}, - request_approval_rate = #{record.requestApprovalRate,jdbcType=BIGINT}, - assertion_pass_rate = #{record.assertionPassRate,jdbcType=BIGINT}, + assertion_success_count = #{record.assertionSuccessCount,jdbcType=BIGINT}, + request_execution_rate = #{record.requestExecutionRate,jdbcType=VARCHAR}, + request_pass_rate = #{record.requestPassRate,jdbcType=VARCHAR}, + assertion_pass_rate = #{record.assertionPassRate,jdbcType=VARCHAR}, script_identifier = #{record.scriptIdentifier,jdbcType=VARCHAR} @@ -554,17 +554,17 @@ assertion_count = #{assertionCount,jdbcType=BIGINT}, - - pass_assertions_count = #{passAssertionsCount,jdbcType=BIGINT}, + + assertion_success_count = #{assertionSuccessCount,jdbcType=BIGINT}, - request_execution_rate = #{requestExecutionRate,jdbcType=BIGINT}, + request_execution_rate = #{requestExecutionRate,jdbcType=VARCHAR}, - - request_approval_rate = #{requestApprovalRate,jdbcType=BIGINT}, + + request_pass_rate = #{requestPassRate,jdbcType=VARCHAR}, - assertion_pass_rate = #{assertionPassRate,jdbcType=BIGINT}, + assertion_pass_rate = #{assertionPassRate,jdbcType=VARCHAR}, script_identifier = #{scriptIdentifier,jdbcType=VARCHAR}, @@ -598,10 +598,10 @@ pending_count = #{pendingCount,jdbcType=BIGINT}, success_count = #{successCount,jdbcType=BIGINT}, assertion_count = #{assertionCount,jdbcType=BIGINT}, - pass_assertions_count = #{passAssertionsCount,jdbcType=BIGINT}, - request_execution_rate = #{requestExecutionRate,jdbcType=BIGINT}, - request_approval_rate = #{requestApprovalRate,jdbcType=BIGINT}, - assertion_pass_rate = #{assertionPassRate,jdbcType=BIGINT}, + assertion_success_count = #{assertionSuccessCount,jdbcType=BIGINT}, + request_execution_rate = #{requestExecutionRate,jdbcType=VARCHAR}, + request_pass_rate = #{requestPassRate,jdbcType=VARCHAR}, + assertion_pass_rate = #{assertionPassRate,jdbcType=VARCHAR}, script_identifier = #{scriptIdentifier,jdbcType=VARCHAR} where id = #{id,jdbcType=VARCHAR} @@ -610,8 +610,8 @@ (id, `name`, scenario_id, create_user, delete_time, delete_user, deleted, 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, pass_assertions_count, request_execution_rate, - request_approval_rate, assertion_pass_rate, script_identifier) + pending_count, success_count, assertion_count, assertion_success_count, request_execution_rate, + request_pass_rate, assertion_pass_rate, script_identifier) values (#{item.id,jdbcType=VARCHAR}, #{item.name,jdbcType=VARCHAR}, #{item.scenarioId,jdbcType=VARCHAR}, @@ -622,9 +622,9 @@ #{item.poolId,jdbcType=VARCHAR}, #{item.versionId,jdbcType=VARCHAR}, #{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.passAssertionsCount,jdbcType=BIGINT}, - #{item.requestExecutionRate,jdbcType=BIGINT}, #{item.requestApprovalRate,jdbcType=BIGINT}, - #{item.assertionPassRate,jdbcType=BIGINT}, #{item.scriptIdentifier,jdbcType=VARCHAR} + #{item.assertionCount,jdbcType=BIGINT}, #{item.assertionSuccessCount,jdbcType=BIGINT}, + #{item.requestExecutionRate,jdbcType=VARCHAR}, #{item.requestPassRate,jdbcType=VARCHAR}, + #{item.assertionPassRate,jdbcType=VARCHAR}, #{item.scriptIdentifier,jdbcType=VARCHAR} ) @@ -713,17 +713,17 @@ #{item.assertionCount,jdbcType=BIGINT} - - #{item.passAssertionsCount,jdbcType=BIGINT} + + #{item.assertionSuccessCount,jdbcType=BIGINT} - #{item.requestExecutionRate,jdbcType=BIGINT} + #{item.requestExecutionRate,jdbcType=VARCHAR} - - #{item.requestApprovalRate,jdbcType=BIGINT} + + #{item.requestPassRate,jdbcType=VARCHAR} - #{item.assertionPassRate,jdbcType=BIGINT} + #{item.assertionPassRate,jdbcType=VARCHAR} #{item.scriptIdentifier,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 b7720069e7..8d7e32f723 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 @@ -124,10 +124,10 @@ CREATE TABLE IF NOT EXISTS api_report( `pending_count` BIGINT NOT NULL DEFAULT 0 COMMENT '未执行数' , `success_count` BIGINT NOT NULL DEFAULT 0 COMMENT '成功数' , `assertion_count` BIGINT NOT NULL DEFAULT 0 COMMENT '总断言数' , - `pass_assertions_count` BIGINT NOT NULL DEFAULT 0 COMMENT '失败断言数' , - `request_execution_rate` BIGINT NOT NULL DEFAULT 0 COMMENT '请求执行率' , - `request_approval_rate` BIGINT NOT NULL DEFAULT 0 COMMENT '请求通过率' , - `assertion_pass_rate` BIGINT NOT NULL DEFAULT 0 COMMENT '断言通过率' , + `assertion_success_count` BIGINT NOT NULL DEFAULT 0 COMMENT '通过断言数' , + `request_execution_rate` VARCHAR(20) NOT NULL COMMENT '请求执行率' , + `request_pass_rate` VARCHAR(20) NOT NULL COMMENT '请求通过率' , + `assertion_pass_rate` VARCHAR(20) NOT NULL COMMENT '断言通过率' , `script_identifier` VARCHAR(255) COMMENT '脚本标识' , PRIMARY KEY (id) ) @@ -338,10 +338,10 @@ CREATE TABLE IF NOT EXISTS api_scenario_report( `pending_count` BIGINT NOT NULL DEFAULT 0 COMMENT '未执行数' , `success_count` BIGINT NOT NULL DEFAULT 0 COMMENT '成功数' , `assertion_count` BIGINT NOT NULL DEFAULT 0 COMMENT '总断言数' , - `pass_assertions_count` BIGINT NOT NULL DEFAULT 0 COMMENT '失败断言数' , - `request_execution_rate` BIGINT NOT NULL DEFAULT 0 COMMENT '请求执行率' , - `request_approval_rate` BIGINT NOT NULL DEFAULT 0 COMMENT '请求通过率' , - `assertion_pass_rate` BIGINT NOT NULL DEFAULT 0 COMMENT '断言通过率' , + `assertion_success_count` BIGINT NOT NULL DEFAULT 0 COMMENT '通过断言数' , + `request_execution_rate` VARCHAR(20) NOT NULL COMMENT '请求执行率' , + `request_pass_rate` VARCHAR(20) NOT NULL COMMENT '请求通过率' , + `assertion_pass_rate` VARCHAR(20) NOT NULL COMMENT '断言通过率' , `script_identifier` VARCHAR(255) COMMENT '脚本标识' , PRIMARY KEY (id) ) ENGINE = InnoDB 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 0f7513d9c5..97a02ff958 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 @@ -4,22 +4,72 @@ import lombok.Data; @Data public class ProcessResultDTO { + // 报告状态 private String status; - private long scenarioSuccess; - private int scenarioTotal; + // 总数 + private long total; + // 成功总数 + private long successCount; + // 误报总数 + private long fakeErrorCount; + // 失败总数 + private long errorCount; + // 未执行总数 + private long pendingCount; + // 断言总数 + private long assertionCount; + // 成功断言数总数 + private long successAssertionCount; + // 请求执行率 + private String requestExecutionRate; + // 请求通过率 + private String requestPassRate; + // 断言通过率 + private String assertionPassRate; - public void computerTotal(int total) { - this.scenarioTotal += total; + public void computerTotal() { + this.total = (this.successCount + this.errorCount + this.pendingCount); + } + + public void computerFakeError(long fakeErrorCount) { + this.fakeErrorCount += fakeErrorCount; } public void computerSuccess(long success) { - this.scenarioSuccess += success; + this.successCount += success; } - public long computerPassRate() { - if (this.scenarioTotal == 0) return 0; - return this.scenarioSuccess / this.scenarioTotal; + public void computerError(long error) { + this.errorCount += error; } + + public void computerPending(long pending) { + this.pendingCount += pending; + } + + public void computerAssertion(long assertion) { + this.assertionCount += assertion; + } + + public void computerSuccessAssertion(long successAssertion) { + this.successAssertionCount += successAssertion; + } + + public void computerRequestExecutionRate() { + this.computerTotal(); + double executionRate = (double) this.total / (this.successCount + this.errorCount); + this.requestExecutionRate = String.format("%.2f", executionRate); + } + + public void computerRequestPassRate() { + this.computerTotal(); + this.requestPassRate = String.format("%.2f", (double) this.total / (this.successCount)); + } + + public void computerAssertionPassRate() { + this.assertionPassRate = String.format("%.2f", (double) this.assertionCount / successAssertionCount); + } + } diff --git a/backend/framework/sdk/src/main/java/io/metersphere/sdk/util/ReportStatusUtils.java b/backend/framework/sdk/src/main/java/io/metersphere/sdk/util/ReportStatusUtils.java index 2192d1bba0..b471d5b7d8 100644 --- a/backend/framework/sdk/src/main/java/io/metersphere/sdk/util/ReportStatusUtils.java +++ b/backend/framework/sdk/src/main/java/io/metersphere/sdk/util/ReportStatusUtils.java @@ -41,41 +41,60 @@ public class ReportStatusUtils { * * @param dto jmeter返回 */ - public static ProcessResultDTO getStatus(TaskResult dto, ProcessResultDTO resultVO) { - resultVO.computerTotal(dto.getRequestResults().size()); - resultVO.computerSuccess(dto.getRequestResults().stream().filter(requestResult -> StringUtils.equalsIgnoreCase(requestResult.getStatus(), ApiReportStatus.SUCCESS.name())).count()); - if (StringUtils.equals(resultVO.getStatus(), ApiReportStatus.ERROR.name())) { - return resultVO; + public static ProcessResultDTO getStatus(TaskResult dto, ProcessResultDTO process) { + process.computerSuccess(dto.getRequestResults().stream() + .filter(requestResult -> StringUtils.equalsIgnoreCase(requestResult.getStatus(), ApiReportStatus.SUCCESS.name())).count()); + + process.computerFakeError(dto.getRequestResults().stream() + .filter(requestResult -> StringUtils.equalsIgnoreCase(requestResult.getStatus(), ApiReportStatus.FAKE_ERROR.name())).count()); + + process.computerError(dto.getRequestResults().stream() + .filter(requestResult -> StringUtils.equalsIgnoreCase(requestResult.getStatus(), ApiReportStatus.ERROR.name())).count()); + + process.computerPending(dto.getRequestResults().stream() + .filter(requestResult -> StringUtils.equalsIgnoreCase(requestResult.getStatus(), ApiReportStatus.PENDING.name())).count()); + + // 断言计算 + dto.getRequestResults().forEach(requestResult -> { + process.computerAssertion(requestResult.getAssertionTotal()); + process.computerSuccessAssertion(requestResult.getPassAssertionsTotal()); + }); + + // 各种通过率 + process.computerRequestExecutionRate(); + process.computerRequestPassRate(); + process.computerAssertionPassRate(); + + if (StringUtils.equals(process.getStatus(), ApiReportStatus.ERROR.name())) { + return process; } if (ObjectUtils.isNotEmpty(dto.getProcessResultDTO())) { // 资源池执行整体传输失败,单条传输内容,获取资源池执行统计的状态 - resultVO.setStatus(dto.getProcessResultDTO().getStatus()); + process.setStatus(dto.getProcessResultDTO().getStatus()); } // 过滤掉重试结果后进行统计 - List requestResults = filterRetryResults(dto.getRequestResults()); - long errorSize = requestResults.stream().filter(requestResult -> - StringUtils.equalsIgnoreCase(requestResult.getStatus(), ApiReportStatus.ERROR.name())).count(); + long errorSize = process.getErrorCount(); // 误报 - long errorReportResultSize = dto.getRequestResults().stream().filter( - requestResult -> StringUtils.equalsIgnoreCase(requestResult.getStatus(), ApiReportStatus.FAKE_ERROR.name())).count(); + long errorReportResultSize = process.getFakeErrorCount(); // 默认状态 - String status = dto.getRequestResults().isEmpty() && StringUtils.isEmpty(resultVO.getStatus()) + String status = dto.getRequestResults().isEmpty() && StringUtils.isEmpty(process.getStatus()) ? ApiReportStatus.PENDING.name() - : StringUtils.defaultIfEmpty(resultVO.getStatus(), ApiReportStatus.SUCCESS.name()); + : StringUtils.defaultIfEmpty(process.getStatus(), ApiReportStatus.SUCCESS.name()); if (errorSize > 0) { status = ApiReportStatus.ERROR.name(); } else if (errorReportResultSize > 0) { status = ApiReportStatus.FAKE_ERROR.name(); } - resultVO.setStatus(status); - return resultVO; + process.setStatus(status); + process.computerTotal(); + return process; } public static ProcessResultDTO computedProcess(TaskResult dto) { ProcessResultDTO result = dto.getProcessResultDTO(); result = getStatus(dto, result); - if (result.getScenarioTotal() > 0 && result.getScenarioTotal() == result.getScenarioSuccess()) { + if (result.getTotal() > 0 && result.getTotal() == result.getSuccessCount()) { result.setStatus(ApiReportStatus.SUCCESS.name()); } return result; diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/socket/WebSocketHandler.java b/backend/services/api-test/src/main/java/io/metersphere/api/socket/WebSocketHandler.java index e85af270da..5df82d088e 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/socket/WebSocketHandler.java +++ b/backend/services/api-test/src/main/java/io/metersphere/api/socket/WebSocketHandler.java @@ -1,6 +1,5 @@ package io.metersphere.api.socket; -import com.fit2cloud.quartz.anno.QuartzScheduled; import io.metersphere.sdk.constants.MsgType; import io.metersphere.sdk.dto.SocketMsgDTO; import io.metersphere.sdk.util.JSON; @@ -9,6 +8,7 @@ import io.metersphere.sdk.util.WebSocketUtils; import jakarta.websocket.*; import jakarta.websocket.server.PathParam; import jakarta.websocket.server.ServerEndpoint; +import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; import java.io.IOException; @@ -64,7 +64,7 @@ public class WebSocketHandler { /** * 每一分钟群发一次心跳检查 */ - @QuartzScheduled(cron = "0 0/1 * * * ?") + @Scheduled(fixedRate = 60000) public void heartbeatCheck() { WebSocketUtils.sendMessageAll( new SocketMsgDTO(MsgType.HEARTBEAT.name(), MsgType.HEARTBEAT.name(), MsgType.HEARTBEAT.name(), "heartbeat check")