From 12b4aae62c5f378fac5863305d9bb55710871e0b Mon Sep 17 00:00:00 2001 From: q4speed Date: Tue, 26 May 2020 14:32:20 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90follow=5Fredirects=EF=BC=8C?= =?UTF-8?q?=E5=B1=95=E7=A4=BA=E5=AD=90=E8=AF=B7=E6=B1=82=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/jmeter/APIBackendListenerClient.java | 3 + .../metersphere/api/jmeter/RequestResult.java | 5 ++ .../api/report/components/RequestResult.vue | 55 +++++++++++++++---- frontend/src/i18n/en-US.js | 4 +- frontend/src/i18n/zh-CN.js | 4 +- frontend/src/i18n/zh-TW.js | 4 +- 6 files changed, 60 insertions(+), 15 deletions(-) diff --git a/backend/src/main/java/io/metersphere/api/jmeter/APIBackendListenerClient.java b/backend/src/main/java/io/metersphere/api/jmeter/APIBackendListenerClient.java index 708b718643..ee3867c40c 100644 --- a/backend/src/main/java/io/metersphere/api/jmeter/APIBackendListenerClient.java +++ b/backend/src/main/java/io/metersphere/api/jmeter/APIBackendListenerClient.java @@ -121,6 +121,9 @@ public class APIBackendListenerClient extends AbstractBackendListenerClient impl requestResult.setTotalAssertions(result.getAssertionResults().length); requestResult.setSuccess(result.isSuccessful()); requestResult.setError(result.getErrorCount()); + for (SampleResult subResult : result.getSubResults()) { + requestResult.getSubRequestResults().add(getRequestResult(subResult)); + } ResponseResult responseResult = requestResult.getResponseResult(); responseResult.setBody(new String(result.getResponseData(), StandardCharsets.UTF_8)); diff --git a/backend/src/main/java/io/metersphere/api/jmeter/RequestResult.java b/backend/src/main/java/io/metersphere/api/jmeter/RequestResult.java index fb13966895..ed756d9f0a 100644 --- a/backend/src/main/java/io/metersphere/api/jmeter/RequestResult.java +++ b/backend/src/main/java/io/metersphere/api/jmeter/RequestResult.java @@ -2,6 +2,9 @@ package io.metersphere.api.jmeter; import lombok.Data; +import java.util.ArrayList; +import java.util.List; + @Data public class RequestResult { @@ -27,6 +30,8 @@ public class RequestResult { private int passAssertions = 0; + private final List subRequestResults = new ArrayList<>(); + private final ResponseResult responseResult = new ResponseResult(); public void addPassAssertions() { diff --git a/frontend/src/business/components/api/report/components/RequestResult.vue b/frontend/src/business/components/api/report/components/RequestResult.vue index 1837e9e065..976b1334ca 100644 --- a/frontend/src/business/components/api/report/components/RequestResult.vue +++ b/frontend/src/business/components/api/report/components/RequestResult.vue @@ -9,7 +9,9 @@
{{request.name}}
-
{{request.url}}
+ +
{{request.url}}
+
@@ -34,10 +36,24 @@
- - -
- + + + + + + + +
+ +
+
+
+ + +
+ +
@@ -59,9 +75,7 @@ data() { return { isActive: false, - activeName: "request", - activeName2: "body", - activeName3: "body", + activeName: "sub", } }, @@ -75,6 +89,9 @@ assertion() { return this.request.passAssertions + " / " + this.request.totalAssertions; }, + hasSub() { + return this.request.subRequestResults.length > 0; + } } } @@ -93,7 +110,6 @@ } .request-result .method { - /*border-left: 5px solid #1E90FF;*/ color: #1E90FF; font-size: 14px; font-weight: 500; @@ -106,9 +122,10 @@ font-size: 12px; font-weight: 400; margin-top: 4px; - overflow: auto; - white-space: normal; - word-wrap: break-word; + white-space: nowrap; + text-overflow: ellipsis; + overflow: hidden; + word-break: break-all; } .request-result .tab .el-tabs__header { @@ -119,4 +136,18 @@ height: 300px; overflow-y: auto; } + + .sub-result .info { + background-color: #FFF; + } + + .sub-result .method { + border-left: 5px solid #1E90FF; + padding-left: 20px; + } + + .sub-result:last-child { + border-bottom: 1px solid #EBEEF5; + } + diff --git a/frontend/src/i18n/en-US.js b/frontend/src/i18n/en-US.js index 452983ad7a..9d927dc0ae 100644 --- a/frontend/src/i18n/en-US.js +++ b/frontend/src/i18n/en-US.js @@ -338,7 +338,9 @@ export default { success: "Success", fail: "Fail", total: "Total", - test_name: "Test" + test_name: "Test", + request_result: "Result", + sub_result: "Sub Result" }, test_track: { test_track: "Track", diff --git a/frontend/src/i18n/zh-CN.js b/frontend/src/i18n/zh-CN.js index 981619b165..bbf0df7919 100644 --- a/frontend/src/i18n/zh-CN.js +++ b/frontend/src/i18n/zh-CN.js @@ -335,7 +335,9 @@ export default { success: "成功", fail: "失败", total: "全部", - test_name: "所属测试" + test_name: "所属测试", + request_result: "请求结果", + sub_result: "子请求" }, test_track: { test_track: "测试跟踪", diff --git a/frontend/src/i18n/zh-TW.js b/frontend/src/i18n/zh-TW.js index 39863ce760..4337cbb2be 100644 --- a/frontend/src/i18n/zh-TW.js +++ b/frontend/src/i18n/zh-TW.js @@ -326,7 +326,9 @@ export default { success: "成功", fail: "失敗", total: "全部", - test_name: "所屬測試" + test_name: "所屬測試", + request_result: "請求結果", + sub_result: "子請求" }, test_track: { test_track: "測試跟踪",