fix (接口测试): 修复多个条件文档断言校验问题

--bug=1008058 --user=赵勇 【接口定义】-接口定义-TEST-添加的xml文档结构断言后添加多个校验断言结果匹配错误 https://www.tapd.cn/55049933/s/1073325
This commit is contained in:
fit2-zhao 2021-11-23 18:43:52 +08:00 committed by fit2-zhao
parent 2c29c35e8a
commit f05422f807
6 changed files with 25 additions and 19 deletions

View File

@ -128,7 +128,7 @@ public class Document {
StringBuilder conditionStr = new StringBuilder();
if (elementCondition != null && CollectionUtils.isNotEmpty(elementCondition.getConditions())) {
elementCondition.getConditions().forEach(condition -> {
conditionStr.append(item.getLabel(item.getContentVerification()).replace("'%'", (item.getExpectedOutcome() != null ? item.getExpectedOutcome().toString() : "")));
conditionStr.append(item.getLabel(condition.getKey()).replace("'%'", (condition.getValue() != null ? condition.getValue().toString() : "")));
conditionStr.append(" and ");
});
}

View File

@ -444,7 +444,7 @@ public class MsHTTPSamplerProxy extends MsTestElement {
url = httpConfig.getProtocol() + "://" + httpConfig.getSocket();
}
String envPath = "";
if (!isCustomizeReqCompleteUrl(this.path)) {
if (!isCustomizeReqCompleteUrl(this.path) || isRefEnvironment) {
URL urlObject = new URL(url);
envPath = StringUtils.equals(urlObject.getPath(), "/") ? "" : urlObject.getFile();
if (StringUtils.isNotBlank(this.getPath())) {
@ -464,6 +464,9 @@ public class MsHTTPSamplerProxy extends MsTestElement {
sampler.setDomain(URLDecoder.decode(urlObject.getHost(), "UTF-8"));
sampler.setProtocol(urlObject.getProtocol());
}
if (StringUtils.isNotEmpty(envPath) && !envPath.startsWith("/")) {
envPath = "/" + envPath;
}
sampler.setProperty("HTTPSampler.path", URLDecoder.decode(URLEncoder.encode(envPath, "UTF-8"), "UTF-8"));
}
}

View File

@ -477,15 +477,12 @@ export default {
},
deep: true
},
scenarioDefinition: {
handler(newObj, oldObj) {
if (this.$store.state.scenarioMap) {
let change = this.$store.state.scenarioMap.get(this.currentScenario.id);
change = change + 1;
this.$store.state.scenarioMap.set(this.currentScenario.id, change);
}
},
deep: true
'currentScenario.tags'() {
if (this.$store.state.scenarioMap) {
let change = this.$store.state.scenarioMap.get(this.currentScenario.id);
change = change + 1;
this.$store.state.scenarioMap.set(this.currentScenario.id, change);
}
},
},
created() {
@ -508,6 +505,7 @@ export default {
mounted() {
this.$nextTick(() => {
this.addListener();
this.$store.state.scenarioMap.set(this.currentScenario.id, 0);
});
if (!this.currentScenario.name) {
this.$refs.refFab.openMenu();
@ -561,9 +559,6 @@ export default {
this.addNum(data.hashTree);
this.scenarioDefinition = data.hashTree;
}
if (!flag) {
this.$store.state.scenarioMap.set(this.currentScenario.id, 0);
}
}
})
}
@ -1713,7 +1708,7 @@ export default {
return new Promise((resolve) => {
let url = '/api/definition/get/' + id;
this.$get(url, response => {
if(response.data&&response.data.num){
if (response.data && response.data.num) {
resolve(response.data.num);
}
});
@ -1723,7 +1718,7 @@ export default {
return new Promise((resolve) => {
let url = '/api/testcase/get/' + id;
this.$get(url, response => {
if(response.data&&response.data.num){
if (response.data && response.data.num) {
resolve(response.data.num);
}
});
@ -1733,7 +1728,7 @@ export default {
return new Promise((resolve) => {
let url = '/api/automation/getApiScenario/' + id;
this.$get(url, response => {
if(response.data&&response.data.num){
if (response.data && response.data.num) {
resolve(response.data.num);
}
});

View File

@ -230,7 +230,7 @@ export default {
}
},
objectSpanMethod({row, column, rowIndex, columnIndex}) {
if (columnIndex === 0 || columnIndex === 1 || columnIndex === 2 || columnIndex === 3 || columnIndex === 4) {
if (columnIndex === 0 || columnIndex === 1 || columnIndex === 2 || columnIndex === 3) {
return {
rowspan: row.rowspan,
colspan: row.rowspan > 0 ? 1 : 0

View File

@ -178,6 +178,12 @@ export default {
this.visible = true;
},
saveApiAndCase(api) {
if (api && api.url) {
api.url = undefined;
}
if (api && api.request && api.request.url) {
api.request.url = undefined;
}
this.visible = true;
this.api = api;
this.currentApi = api;

View File

@ -194,7 +194,9 @@ export default {
this.responseData = data;
this.loading = false;
this.isStop = false;
this.$refs.debugResult.reload();
if(this.$refs.debugResult) {
this.$refs.debugResult.reload();
}
},
saveAsApi() {
this.$refs['debugForm'].validate((valid) => {