diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/request/assertions/MsAssertions.java b/backend/src/main/java/io/metersphere/api/dto/definition/request/assertions/MsAssertions.java index a0dc1077a9..1666392869 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/request/assertions/MsAssertions.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/request/assertions/MsAssertions.java @@ -138,11 +138,7 @@ public class MsAssertions extends MsTestElement { assertion.setExpectNull(false); assertion.setInvert(false); assertion.setProperty("ASS_OPTION", assertionJsonPath.getOption()); - if (StringUtils.isEmpty(assertionJsonPath.getOption()) || "REGEX".equals(assertionJsonPath.getOption())) { - assertion.setIsRegex(true); - } else { - assertion.setIsRegex(false); - } + assertion.setIsRegex(StringUtils.isEmpty(assertionJsonPath.getOption()) || "REGEX".equals(assertionJsonPath.getOption())); return assertion; } @@ -178,9 +174,9 @@ public class MsAssertions extends MsTestElement { JSR223Assertion assertion = new JSR223Assertion(); assertion.setEnabled(this.isEnable()); if (StringUtils.isNotEmpty(assertionJSR223.getDesc())) { - assertion.setName(this.getName() + "==" + assertionJSR223.getDesc()); + assertion.setName("JSR223" + "==" + this.getName() + "==" + assertionJSR223.getDesc() + "==" + assertionJSR223.getScript()); } else { - assertion.setName(this.getName() + "==" + "JSR223Assertion"); + assertion.setName("JSR223" + "==" + this.getName() + "==" + "JSR223Assertion" + "==" + assertionJSR223.getScript()); } assertion.setProperty(TestElement.TEST_CLASS, JSR223Assertion.class.getName()); assertion.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("TestBeanGUI")); diff --git a/backend/src/main/java/io/metersphere/api/jmeter/ResponseAssertionResult.java b/backend/src/main/java/io/metersphere/api/jmeter/ResponseAssertionResult.java index 59e5a94c0c..357f5be7ef 100644 --- a/backend/src/main/java/io/metersphere/api/jmeter/ResponseAssertionResult.java +++ b/backend/src/main/java/io/metersphere/api/jmeter/ResponseAssertionResult.java @@ -9,6 +9,8 @@ public class ResponseAssertionResult { private String content; + private String script; + private String message; private boolean pass; diff --git a/backend/src/main/java/io/metersphere/api/service/MsResultService.java b/backend/src/main/java/io/metersphere/api/service/MsResultService.java index fd544aa0a9..84c749f5db 100644 --- a/backend/src/main/java/io/metersphere/api/service/MsResultService.java +++ b/backend/src/main/java/io/metersphere/api/service/MsResultService.java @@ -22,8 +22,8 @@ import java.util.stream.Collectors; @Transactional(rollbackFor = Exception.class) public class MsResultService { // 零时存放实时结果 - private Cache cache = Cache.newHardMemoryCache(0, 3600 * 2); - private ConcurrentHashMap> processCache = new ConcurrentHashMap<>(); + private final Cache cache = Cache.newHardMemoryCache(0, 3600 * 2); + private final ConcurrentHashMap> processCache = new ConcurrentHashMap<>(); public ConcurrentHashMap> getProcessCache() { return processCache; @@ -252,13 +252,21 @@ public class MsResultService { ResponseAssertionResult responseAssertionResult = new ResponseAssertionResult(); responseAssertionResult.setName(assertionResult.getName()); if (StringUtils.isNotEmpty(assertionResult.getName()) && assertionResult.getName().indexOf("==") != -1) { - String array[] = assertionResult.getName().split("=="); - responseAssertionResult.setName(array[0]); - StringBuffer content = new StringBuffer(); - for (int i = 1; i < array.length; i++) { - content.append(array[i]); + String[] array = assertionResult.getName().split("=="); + if ("JSR223".equals(array[0])) { + responseAssertionResult.setName(array[1]); + responseAssertionResult.setContent(array[2]); + if (array.length > 3) { + responseAssertionResult.setScript(array[3]); + } + } else { + responseAssertionResult.setName(array[0]); + StringBuffer content = new StringBuffer(); + for (int i = 1; i < array.length; i++) { + content.append(array[i]); + } + responseAssertionResult.setContent(content.toString()); } - responseAssertionResult.setContent(content.toString()); } responseAssertionResult.setPass(!assertionResult.isFailure() && !assertionResult.isError()); if (!responseAssertionResult.isPass()) { diff --git a/frontend/src/business/components/api/automation/report/ApiReportExport.vue b/frontend/src/business/components/api/automation/report/ApiReportExport.vue index c854464856..39d7255f13 100644 --- a/frontend/src/business/components/api/automation/report/ApiReportExport.vue +++ b/frontend/src/business/components/api/automation/report/ApiReportExport.vue @@ -61,12 +61,6 @@ - -
-
- -
-
diff --git a/frontend/src/business/components/api/automation/report/components/AssertionResults.vue b/frontend/src/business/components/api/automation/report/components/AssertionResults.vue index 9db6707512..2f2a0a419d 100644 --- a/frontend/src/business/components/api/automation/report/components/AssertionResults.vue +++ b/frontend/src/business/components/api/automation/report/components/AssertionResults.vue @@ -17,25 +17,79 @@ + + + + + + + + + + +