diff --git a/backend/src/main/java/io/metersphere/api/dto/scenario/assertions/AssertionJsonPath.java b/backend/src/main/java/io/metersphere/api/dto/scenario/assertions/AssertionJsonPath.java new file mode 100644 index 0000000000..c17a893559 --- /dev/null +++ b/backend/src/main/java/io/metersphere/api/dto/scenario/assertions/AssertionJsonPath.java @@ -0,0 +1,16 @@ +package io.metersphere.api.dto.scenario.assertions; + +import lombok.Data; +import lombok.EqualsAndHashCode; + +@EqualsAndHashCode(callSuper = true) +@Data +public class AssertionJsonPath extends AssertionType { + private String expect; + private String expression; + private String description; + + public AssertionJsonPath() { + setType(AssertionType.JSON_PATH); + } +} diff --git a/backend/src/main/java/io/metersphere/api/dto/scenario/assertions/AssertionType.java b/backend/src/main/java/io/metersphere/api/dto/scenario/assertions/AssertionType.java index 5ae8414478..443ea969a9 100644 --- a/backend/src/main/java/io/metersphere/api/dto/scenario/assertions/AssertionType.java +++ b/backend/src/main/java/io/metersphere/api/dto/scenario/assertions/AssertionType.java @@ -6,6 +6,7 @@ import lombok.Data; public class AssertionType { public final static String REGEX = "Regex"; public final static String DURATION = "Duration"; + public final static String JSON_PATH = "JSONPath"; public final static String TEXT = "Text"; private String type; diff --git a/backend/src/main/java/io/metersphere/api/dto/scenario/assertions/Assertions.java b/backend/src/main/java/io/metersphere/api/dto/scenario/assertions/Assertions.java index 678fcdc0ce..d910c0af13 100644 --- a/backend/src/main/java/io/metersphere/api/dto/scenario/assertions/Assertions.java +++ b/backend/src/main/java/io/metersphere/api/dto/scenario/assertions/Assertions.java @@ -7,5 +7,6 @@ import java.util.List; @Data public class Assertions { private List regex; + private List jsonPath; private AssertionDuration duration; } diff --git a/backend/src/main/java/io/metersphere/api/jmeter/JMeterService.java b/backend/src/main/java/io/metersphere/api/jmeter/JMeterService.java index 74f4e898d4..e0f731b47b 100644 --- a/backend/src/main/java/io/metersphere/api/jmeter/JMeterService.java +++ b/backend/src/main/java/io/metersphere/api/jmeter/JMeterService.java @@ -1,6 +1,7 @@ package io.metersphere.api.jmeter; import io.metersphere.commons.exception.MSException; +import io.metersphere.commons.utils.LogUtil; import io.metersphere.config.JmeterProperties; import io.metersphere.i18n.Translator; import org.apache.jmeter.config.Arguments; @@ -33,6 +34,7 @@ public class JMeterService { LocalRunner runner = new LocalRunner(testPlan); runner.run(); } catch (Exception e) { + LogUtil.error(e.getMessage(), e); MSException.throwException(Translator.get("api_load_script_error")); } } diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.xml index a11bc1ebd6..4c3193bbe8 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.xml @@ -225,6 +225,7 @@ + order by update_time desc