refactor(接口测试): 去除JMeter不兼容的Mock函数
Signed-off-by: fit2-zhao <yong.zhao@fit2cloud.com>
This commit is contained in:
parent
b120cba79d
commit
c16111db5f
|
@ -75,6 +75,9 @@ public class MsScenario extends MsTestElement {
|
|||
&& !this.setRefScenario(hashTree, config)) {
|
||||
return;
|
||||
}
|
||||
if (!ElementUtil.isEnable(this, config)) {
|
||||
return;
|
||||
}
|
||||
// 设置共享cookie
|
||||
config.setEnableCookieShare(enableCookieShare);
|
||||
Map<String, EnvironmentConfig> envConfig = new HashMap<>(16);
|
||||
|
|
|
@ -103,14 +103,14 @@ public class MsHashTreeService {
|
|||
private static final String PARENT_INDEX = "parentIndex";
|
||||
|
||||
|
||||
private final static String JSON_PATH="jsonPath";
|
||||
private final static String JSR223="jsr223";
|
||||
private final static String XPATH="xpath2";
|
||||
private final static String REGEX="regex";
|
||||
private final static String DURATION="duration";
|
||||
private final static String DOCUMENT="document";
|
||||
private final static String LABEL="label";
|
||||
private final static String SCENARIO_REF="SCENARIO-REF-STEP";
|
||||
private final static String JSON_PATH = "jsonPath";
|
||||
private final static String JSR223 = "jsr223";
|
||||
private final static String XPATH = "xpath2";
|
||||
private final static String REGEX = "regex";
|
||||
private final static String DURATION = "duration";
|
||||
private final static String DOCUMENT = "document";
|
||||
private final static String LABEL = "label";
|
||||
private final static String SCENARIO_REF = "SCENARIO-REF-STEP";
|
||||
|
||||
public void setHashTree(JSONArray hashTree) {
|
||||
// 将引用转成复制
|
||||
|
@ -368,6 +368,16 @@ public class MsHashTreeService {
|
|||
if (StringUtils.equalsIgnoreCase(element.optString(REFERENCED), REF)) {
|
||||
element.put(ENABLE, false);
|
||||
}
|
||||
if (element.has(ENABLE) && BooleanUtils.isFalse(element.optBoolean(ENABLE))) {
|
||||
element.put(REF_ENABLE, true);
|
||||
} else {
|
||||
String indexStr = element.has(PARENT_INDEX) && StringUtils.isNotBlank(element.optString(PARENT_INDEX)) ?
|
||||
StringUtils.join(element.optString(PARENT_INDEX), "_", element.optString(INDEX)) : element.optString(INDEX);
|
||||
if (keyMap.containsKey(element.optString(ID) + indexStr)) {
|
||||
enable = keyMap.get(element.optString(ID) + indexStr);
|
||||
element.put(ENABLE, enable);
|
||||
}
|
||||
}
|
||||
element.put(NUM, StringUtils.EMPTY);
|
||||
}
|
||||
return element;
|
||||
|
@ -435,10 +445,8 @@ public class MsHashTreeService {
|
|||
}
|
||||
|
||||
private void setCaseEnable(JSONObject element, Map<String, Boolean> keyMap, String parentIndex) {
|
||||
if (element.has(ENABLE) && BooleanUtils.isFalse(element.optBoolean(ENABLE))
|
||||
&& StringUtils.equals(element.optString(REFERENCED),REF)) {
|
||||
if (element.has(ENABLE) && BooleanUtils.isFalse(element.optBoolean(ENABLE))) {
|
||||
element.put(ENABLE, false);
|
||||
element.put(REF_ENABLE, true);
|
||||
} else {
|
||||
String indexStr = StringUtils.join(element.optString(ID), parentIndex, "_", element.optString(INDEX));
|
||||
if (keyMap.containsKey(indexStr)) {
|
||||
|
|
|
@ -109,7 +109,6 @@ export const MOCKJS_FUNC = [
|
|||
{name: '@datetime', des: i18n.t('api_test.request.datetime'), ex: "1975-10-12 02:32:04"},
|
||||
{name: '@now', des: i18n.t('api_test.request.now'), ex: (new Date()).toLocaleTimeString().toLocaleString()},
|
||||
{name: '@img', des: i18n.t('api_test.request.img'), ex: "http://dummyimage.com/120x60"},
|
||||
{name: '@dataImage', des: i18n.t('api_test.request.dataImage'), ex: "data:image/png;base64,iVBORw0KG=="},
|
||||
{name: '@color', des: i18n.t('api_test.request.color'), ex: "#b479f2"},
|
||||
{name: '@hex', des: i18n.t('api_test.request.hex'), ex: "#f27984"},
|
||||
{name: '@rgb', des: i18n.t('api_test.request.rgb'), ex: "rgb(203, 242, 121)"},
|
||||
|
|
Loading…
Reference in New Issue