feat(接口测试): 支持提取多个值
This commit is contained in:
parent
73218f5f23
commit
510850db51
|
@ -10,4 +10,5 @@ public class ExtractCommon extends ExtractType {
|
|||
private String value; // value: ${variable}
|
||||
private String expression;
|
||||
private String description;
|
||||
private Boolean multipleMatching;
|
||||
}
|
||||
|
|
|
@ -11,5 +11,5 @@ public interface ExtTestReviewCaseMapper {
|
|||
|
||||
List<TestReviewCaseDTO> list(@Param("request") QueryCaseReviewRequest request);
|
||||
List<String> getStatusByReviewId(String reviewId);
|
||||
List<String> findRelateTestReviewId(String userId, String workspaceId);
|
||||
List<String> findRelateTestReviewId(@Param("userId") String userId, @Param("workspaceId") String workspaceId);
|
||||
}
|
||||
|
|
|
@ -29,6 +29,10 @@
|
|||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
showCopyTipWithMultiple: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
},
|
||||
|
||||
data() {
|
||||
|
@ -63,7 +67,7 @@
|
|||
|
||||
computed: {
|
||||
variable() {
|
||||
return "${" + this.value + "}";
|
||||
return "${" + (this.showCopyTipWithMultiple ? (this.value + "_n") : this.value) + "}";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -8,12 +8,17 @@
|
|||
</el-col>
|
||||
<el-col>
|
||||
<ms-api-variable-input :is-read-only="isReadOnly" v-model="common.variable" size="small" maxlength="60"
|
||||
@change="change" show-word-limit :placeholder="$t('api_test.variable_name')"/>
|
||||
@change="change" :show-copy-tip-with-multiple="common.multipleMatching" show-word-limit :placeholder="$t('api_test.variable_name')"/>
|
||||
</el-col>
|
||||
<el-col>
|
||||
<el-input :disabled="isReadOnly" v-model="common.expression" size="small" show-word-limit
|
||||
:placeholder="expression"/>
|
||||
</el-col>
|
||||
<el-col class="multiple_checkbox">
|
||||
<el-checkbox v-model="common.multipleMatching" :disabled="isReadOnly">
|
||||
{{ $t('api_test.request.extract.multiple_matching') }}
|
||||
</el-checkbox>
|
||||
</el-col>
|
||||
<el-col class="extract-btn">
|
||||
<el-button :disabled="isReadOnly" type="danger" size="mini" icon="el-icon-delete" circle @click="remove"
|
||||
v-if="edit"/>
|
||||
|
@ -159,4 +164,10 @@
|
|||
.extract-btn {
|
||||
width: 60px;
|
||||
}
|
||||
|
||||
.multiple_checkbox {
|
||||
text-align: center;
|
||||
width: 120px;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
|
|
@ -855,6 +855,7 @@ export class ExtractCommon extends ExtractType {
|
|||
this.value = ""; // ${variable}
|
||||
this.expression = undefined;
|
||||
this.description = undefined;
|
||||
this.multipleMatching = undefined;
|
||||
|
||||
this.set(options);
|
||||
}
|
||||
|
@ -1460,6 +1461,7 @@ class JMXGenerator {
|
|||
let props = {
|
||||
name: extractCommon.variable,
|
||||
expression: extractCommon.expression,
|
||||
match: extractCommon.multipleMatching ? -1 : undefined
|
||||
}
|
||||
let testName = props.name
|
||||
switch (extractCommon.type) {
|
||||
|
|
|
@ -554,6 +554,7 @@ export default {
|
|||
select_type: "Choose type",
|
||||
description: "Extract data from the response and store it in variables. Use the variables in subsequent requests.",
|
||||
regex: "Regex",
|
||||
multiple_matching: "Multiple matching",
|
||||
regex_expression: "Regular expression",
|
||||
json_path_expression: "JSONPath expression",
|
||||
xpath_expression: "XPath expression",
|
||||
|
|
|
@ -554,6 +554,7 @@ export default {
|
|||
},
|
||||
extract: {
|
||||
label: "提取",
|
||||
multiple_matching: "匹配多条",
|
||||
select_type: "请选择类型",
|
||||
description: "从响应结果中提取数据并将其存储在变量中,在后续请求中使用变量。",
|
||||
regex: "正则",
|
||||
|
|
|
@ -554,6 +554,7 @@ export default {
|
|||
},
|
||||
extract: {
|
||||
label: "提取",
|
||||
multiple_matching: "匹配多條",
|
||||
select_type: "請選擇類型",
|
||||
description: "從響應結果中提取數據並將其存儲在變量中,在後續請求中使用變量。",
|
||||
regex: "正則",
|
||||
|
|
Loading…
Reference in New Issue