feat(接口测试): 支持提取多个值

This commit is contained in:
chenjianxing 2020-10-20 16:48:37 +08:00
parent 73218f5f23
commit 510850db51
8 changed files with 24 additions and 3 deletions

View File

@ -10,4 +10,5 @@ public class ExtractCommon extends ExtractType {
private String value; // value: ${variable}
private String expression;
private String description;
private Boolean multipleMatching;
}

View File

@ -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);
}

View File

@ -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) + "}";
}
}

View File

@ -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>

View File

@ -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) {

View File

@ -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",

View File

@ -554,6 +554,7 @@ export default {
},
extract: {
label: "提取",
multiple_matching: "匹配多条",
select_type: "请选择类型",
description: "从响应结果中提取数据并将其存储在变量中,在后续请求中使用变量。",
regex: "正则",

View File

@ -554,6 +554,7 @@ export default {
},
extract: {
label: "提取",
multiple_matching: "匹配多條",
select_type: "請選擇類型",
description: "從響應結果中提取數據並將其存儲在變量中,在後續請求中使用變量。",
regex: "正則",