fix(场景自动化): 修复JSONSchema Number 类型小数点后内容丢失问题;修复循环结果不展示问题。
This commit is contained in:
parent
b2a59c361d
commit
2c3392bae4
|
@ -143,7 +143,7 @@ public class JSONSchemaGenerator {
|
|||
// TODO 6.3.3 in json-schema-validation
|
||||
}
|
||||
|
||||
} else if (propertyObjType.equals("integer") || propertyObjType.equals("number")) {
|
||||
} else if (propertyObjType.equals("integer")) {
|
||||
// 先设置空值
|
||||
concept.put(propertyName, 0);
|
||||
if (object.has("default")) {
|
||||
|
@ -183,6 +183,25 @@ public class JSONSchemaGenerator {
|
|||
}
|
||||
// Section 6.2.5 in json-schema-validation. Resolved as OCL
|
||||
|
||||
} else if (propertyObjType.equals("number")) {
|
||||
// 先设置空值
|
||||
concept.put(propertyName, 0);
|
||||
if (object.has("default")) {
|
||||
concept.put(propertyName, object.get("default"));
|
||||
}
|
||||
if (object.has("mock") && object.get("mock").getAsJsonObject() != null && StringUtils.isNotEmpty(object.get("mock").getAsJsonObject().get("mock").getAsString())) {
|
||||
try {
|
||||
Number value = object.get("mock").getAsJsonObject().get("mock").getAsNumber();
|
||||
if (value.toString().indexOf(".") == -1) {
|
||||
concept.put(propertyName, value.intValue());
|
||||
} else {
|
||||
concept.put(propertyName, value.floatValue());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
String value = ScriptEngineUtils.calculate(object.get("mock").getAsJsonObject().get("mock").getAsString());
|
||||
concept.put(propertyName, value);
|
||||
}
|
||||
}
|
||||
} else if (propertyObjType.equals("boolean")) {
|
||||
// 先设置空值
|
||||
concept.put(propertyName, false);
|
||||
|
|
|
@ -58,7 +58,7 @@
|
|||
<el-tabs v-model="request.activeName" closable class="ms-tabs">
|
||||
<el-tab-pane :label="item.name" :name="item.name" v-for="(item,index) in request.result.scenarios" :key="index">
|
||||
<div v-for="(result,i) in item.requestResults" :key="i" style="margin-bottom: 5px">
|
||||
<api-response-component v-if="result.name===request.name" :result="result"/>
|
||||
<api-response-component v-if="result.id===request.id" :result="result"/>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
|
@ -168,7 +168,7 @@
|
|||
watch: {
|
||||
envMap() {
|
||||
this.getEnvironments();
|
||||
}
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
displayColor() {
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
<template v-slot:message>
|
||||
<span v-if="requestResult && requestResult.scenarios && requestResult.scenarios.length > 0 " style="color: #8c939d;margin-right: 10px">
|
||||
{{$t('api_test.automation.loop_name')}}{{requestResult.scenarios.length}}次 成功{{success}}次 失败{{error}}次
|
||||
<!--{{$t('api_test.automation.loop_name')}}{{requestResult.scenarios.length}}次 成功{{success}}次 失败{{error}}次-->
|
||||
</span>
|
||||
</template>
|
||||
|
||||
|
@ -280,6 +280,7 @@
|
|||
if (item.type === "HTTPSamplerProxy" || item.type === "DubboSampler" || item.type === "JDBCSampler" || item.type === "TCPSampler") {
|
||||
item.result = this.requestResult;
|
||||
item.activeName = this.activeName;
|
||||
item.active = true;
|
||||
item.requestResult = undefined;
|
||||
}
|
||||
if (item.hashTree && item.hashTree.length > 0) {
|
||||
|
@ -318,11 +319,12 @@
|
|||
this.activeName = this.requestResult && this.requestResult.scenarios && this.requestResult.scenarios !== null && this.requestResult.scenarios.length > 0 ? this.requestResult.scenarios[0].name : "";
|
||||
// 把请求结果分给各个请求
|
||||
this.setResult(this.controller.hashTree);
|
||||
this.$emit("refReload");
|
||||
this.$emit("refReload",this.node);
|
||||
} catch (e) {
|
||||
throw e;
|
||||
}
|
||||
this.loading = false;
|
||||
this.node.expanded = true;
|
||||
this.reload();
|
||||
} else {
|
||||
setTimeout(this.getReport, 2000);
|
||||
|
|
Loading…
Reference in New Issue