feat(测试用例、Mock测试): 修复测试用例导入和删除的缺陷、Mock测试的缺陷

--bug=1005212 --user=宋天阳 【回收站】-删除用例统计信息不正常
https://www.tapd.cn/55049933/s/1026637;--bug=1005228 --user=宋天阳
【mock】不满足mock期望,仍返回200
https://www.tapd.cn/55049933/s/1026636;--bug=1005266 --user=宋天阳
【测试用例】导入excel用例,名称显示... https://www.tapd.cn/55049933/s/1026633
This commit is contained in:
song-tianyang 2021-07-20 22:45:36 +08:00 committed by 刘瑞斌
parent b4a5a008b6
commit 09e9b5b79d
2 changed files with 112 additions and 96 deletions

View File

@ -17,6 +17,7 @@ import io.metersphere.commons.utils.JsonPathUtils;
import io.metersphere.jmeter.utils.ScriptEngineUtils;
import io.metersphere.commons.utils.SessionUtils;
import io.metersphere.i18n.Translator;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.json.XML;
import org.springframework.stereotype.Service;
@ -392,7 +393,11 @@ public class MockConfigService {
public String updateHttpServletResponse(List<ApiDefinitionWithBLOBs> apis, HttpServletResponse response) {
String returnStr = "";
try {
if(CollectionUtils.isEmpty(apis)){
response.setStatus(404);
}else {
for (ApiDefinitionWithBLOBs api : apis) {
int status = 404;
if (api.getResponse() != null) {
JSONObject respObj = JSONObject.parseObject(api.getResponse());
if (respObj.containsKey("headers")) {
@ -411,8 +416,7 @@ public class MockConfigService {
if (obj.containsKey("name") && obj.containsKey("value") && StringUtils.isNotEmpty(obj.getString("name"))) {
// response.setHeader(obj.getString("name"), obj.getString("value"));
try {
int headInt = Integer.parseInt(obj.getString("name"));
response.setStatus(headInt);
status = Integer.parseInt(obj.getString("name"));
} catch (Exception e) {
}
}
@ -505,7 +509,13 @@ public class MockConfigService {
}
}
}
if(StringUtils.isNotEmpty(returnStr) && status == 404){
status = 200;
}
response.setStatus(status);
}
}
} catch (Exception e) {
e.printStackTrace();
}

View File

@ -502,10 +502,13 @@ export default {
// param.planId = this.planId;
this.condition.planId = this.planId;
}
if(!this.trashEnable){
if (this.selectNodeIds && this.selectNodeIds.length > 0) {
// param.nodeIds = this.selectNodeIds;
this.condition.nodeIds = this.selectNodeIds;
}
}
this.getData();
},
getData() {
@ -546,6 +549,9 @@ export default {
this.page.data = data.listObject;
if (this.$refs.table) {
this.$refs.table.clear();
this.$nextTick(() => {
this.$refs.table.doLayout();
});
}
this.page.data.forEach(item => {
if (item.customFields) {