fix (接口自动化): 修复单条执行有未执行的情况
--bug=1006591 --user=赵勇 【接口自动化】执行场景,执行完成,报告状态异常 https://www.tapd.cn/55049933/s/1046338
This commit is contained in:
parent
0125a38b2d
commit
3051149371
|
@ -107,22 +107,12 @@ export default {
|
||||||
this.isRequestResult = false;
|
this.isRequestResult = false;
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
if (this.scenarioId) {
|
if (this.scenario && this.scenario.scenarioDefinition) {
|
||||||
this.getApiScenario().then(() => {
|
this.content.scenarioStepTotal = this.scenario.scenarioDefinition.hashTree.length;
|
||||||
this.initTree();
|
this.initTree();
|
||||||
this.initWebSocket();
|
this.initWebSocket();
|
||||||
this.initMessageSocket();
|
this.initMessageSocket();
|
||||||
this.clearDebug();
|
this.clearDebug();
|
||||||
this.loading = false;
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
if (this.scenario && this.scenario.scenarioDefinition) {
|
|
||||||
this.content.scenarioStepTotal = this.scenario.scenarioDefinition.hashTree.length;
|
|
||||||
this.initTree();
|
|
||||||
this.initWebSocket();
|
|
||||||
this.initMessageSocket();
|
|
||||||
this.clearDebug();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
|
@ -134,36 +124,6 @@ export default {
|
||||||
scenarioId: String
|
scenarioId: String
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getApiScenario() {
|
|
||||||
this.loading = true;
|
|
||||||
return new Promise((resolve) => {
|
|
||||||
this.result = this.$get("/api/automation/getApiScenario/" + this.scenarioId, response => {
|
|
||||||
if (response.data) {
|
|
||||||
if (response.data.scenarioDefinition != null) {
|
|
||||||
let obj = JSON.parse(response.data.scenarioDefinition);
|
|
||||||
this.scenario.scenarioDefinition = obj;
|
|
||||||
this.scenario.name = response.data.name;
|
|
||||||
this.content.scenarioStepTotal = obj.hashTree.length;
|
|
||||||
if (this.scenario.scenarioDefinition && this.scenario.scenarioDefinition.hashTree) {
|
|
||||||
this.sort(this.scenario.scenarioDefinition.hashTree);
|
|
||||||
}
|
|
||||||
resolve();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
},
|
|
||||||
sort(stepArray) {
|
|
||||||
for (let i in stepArray) {
|
|
||||||
stepArray[i].index = Number(i) + 1;
|
|
||||||
if (!stepArray[i].resourceId) {
|
|
||||||
stepArray[i].resourceId = getUUID();
|
|
||||||
}
|
|
||||||
if (stepArray[i].hashTree && stepArray[i].hashTree.length > 0) {
|
|
||||||
this.sort(stepArray[i].hashTree);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
initTree() {
|
initTree() {
|
||||||
this.fullTreeNodes = [];
|
this.fullTreeNodes = [];
|
||||||
let obj = {index: 1, label: this.scenario.name, value: {responseResult: {}, unexecute: true, testing: false}, children: [], unsolicited: true};
|
let obj = {index: 1, label: this.scenario.name, value: {responseResult: {}, unexecute: true, testing: false}, children: [], unsolicited: true};
|
||||||
|
|
|
@ -181,7 +181,7 @@
|
||||||
<template v-slot:opt-before="scope">
|
<template v-slot:opt-before="scope">
|
||||||
<ms-table-operator-button v-permission=" ['PROJECT_API_SCENARIO:READ+RUN']"
|
<ms-table-operator-button v-permission=" ['PROJECT_API_SCENARIO:READ+RUN']"
|
||||||
:tip="$t('api_test.automation.execute')" icon="el-icon-video-play" class="run-button"
|
:tip="$t('api_test.automation.execute')" icon="el-icon-video-play" class="run-button"
|
||||||
@exec="execute(scope.row)" v-if="!scope.row.isStop && !trashEnable" style="margin-right: 10px;"/>
|
@exec="run(scope.row)" v-if="!scope.row.isStop && !trashEnable" style="margin-right: 10px;"/>
|
||||||
<el-tooltip :content="$t('report.stop_btn')" placement="top" :enterable="false" v-else>
|
<el-tooltip :content="$t('report.stop_btn')" placement="top" :enterable="false" v-else>
|
||||||
<el-button v-if="!trashEnable" @click.once="stop(scope.row)" size="mini" style="color:white;padding: 0;width: 28px;height: 28px;margin-right: 10px;" class="stop-btn" circle>
|
<el-button v-if="!trashEnable" @click.once="stop(scope.row)" size="mini" style="color:white;padding: 0;width: 28px;height: 28px;margin-right: 10px;" class="stop-btn" circle>
|
||||||
<div style="transform: scale(0.72)">
|
<div style="transform: scale(0.72)">
|
||||||
|
@ -202,14 +202,13 @@
|
||||||
:total="total"/>
|
:total="total"/>
|
||||||
<div>
|
<div>
|
||||||
<!-- 执行结果 -->
|
<!-- 执行结果 -->
|
||||||
<el-drawer :visible.sync="runVisible" :destroy-on-close="true" direction="ltr" :withHeader="true" :modal="false"
|
<el-drawer :visible.sync="runVisible" :destroy-on-close="true" direction="ltr" :withHeader="true" :modal="false" size="90%">
|
||||||
size="90%">
|
|
||||||
<sysn-api-report-detail @refresh="search" :debug="true" :scenario="currentScenario" :scenarioId="scenarioId" :infoDb="infoDb" :report-id="reportId" :currentProjectId="projectId"/>
|
<sysn-api-report-detail @refresh="search" :debug="true" :scenario="currentScenario" :scenarioId="scenarioId" :infoDb="infoDb" :report-id="reportId" :currentProjectId="projectId"/>
|
||||||
</el-drawer>
|
</el-drawer>
|
||||||
<!-- 执行结果 -->
|
<!-- 执行结果 -->
|
||||||
<el-drawer :visible.sync="showReportVisible" :destroy-on-close="true" direction="ltr" :withHeader="true" :modal="false"
|
<el-drawer :visible.sync="showReportVisible" :destroy-on-close="true" direction="ltr" :withHeader="true" :modal="false"
|
||||||
size="90%">
|
size="90%">
|
||||||
<ms-api-report-detail @refresh="search" :infoDb="infoDb" :report-id="reportId" :currentProjectId="projectId"/>
|
<ms-api-report-detail @refresh="search" :infoDb="infoDb" :report-id="showReportId" :currentProjectId="projectId"/>
|
||||||
</el-drawer>
|
</el-drawer>
|
||||||
<!--测试计划-->
|
<!--测试计划-->
|
||||||
<el-drawer :visible.sync="planVisible" :destroy-on-close="true" direction="ltr" :withHeader="false"
|
<el-drawer :visible.sync="planVisible" :destroy-on-close="true" direction="ltr" :withHeader="false"
|
||||||
|
@ -224,6 +223,8 @@
|
||||||
:dialog-title="$t('test_track.case.batch_edit_case')"/>
|
:dialog-title="$t('test_track.case.batch_edit_case')"/>
|
||||||
<batch-move @refresh="search" @moveSave="moveSave" ref="testBatchMove"/>
|
<batch-move @refresh="search" @moveSave="moveSave" ref="testBatchMove"/>
|
||||||
<ms-run-mode @handleRunBatch="handleRunBatch" ref="runMode"/>
|
<ms-run-mode @handleRunBatch="handleRunBatch" ref="runMode"/>
|
||||||
|
<ms-run :debug="true" v-if="type!=='detail'" :environment="projectEnvMap" @runRefresh="runRefresh" :reportId="reportId" :saved="true"
|
||||||
|
:run-data="debugData" ref="runTest"/>
|
||||||
<ms-task-center ref="taskCenter"/>
|
<ms-task-center ref="taskCenter"/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -263,7 +264,8 @@ export default {
|
||||||
MsTestPlanList: () => import("./testplan/TestPlanList"),
|
MsTestPlanList: () => import("./testplan/TestPlanList"),
|
||||||
MsTableOperatorButton: () => import("@/business/components/common/components/MsTableOperatorButton"),
|
MsTableOperatorButton: () => import("@/business/components/common/components/MsTableOperatorButton"),
|
||||||
MsRunMode: () => import("./common/RunMode"),
|
MsRunMode: () => import("./common/RunMode"),
|
||||||
MsTaskCenter: () => import("../../../task/TaskCenter")
|
MsTaskCenter: () => import("../../../task/TaskCenter"),
|
||||||
|
MsRun: () => import("./DebugRun")
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
referenced: {
|
referenced: {
|
||||||
|
@ -328,6 +330,8 @@ export default {
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
total: 0,
|
total: 0,
|
||||||
reportId: "",
|
reportId: "",
|
||||||
|
showReportId: "",
|
||||||
|
projectEnvMap: new Map(),
|
||||||
batchReportId: "",
|
batchReportId: "",
|
||||||
content: {},
|
content: {},
|
||||||
infoDb: false,
|
infoDb: false,
|
||||||
|
@ -342,6 +346,7 @@ export default {
|
||||||
operators: [],
|
operators: [],
|
||||||
selectRows: new Set(),
|
selectRows: new Set(),
|
||||||
isStop: false,
|
isStop: false,
|
||||||
|
debugData: {},
|
||||||
trashOperators: [
|
trashOperators: [
|
||||||
{
|
{
|
||||||
tip: this.$t('commons.reduction'),
|
tip: this.$t('commons.reduction'),
|
||||||
|
@ -483,9 +488,9 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(this.trashEnable){
|
if (this.trashEnable) {
|
||||||
this.condition.orders = [{"name":"delete_time","type":"desc"}];
|
this.condition.orders = [{"name": "delete_time", "type": "desc"}];
|
||||||
}else {
|
} else {
|
||||||
this.condition.orders = getLastTableSortField(this.tableHeaderKey);
|
this.condition.orders = getLastTableSortField(this.tableHeaderKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -787,19 +792,19 @@ export default {
|
||||||
this.search();
|
this.search();
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}else {
|
} else {
|
||||||
let param = {};
|
let param = {};
|
||||||
this.buildBatchParam(param);
|
this.buildBatchParam(param);
|
||||||
this.$post('/api/automation/checkBeforeDelete/', param, response => {
|
this.$post('/api/automation/checkBeforeDelete/', param, response => {
|
||||||
|
|
||||||
let checkResult = response.data;
|
let checkResult = response.data;
|
||||||
let alertMsg = this.$t('load_test.delete_threadgroup_confirm') + " ?";
|
let alertMsg = this.$t('load_test.delete_threadgroup_confirm') + " ?";
|
||||||
if(!checkResult.deleteFlag){
|
if (!checkResult.deleteFlag) {
|
||||||
alertMsg = "";
|
alertMsg = "";
|
||||||
checkResult.checkMsg.forEach(item => {
|
checkResult.checkMsg.forEach(item => {
|
||||||
alertMsg+=item+";";
|
alertMsg += item + ";";
|
||||||
});
|
});
|
||||||
if(alertMsg === ""){
|
if (alertMsg === "") {
|
||||||
alertMsg = this.$t('load_test.delete_threadgroup_confirm') + " ?";
|
alertMsg = this.$t('load_test.delete_threadgroup_confirm') + " ?";
|
||||||
} else {
|
} else {
|
||||||
alertMsg += this.$t('api_test.is_continue') + " ?";
|
alertMsg += this.$t('api_test.is_continue') + " ?";
|
||||||
|
@ -821,7 +826,34 @@ export default {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
getApiScenario(scenarioId) {
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
this.result = this.$get("/api/automation/getApiScenario/" + scenarioId, response => {
|
||||||
|
if (response.data) {
|
||||||
|
if (response.data.scenarioDefinition != null) {
|
||||||
|
let obj = JSON.parse(response.data.scenarioDefinition);
|
||||||
|
this.currentScenario.scenarioDefinition = obj;
|
||||||
|
this.currentScenario.name = response.data.name;
|
||||||
|
if (this.currentScenario.scenarioDefinition && this.currentScenario.scenarioDefinition.hashTree) {
|
||||||
|
this.sort(this.currentScenario.scenarioDefinition.hashTree);
|
||||||
|
}
|
||||||
|
resolve();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
sort(stepArray) {
|
||||||
|
for (let i in stepArray) {
|
||||||
|
stepArray[i].index = Number(i) + 1;
|
||||||
|
if (!stepArray[i].resourceId) {
|
||||||
|
stepArray[i].resourceId = getUUID();
|
||||||
|
}
|
||||||
|
if (stepArray[i].hashTree && stepArray[i].hashTree.length > 0) {
|
||||||
|
this.sort(stepArray[i].hashTree);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
execute(row) {
|
execute(row) {
|
||||||
this.infoDb = false;
|
this.infoDb = false;
|
||||||
this.scenarioId = row.id;
|
this.scenarioId = row.id;
|
||||||
|
@ -841,6 +873,35 @@ export default {
|
||||||
this.$set(row, "isStop", false);
|
this.$set(row, "isStop", false);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
runRefresh(row) {
|
||||||
|
this.$set(row, "isStop", false);
|
||||||
|
},
|
||||||
|
run(row) {
|
||||||
|
this.scenarioId = row.id;
|
||||||
|
this.getApiScenario(row.id).then(() => {
|
||||||
|
let scenarioStep = this.currentScenario.scenarioDefinition;
|
||||||
|
if (scenarioStep) {
|
||||||
|
this.debugData = {
|
||||||
|
id: this.currentScenario.id,
|
||||||
|
name: this.currentScenario.name,
|
||||||
|
type: "scenario",
|
||||||
|
variables: scenarioStep.variables,
|
||||||
|
referenced: 'Created',
|
||||||
|
onSampleError: scenarioStep.onSampleError,
|
||||||
|
enableCookieShare: scenarioStep.enableCookieShare,
|
||||||
|
headers: scenarioStep.headers,
|
||||||
|
environmentMap: scenarioStep.environmentMap ? new Map(Object.entries(scenarioStep.environmentMap)) : new Map,
|
||||||
|
hashTree: scenarioStep.hashTree
|
||||||
|
};
|
||||||
|
if (scenarioStep.environmentMap) {
|
||||||
|
this.projectEnvMap = new Map(Object.entries(scenarioStep.environmentMap));
|
||||||
|
}
|
||||||
|
this.reportId = getUUID().substring(0, 8);
|
||||||
|
this.runVisible = true;
|
||||||
|
this.$set(row, "isStop", true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
copy(row) {
|
copy(row) {
|
||||||
let rowParam = JSON.parse(JSON.stringify(row));
|
let rowParam = JSON.parse(JSON.stringify(row));
|
||||||
rowParam.copy = true;
|
rowParam.copy = true;
|
||||||
|
@ -851,7 +912,7 @@ export default {
|
||||||
showReport(row) {
|
showReport(row) {
|
||||||
this.showReportVisible = true;
|
this.showReportVisible = true;
|
||||||
this.infoDb = true;
|
this.infoDb = true;
|
||||||
this.reportId = row.reportId;
|
this.showReportId = row.reportId;
|
||||||
},
|
},
|
||||||
//判断是否只显示本周的数据。 从首页跳转过来的请求会带有相关参数
|
//判断是否只显示本周的数据。 从首页跳转过来的请求会带有相关参数
|
||||||
isSelectThissWeekData() {
|
isSelectThissWeekData() {
|
||||||
|
@ -868,20 +929,20 @@ export default {
|
||||||
this.search();
|
this.search();
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}else {
|
} else {
|
||||||
let param = {};
|
let param = {};
|
||||||
this.buildBatchParam(param);
|
this.buildBatchParam(param);
|
||||||
param.ids = [row.id];
|
param.ids = [row.id];
|
||||||
this.$post('/api/automation/checkBeforeDelete/', param, response => {
|
this.$post('/api/automation/checkBeforeDelete/', param, response => {
|
||||||
let checkResult = response.data;
|
let checkResult = response.data;
|
||||||
let alertMsg = this.$t('load_test.delete_threadgroup_confirm') +" ?";
|
let alertMsg = this.$t('load_test.delete_threadgroup_confirm') + " ?";
|
||||||
if(!checkResult.deleteFlag){
|
if (!checkResult.deleteFlag) {
|
||||||
alertMsg = "";
|
alertMsg = "";
|
||||||
checkResult.checkMsg.forEach(item => {
|
checkResult.checkMsg.forEach(item => {
|
||||||
alertMsg+=item+";";
|
alertMsg += item + ";";
|
||||||
});
|
});
|
||||||
if(alertMsg === ""){
|
if (alertMsg === "") {
|
||||||
alertMsg = this.$t('load_test.delete_threadgroup_confirm') +" ?";
|
alertMsg = this.$t('load_test.delete_threadgroup_confirm') + " ?";
|
||||||
} else {
|
} else {
|
||||||
alertMsg += this.$t('api_test.is_continue') + " ?";
|
alertMsg += this.$t('api_test.is_continue') + " ?";
|
||||||
}
|
}
|
||||||
|
@ -1004,10 +1065,10 @@ export default {
|
||||||
this.buildBatchParam(param);
|
this.buildBatchParam(param);
|
||||||
this.$post('/api/automation/batchCopy', param, response => {
|
this.$post('/api/automation/batchCopy', param, response => {
|
||||||
let copyResult = response.data;
|
let copyResult = response.data;
|
||||||
if(copyResult.result){
|
if (copyResult.result) {
|
||||||
this.$success(this.$t('api_test.definition.request.batch_copy_end'));
|
this.$success(this.$t('api_test.definition.request.batch_copy_end'));
|
||||||
}else {
|
} else {
|
||||||
this.$error(this.$t('commons.already_exists')+":"+copyResult.errorMsg);
|
this.$error(this.$t('commons.already_exists') + ":" + copyResult.errorMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.search();
|
this.search();
|
||||||
|
|
Loading…
Reference in New Issue