refactor(接口测试): 场景中生成报告优化
--bug=1011491 --user=赵勇 【接口测试】场景-编辑-点击生成报告到弹出报告页面时间较长 https://www.tapd.cn/55049933/s/1122486
This commit is contained in:
parent
9ddcb35344
commit
af4b298296
|
@ -347,6 +347,8 @@ public class ApiScenarioExecuteService {
|
||||||
String reportType = request.getConfig() != null ? request.getConfig().getReportType() : null;
|
String reportType = request.getConfig() != null ? request.getConfig().getReportType() : null;
|
||||||
if (scenario != null) {
|
if (scenario != null) {
|
||||||
report.setVersionId(scenario.getVersionId());
|
report.setVersionId(scenario.getVersionId());
|
||||||
|
String scenarioDefinition = JSON.toJSONString(request.getTestElement().getHashTree().get(0).getHashTree().get(0));
|
||||||
|
scenario.setScenarioDefinition(scenarioDefinition);
|
||||||
reportStructureService.save(scenario, report.getId(), reportType);
|
reportStructureService.save(scenario, report.getId(), reportType);
|
||||||
} else {
|
} else {
|
||||||
if (request.getTestElement() != null && CollectionUtils.isNotEmpty(request.getTestElement().getHashTree())) {
|
if (request.getTestElement() != null && CollectionUtils.isNotEmpty(request.getTestElement().getHashTree())) {
|
||||||
|
|
|
@ -403,8 +403,12 @@ export default {
|
||||||
scenarioDefinition: t.currentScenario.scenarioDefinition
|
scenarioDefinition: t.currentScenario.scenarioDefinition
|
||||||
};
|
};
|
||||||
let v3 = JSON.parse(JSON.stringify(v2));
|
let v3 = JSON.parse(JSON.stringify(v2));
|
||||||
|
if (v1.scenarioDefinition) {
|
||||||
this.deleteResourceIds(v1.scenarioDefinition);
|
this.deleteResourceIds(v1.scenarioDefinition);
|
||||||
|
}
|
||||||
|
if (v3.scenarioDefinition) {
|
||||||
this.deleteResourceIds(v3.scenarioDefinition);
|
this.deleteResourceIds(v3.scenarioDefinition);
|
||||||
|
}
|
||||||
let delta = jsondiffpatch.diff(JSON.parse(JSON.stringify(v1)), JSON.parse(JSON.stringify(v3)));
|
let delta = jsondiffpatch.diff(JSON.parse(JSON.stringify(v1)), JSON.parse(JSON.stringify(v3)));
|
||||||
if (delta) {
|
if (delta) {
|
||||||
this.isSave = true;
|
this.isSave = true;
|
||||||
|
@ -560,7 +564,9 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
refresh(data) {
|
refresh(data) {
|
||||||
|
if (data) {
|
||||||
this.setTabTitle(data);
|
this.setTabTitle(data);
|
||||||
|
}
|
||||||
this.isSave = true;
|
this.isSave = true;
|
||||||
},
|
},
|
||||||
refreshTree() {
|
refreshTree() {
|
||||||
|
|
|
@ -128,12 +128,17 @@ export default {
|
||||||
this.isRequestResult = false;
|
this.isRequestResult = false;
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.$nextTick(() => {
|
||||||
if (this.scenario && this.scenario.scenarioDefinition) {
|
if (this.scenario && this.scenario.scenarioDefinition) {
|
||||||
this.content.scenarioStepTotal = this.scenario.scenarioDefinition.hashTree.length;
|
this.content.scenarioStepTotal = this.scenario.scenarioDefinition.hashTree.length;
|
||||||
this.initTree();
|
this.initTree();
|
||||||
this.initMessageSocket();
|
this.initMessageSocket();
|
||||||
this.clearDebug();
|
this.clearDebug();
|
||||||
}
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
reportId: String,
|
reportId: String,
|
||||||
|
@ -208,7 +213,7 @@ export default {
|
||||||
this.$refs.failsTree.filter(index);
|
this.$refs.failsTree.filter(index);
|
||||||
} else if (this.activeName === "errorReport") {
|
} else if (this.activeName === "errorReport") {
|
||||||
this.$refs.errorReportTree.filter("errorReport");
|
this.$refs.errorReportTree.filter("errorReport");
|
||||||
} else if(this.activeName === "unExecute"){
|
} else if (this.activeName === "unExecute") {
|
||||||
this.$refs.unExecuteTree.filter("unexecute");
|
this.$refs.unExecuteTree.filter("unexecute");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -983,7 +983,7 @@ export default {
|
||||||
this.debugLoading = false;
|
this.debugLoading = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.editScenario().then(() => {
|
this.initParameter();
|
||||||
this.debugData = {
|
this.debugData = {
|
||||||
id: this.currentScenario.id,
|
id: this.currentScenario.id,
|
||||||
name: this.currentScenario.name,
|
name: this.currentScenario.name,
|
||||||
|
@ -999,9 +999,10 @@ export default {
|
||||||
this.reportId = getUUID().substring(0, 8);
|
this.reportId = getUUID().substring(0, 8);
|
||||||
this.debugLoading = false;
|
this.debugLoading = false;
|
||||||
this.pluginDelStep = false;
|
this.pluginDelStep = false;
|
||||||
})
|
this.$emit('refresh');
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
|
)
|
||||||
},
|
},
|
||||||
validatePluginData(steps) {
|
validatePluginData(steps) {
|
||||||
steps.forEach(step => {
|
steps.forEach(step => {
|
||||||
|
@ -1621,7 +1622,7 @@ export default {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async setParameter() {
|
initParameter() {
|
||||||
this.currentScenario.stepTotal = this.scenarioDefinition.length;
|
this.currentScenario.stepTotal = this.scenarioDefinition.length;
|
||||||
if (!this.currentScenario.projectId) {
|
if (!this.currentScenario.projectId) {
|
||||||
this.currentScenario.projectId = this.projectId;
|
this.currentScenario.projectId = this.projectId;
|
||||||
|
@ -1646,11 +1647,6 @@ export default {
|
||||||
this.formatData(scenario.hashTree);
|
this.formatData(scenario.hashTree);
|
||||||
}
|
}
|
||||||
this.currentScenario.environmentType = this.environmentType;
|
this.currentScenario.environmentType = this.environmentType;
|
||||||
let definition = JSON.parse(JSON.stringify(this.currentScenario));
|
|
||||||
definition.hashTree = this.scenarioDefinition;
|
|
||||||
await this.getEnv(JSON.stringify(definition));
|
|
||||||
// 保存时同步所需要的项目环境
|
|
||||||
savePreciseEnvProjectIds(this.projectIds, this.projectEnvMap);
|
|
||||||
this.currentScenario.environmentJson = JSON.stringify(strMapToObj(this.projectEnvMap));
|
this.currentScenario.environmentJson = JSON.stringify(strMapToObj(this.projectEnvMap));
|
||||||
this.currentScenario.environmentGroupId = this.envGroupId;
|
this.currentScenario.environmentGroupId = this.envGroupId;
|
||||||
this.currentScenario.scenarioDefinition = scenario;
|
this.currentScenario.scenarioDefinition = scenario;
|
||||||
|
@ -1662,6 +1658,14 @@ export default {
|
||||||
this.currentScenario.apiScenarioModuleId = this.currentModule.id;
|
this.currentScenario.apiScenarioModuleId = this.currentModule.id;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
async setParameter() {
|
||||||
|
this.initParameter();
|
||||||
|
let definition = JSON.parse(JSON.stringify(this.currentScenario));
|
||||||
|
definition.hashTree = this.scenarioDefinition;
|
||||||
|
await this.getEnv(JSON.stringify(definition));
|
||||||
|
// 保存时同步所需要的项目环境
|
||||||
|
savePreciseEnvProjectIds(this.projectIds, this.projectEnvMap);
|
||||||
|
},
|
||||||
runRefresh() {
|
runRefresh() {
|
||||||
if (!this.debug) {
|
if (!this.debug) {
|
||||||
this.debugVisible = true;
|
this.debugVisible = true;
|
||||||
|
@ -1679,6 +1683,7 @@ export default {
|
||||||
this.runScenario = undefined;
|
this.runScenario = undefined;
|
||||||
this.message = "stop";
|
this.message = "stop";
|
||||||
this.clearMessage = getUUID().substring(0, 8);
|
this.clearMessage = getUUID().substring(0, 8);
|
||||||
|
this.debugData = {};
|
||||||
},
|
},
|
||||||
showScenarioParameters() {
|
showScenarioParameters() {
|
||||||
this.$refs.scenarioParameters.open(this.currentScenario.variables, this.currentScenario.headers);
|
this.$refs.scenarioParameters.open(this.currentScenario.variables, this.currentScenario.headers);
|
||||||
|
@ -1726,6 +1731,7 @@ export default {
|
||||||
},
|
},
|
||||||
detailRefresh(result) {
|
detailRefresh(result) {
|
||||||
// 把执行结果分发给各个请求
|
// 把执行结果分发给各个请求
|
||||||
|
this.debugData = {};
|
||||||
},
|
},
|
||||||
fullScreen() {
|
fullScreen() {
|
||||||
this.drawer = true;
|
this.drawer = true;
|
||||||
|
|
Loading…
Reference in New Issue