fix(接口测试): 修复场景中调试状态未及时更新问题
This commit is contained in:
parent
b4ed25de1e
commit
43b6f1560c
|
@ -71,10 +71,12 @@ public class ApiScenarioSerialService {
|
|||
apiScenarioReportMapper.updateByPrimaryKey(report);
|
||||
} else {
|
||||
ApiDefinitionExecResult execResult = apiDefinitionExecResultMapper.selectByPrimaryKey(queue.getReportId());
|
||||
if (execResult != null) {
|
||||
execResult.setStatus(APITestStatus.Running.name());
|
||||
apiDefinitionExecResultMapper.updateByPrimaryKey(execResult);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LoggerUtil.info("Scenario run-开始执行,队列ID:【 " + executionQueue.getReportId() + " 】");
|
||||
try {
|
||||
|
|
|
@ -317,7 +317,10 @@ public class ApiDefinitionExecResultService {
|
|||
|
||||
private ApiDefinitionExecResult save(RequestResult item, String reportId, String console, int expectProcessResultCount, String type, String testId, boolean isFirst) {
|
||||
if (!StringUtils.startsWithAny(item.getName(), "PRE_PROCESSOR_ENV_", "POST_PROCESSOR_ENV_")) {
|
||||
ApiDefinitionExecResult saveResult = new ApiDefinitionExecResult();
|
||||
ApiDefinitionExecResult saveResult = apiDefinitionExecResultMapper.selectByPrimaryKey(reportId);
|
||||
if (saveResult == null) {
|
||||
saveResult = new ApiDefinitionExecResult();
|
||||
}
|
||||
item.getResponseResult().setConsole(console);
|
||||
saveResult.setId(reportId);
|
||||
saveResult.setActuator("LOCAL");
|
||||
|
|
|
@ -87,7 +87,6 @@ public class ApiScenarioReportService {
|
|||
apiScenarioReportResultService.save(dto.getReportId(), requestResults);
|
||||
}
|
||||
|
||||
|
||||
public ApiScenarioReport testEnded(ResultDTO dto) {
|
||||
if (!StringUtils.equals(dto.getReportType(), RunModeConstants.SET_REPORT.toString())) {
|
||||
// 更新控制台信息
|
||||
|
@ -179,18 +178,11 @@ public class ApiScenarioReportService {
|
|||
}
|
||||
|
||||
public ApiScenarioReport editReport(String reportType, String reportId, String status, String runMode) {
|
||||
try {
|
||||
ApiScenarioReport report = apiScenarioReportMapper.selectByPrimaryKey(reportId);
|
||||
if (report == null) {
|
||||
int index = 0;
|
||||
while (index < 3) {
|
||||
LogUtil.info("未获取到报告,尝试重新获取:【" + reportId + "】");
|
||||
report = apiScenarioReportMapper.selectByPrimaryKey(reportId);
|
||||
Thread.sleep(2000);
|
||||
index++;
|
||||
report = new ApiScenarioReport();
|
||||
report.setId(reportId);
|
||||
}
|
||||
}
|
||||
if (report != null) {
|
||||
if (StringUtils.equals(reportType, RunModeConstants.SET_REPORT.toString())) {
|
||||
return report;
|
||||
}
|
||||
|
@ -205,12 +197,7 @@ public class ApiScenarioReportService {
|
|||
report.setTriggerMode(TriggerMode.MANUAL.name());
|
||||
}
|
||||
apiScenarioReportMapper.updateByPrimaryKeySelective(report);
|
||||
}
|
||||
return report;
|
||||
} catch (Exception e) {
|
||||
LoggerUtil.error(e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public ApiScenarioReport updateReport(APIScenarioReportResult test) {
|
||||
|
|
|
@ -1144,6 +1144,7 @@ export default {
|
|||
this.clearDebug();
|
||||
this.clearResult(this.scenarioDefinition);
|
||||
this.clearNodeStatus(this.$refs.stepTree.root.childNodes);
|
||||
this.sort();
|
||||
/*触发执行操作*/
|
||||
this.$refs.currentScenario.validate(async (valid) => {
|
||||
if (valid) {
|
||||
|
|
|
@ -18,7 +18,16 @@
|
|||
:node="node"
|
||||
:is-read-only="this.jsr223Processor.disabled"/>
|
||||
</legend>
|
||||
|
||||
<template v-slot:debugStepCode>
|
||||
<span v-if="jsr223Processor.testing" class="ms-test-running">
|
||||
<i class="el-icon-loading" style="font-size: 16px"/>
|
||||
{{ $t('commons.testing') }}
|
||||
</span>
|
||||
<span class="ms-step-debug-code" :class="jsr223Processor.requestResult[0].success && reqSuccess?'ms-req-success':'ms-req-error'"
|
||||
v-if="!loading &&!jsr223Processor.testing && jsr223Processor.debug && jsr223Processor.requestResult[0] && jsr223Processor.requestResult[0].responseResult">
|
||||
{{ jsr223Processor.requestResult[0].success && reqSuccess ? 'success' : 'error' }}
|
||||
</span>
|
||||
</template>
|
||||
</api-base-component>
|
||||
</template>
|
||||
|
||||
|
@ -33,6 +42,8 @@ export default {
|
|||
name: "MsJsr233Processor",
|
||||
components: {Jsr233ProcessorContent, ApiBaseComponent, MsDropdown, MsInstructionsIcon, MsCodeEdit},
|
||||
props: {
|
||||
request: {},
|
||||
message: String,
|
||||
draggable: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
|
@ -63,10 +74,39 @@ export default {
|
|||
backgroundColor: String,
|
||||
node: {},
|
||||
},
|
||||
watch: {
|
||||
message() {
|
||||
this.forStatus();
|
||||
this.reload();
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {loading: false}
|
||||
return {
|
||||
loading: false,
|
||||
reqSuccess: true
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
forStatus() {
|
||||
if (this.jsr223Processor && this.jsr223Processor.result && this.jsr223Processor.result.length > 0) {
|
||||
this.jsr223Processor.result.forEach(item => {
|
||||
item.requestResult.forEach(req => {
|
||||
if (!req.success) {
|
||||
this.reqSuccess = req.success;
|
||||
}
|
||||
})
|
||||
})
|
||||
} else if (this.jsr223Processor && this.jsr223Processor.requestResult && this.jsr223Processor.requestResult.length > 1) {
|
||||
this.jsr223Processor.requestResult.forEach(item => {
|
||||
if (!item.success) {
|
||||
this.reqSuccess = item.success;
|
||||
if (this.node && this.node.parent && this.node.parent.data) {
|
||||
this.node.parent.data.code = 'error';
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
remove() {
|
||||
this.$emit('remove', this.jsr223Processor, this.node);
|
||||
},
|
||||
|
@ -84,11 +124,24 @@ export default {
|
|||
this.reload();
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
/deep/ .el-divider {
|
||||
/deep/ .el-divider {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
.ms-req-error {
|
||||
color: #F56C6C;
|
||||
}
|
||||
|
||||
.ms-test-running {
|
||||
color: #6D317C;
|
||||
}
|
||||
|
||||
.ms-req-success {
|
||||
color: #67C23A;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
|
Loading…
Reference in New Issue