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 bf56db71b5..75d1d67cb9 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 @@ -174,9 +174,9 @@ public class MsAssertions extends MsTestElement { JSR223Assertion assertion = new JSR223Assertion(); assertion.setEnabled(this.isEnable()); if (StringUtils.isNotEmpty(assertionJSR223.getDesc())) { - assertion.setName("JSR223" + "==" + this.getName() + "==" + assertionJSR223.getDesc() + "==" + assertionJSR223.getScript()); + assertion.setName("JSR223" + "==" + this.getName() + "==" + assertionJSR223.getDesc() + "&&" + assertionJSR223.getScript()); } else { - assertion.setName("JSR223" + "==" + this.getName() + "==" + "JSR223Assertion" + "==" + assertionJSR223.getScript()); + 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/service/MsResultService.java b/backend/src/main/java/io/metersphere/api/service/MsResultService.java index 84c749f5db..9b6fa71db2 100644 --- a/backend/src/main/java/io/metersphere/api/service/MsResultService.java +++ b/backend/src/main/java/io/metersphere/api/service/MsResultService.java @@ -252,14 +252,22 @@ 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("=="); - if ("JSR223".equals(array[0])) { - responseAssertionResult.setName(array[1]); - responseAssertionResult.setContent(array[2]); - if (array.length > 3) { - responseAssertionResult.setScript(array[3]); + if (assertionResult.getName().indexOf("JSR223") != -1) { + String[] array = assertionResult.getName().split("==", 3); + if ("JSR223".equals(array[0])) { + responseAssertionResult.setName(array[1]); + if (array[2].indexOf("&&") != -1) { + String[] content = array[2].split("&&"); + responseAssertionResult.setContent(content[0]); + if (content.length > 1) { + responseAssertionResult.setScript(content[1]); + } + } else { + responseAssertionResult.setContent(array[2]); + } } } else { + String[] array = assertionResult.getName().split("=="); responseAssertionResult.setName(array[0]); StringBuffer content = new StringBuffer(); for (int i = 1; i < array.length; i++) { diff --git a/frontend/src/business/components/api/definition/components/response/AssertionResults.vue b/frontend/src/business/components/api/definition/components/response/AssertionResults.vue index 63c1ddfab4..c7b0ad9b24 100644 --- a/frontend/src/business/components/api/definition/components/response/AssertionResults.vue +++ b/frontend/src/business/components/api/definition/components/response/AssertionResults.vue @@ -13,25 +13,78 @@ + + + + + + + + + +