fix(接口测试): 修复断言相关bug
This commit is contained in:
parent
c4bcc25c5a
commit
a20b54d570
|
@ -62,7 +62,7 @@ public class VariableAssertionConverter extends AssertionConverter<MsVariableAss
|
|||
}
|
||||
|
||||
public boolean isValid(MsVariableAssertion.VariableAssertionItem variableAssertionItem) {
|
||||
return StringUtils.isNotBlank(variableAssertionItem.getVariableName()) && StringUtils.isNotBlank(variableAssertionItem.getExpectedValue())
|
||||
return StringUtils.isNotBlank(variableAssertionItem.getVariableName())
|
||||
&& StringUtils.isNotBlank(variableAssertionItem.getCondition());
|
||||
}
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@ public class JSONPathAssertionConverter extends ResponseBodyTypeAssertionConvert
|
|||
String expression = msAssertion.getExpression();
|
||||
String expectedValue = msAssertion.getExpectedValue();
|
||||
assertion.setName(String.format("Response data JSONPath expect %s %s %s", expression, condition.toLowerCase().replace("_", ""), expectedValue));
|
||||
assertion.setEnabled(msAssertion.getEnable());
|
||||
if (BooleanUtils.isFalse(globalEnable)) {
|
||||
// 如果整体禁用,则禁用
|
||||
assertion.setEnabled(false);
|
||||
|
|
|
@ -35,6 +35,7 @@ public class RegexAssertionConverter extends ResponseBodyTypeAssertionConverter<
|
|||
assertion.setName("Response data expect regex " + msAssertion.getExpression());
|
||||
assertion.addTestString(msAssertion.getExpression());
|
||||
assertion.setTestFieldResponseData();
|
||||
assertion.setEnabled(msAssertion.getEnable());
|
||||
if (BooleanUtils.isFalse(globalEnable)) {
|
||||
// 如果整体禁用,则禁用
|
||||
assertion.setEnabled(false);
|
||||
|
|
|
@ -51,6 +51,7 @@ public class XPathAssertionConverter extends ResponseBodyTypeAssertionConverter<
|
|||
assertion.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass(XPATH_ASSERTION_GUI));
|
||||
assertion.setXPathString(msAssertion.getExpression());
|
||||
assertion.setNegated(false);
|
||||
assertion.setEnabled(msAssertion.getEnable());
|
||||
if (BooleanUtils.isFalse(globalEnable)) {
|
||||
// 如果整体禁用,则禁用
|
||||
assertion.setEnabled(false);
|
||||
|
@ -66,6 +67,7 @@ public class XPathAssertionConverter extends ResponseBodyTypeAssertionConverter<
|
|||
assertion.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass(X_PATH_2_ASSERTION_GUI));
|
||||
assertion.setXPathString(msAssertion.getExpression());
|
||||
assertion.setNegated(false);
|
||||
assertion.setEnabled(msAssertion.getEnable());
|
||||
if (BooleanUtils.isFalse(globalEnable)) {
|
||||
// 如果整体禁用,则禁用
|
||||
assertion.setEnabled(false);
|
||||
|
|
|
@ -30,7 +30,7 @@ public class MsJSONPathAssertionItem extends MsBodyAssertionItem {
|
|||
private String expectedValue;
|
||||
|
||||
public boolean isValid() {
|
||||
return StringUtils.isNotBlank(expression) && StringUtils.isNotBlank(condition) && StringUtils.isNotBlank(expectedValue);
|
||||
return StringUtils.isNotBlank(expression) && StringUtils.isNotBlank(condition);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
ref="extractParamsTableRef"
|
||||
v-model:params="condition.jsonPathAssertion.assertions"
|
||||
:disabled-except-param="props.disabled"
|
||||
:selectable="false"
|
||||
:selectable="true"
|
||||
:columns="jsonPathColumns"
|
||||
:scroll="{ minWidth: '700px' }"
|
||||
:default-param-item="jsonPathDefaultParamItem"
|
||||
|
@ -107,7 +107,7 @@
|
|||
ref="extractParamsTableRef"
|
||||
v-model:params="condition.xpathAssertion.assertions"
|
||||
:disabled-except-param="props.disabled"
|
||||
:selectable="false"
|
||||
:selectable="true"
|
||||
:columns="xPathColumns"
|
||||
:scroll="{ minWidth: '700px' }"
|
||||
:default-param-item="xPathDefaultParamItem"
|
||||
|
@ -254,7 +254,7 @@
|
|||
<paramsTable
|
||||
ref="extractParamsTableRef"
|
||||
v-model:params="condition.regexAssertion.assertions"
|
||||
:selectable="false"
|
||||
:selectable="true"
|
||||
:disabled-except-param="props.disabled"
|
||||
:columns="xPathColumns"
|
||||
:scroll="{ minWidth: '700px' }"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<template>
|
||||
<paramsTable
|
||||
v-model:params="condition.variableAssertionItems"
|
||||
:selectable="false"
|
||||
:selectable="true"
|
||||
:columns="columns"
|
||||
:scroll="{ minWidth: '700px' }"
|
||||
:default-param-item="defaultParamItem"
|
||||
|
|
|
@ -784,7 +784,7 @@
|
|||
(paramsData.value[rowIndex].key ||
|
||||
paramsData.value[rowIndex].projectId ||
|
||||
paramsData.value[rowIndex].header ||
|
||||
paramsData.value[rowIndex].header ||
|
||||
paramsData.value[rowIndex].variableName ||
|
||||
paramsData.value[rowIndex].expression)
|
||||
) {
|
||||
// 最后一行的更改才会触发添加新一行
|
||||
|
|
Loading…
Reference in New Issue