fix(接口自动化): 修复导入场景缺陷

This commit is contained in:
fit2-zhao 2020-12-18 14:31:04 +08:00
parent a59238d93c
commit fdc408bfbf
9 changed files with 39 additions and 36 deletions

View File

@ -280,7 +280,7 @@ public class ApiAutomationService {
// 调用执行方法
jMeterService.runDefinition(request.getId(), jmeterTestPlanHashTree, request.getReportId(), ApiRunMode.SCENARIO.name());
createAPIReportResult(request.getId(), request.getTriggerMode() == null ? ReportTriggerMode.API.name() : request.getTriggerMode());
createAPIReportResult(request.getId(), request.getTriggerMode() == null ? ReportTriggerMode.MANUAL.name() : request.getTriggerMode());
return request.getId();
}
@ -303,6 +303,7 @@ public class ApiAutomationService {
ParameterConfig config = new ParameterConfig();
config.setConfig(envConfig);
HashTree hashTree = request.getTestElement().generateHashTree(config);
request.getTestElement().getJmx(hashTree);
// 调用执行方法
jMeterService.runDefinition(request.getId(), hashTree, request.getReportId(), ApiRunMode.SCENARIO.name());
createAPIReportResult(request.getId(), ReportTriggerMode.MANUAL.name());

View File

@ -92,7 +92,7 @@
let testPlan = createComponent('TestPlan');
let threadGroup = createComponent('ThreadGroup');
threadGroup.hashTree = [];
threadGroup.name = this.runData.name;
threadGroup.name = this.runData.name ? this.runData.name : "Debug-Scenario";
threadGroup.hashTree.push(this.runData);
testPlan.hashTree.push(threadGroup);
let reqObj = {id: this.reportId, reportId: this.reportId, environmentId: this.environment, testElement: testPlan};

View File

@ -157,7 +157,7 @@
</el-row>
</div>
<!-- 场景步骤内容 -->
<div style="margin-top: 10px" v-loading="loading">
<div v-loading="loading">
<el-tree node-key="resourceId" :props="props" :data="scenarioDefinition"
:default-expanded-keys="expandedNode"
:expand-on-click-node="false"
@ -486,6 +486,9 @@
} else {
request = item.request;
}
if (item.protocol) {
request.protocol = item.protocol;
}
request.id = item.id;
request.name = item.name;
request.refType = refType;
@ -607,10 +610,13 @@
this.getEnvironments();
},
allowDrop(draggingNode, dropNode, type) {
if (dropNode.data.type === draggingNode.data.type || ELEMENTS.get(dropNode.data.type).indexOf(draggingNode.data.type) != -1) {
return true;
}
return false;
// if (draggingNode.level == dropNode.level) {
// return true;
// }
// else if (ELEMENTS.get(dropNode.data.type).indexOf(draggingNode.data.type) != -1) {
// return true;
// }
return true;
},
allowDrag() {
this.sort();

View File

@ -1,7 +1,7 @@
<template>
<ms-container>
<ms-aside-container>
<ms-node-tree @selectModule="selectModule" @getApiModuleTree="initTree" @changeProtocol="changeProtocol"
<ms-node-tree @nodeSelectEvent="selectModule" @getApiModuleTree="initTree" @protocolChange="changeProtocol"
@refresh="refresh" @saveAsEdit="editApi" @exportAPI="exportAPI"/>
</ms-aside-container>
@ -85,7 +85,7 @@
this.isHide = true;
},
selectModule(data) {
this.currentModule = data;
this.currentModule = data.data;
},
exportAPI() {
if (!this.$refs.apiList[0].tableData) {

View File

@ -76,14 +76,14 @@
</template>
</el-table-column>
</el-table>
<ms-table-pagination :change="initApiTable" :current-page.sync="currentPage" :page-size.sync="pageSize"
<ms-table-pagination :change="initTable" :current-page.sync="currentPage" :page-size.sync="pageSize"
:total="total"/>
</el-card>
</div>
<div id="svgResize"/>
<div id="svgDown">
<ms-bottom-container v-bind:enableAsideHidden="isHide">
<ms-api-case-list @apiCaseClose="apiCaseClose" @refresh="initApiTable" :visible="visible" :currentRow="currentRow" :api="selectApi"/>
<ms-api-case-list @apiCaseClose="apiCaseClose" @refresh="initTable" :visible="visible" :currentRow="currentRow" :api="selectApi"/>
</ms-bottom-container>
</div>
</div>
@ -150,38 +150,35 @@
},
created: function () {
this.projectId = getCurrentProjectID();
this.initApiTable();
this.initTable();
},
mounted() {
this.dragControllerDiv();
},
watch: {
currentModule() {
this.initApiTable();
this.initTable();
this.apiCaseClose();
},
visible() {
this.initApiTable();
this.initTable();
this.apiCaseClose();
},
currentProtocol() {
this.initApiTable();
this.initTable();
this.apiCaseClose();
},
},
methods: {
initApiTable() {
initTable() {
this.selectRows = new Set();
this.condition.filters = ["Prepare", "Underway", "Completed"];
if (this.currentModule != null) {
if (this.currentModule.id == "root") {
this.condition.moduleIds = [];
} else if (this.currentModule.id == "gc") {
this.condition.moduleIds = [];
this.condition.filters = ["Trash"];
}
else {
this.condition.moduleIds = this.currentModule.ids;
}
if (this.currentModule) {
this.condition.moduleIds = [this.currentModule.id];
}
if (this.trashEnable) {
this.condition.filters = ["Trash"];
this.condition.moduleIds = [];
}
if (this.projectId != null) {
this.condition.projectId = this.projectId;
@ -193,7 +190,6 @@
this.total = response.data.itemCount;
this.tableData = response.data.listObject;
});
this.selectRows = new Set();
},
handleSelect(selection, row) {
row.hashTree = [];
@ -241,7 +237,7 @@
}
},
search() {
this.initApiTable();
this.initTable();
},
buildPagePath(path) {
return path + "/" + this.currentPage + "/" + this.pageSize;
@ -268,7 +264,7 @@
let ids = Array.from(this.selectRows).map(row => row.id);
this.$post('/api/definition/deleteBatch/', ids, () => {
this.selectRows.clear();
this.initApiTable();
this.initTable();
this.$success(this.$t('commons.delete_success'));
});
}
@ -282,7 +278,7 @@
let ids = Array.from(this.selectRows).map(row => row.id);
this.$post('/api/definition/removeToGc/', ids, () => {
this.selectRows.clear();
this.initApiTable();
this.initTable();
this.$success(this.$t('commons.delete_success'));
});
}
@ -307,7 +303,7 @@
if (this.currentModule != undefined && this.currentModule.id == "gc") {
this.$get('/api/definition/delete/' + api.id, () => {
this.$success(this.$t('commons.delete_success'));
this.initApiTable();
this.initTable();
});
return;
}
@ -318,7 +314,7 @@
let ids = [api.id];
this.$post('/api/definition/removeToGc/', ids, () => {
this.$success(this.$t('commons.delete_success'));
this.initApiTable();
this.initTable();
});
}
}

View File

@ -20,7 +20,7 @@
<div>
<el-select size="small" :placeholder="$t('api_test.definition.request.grade_info')" v-model="condition.priority"
:disabled="isCaseEdit"
class="ms-api-header-select" @change="getApiTest">
class="ms-api-header-select" @change="getApiTest" clearable>
<el-option v-for="grd in priorities" :key="grd.id" :label="grd.name" :value="grd.id"/>
</el-select>
</div>

View File

@ -499,7 +499,7 @@ export default {
api_case_passing_rate: "Use case pass rate",
create_tip: "Note: Detailed interface information can be filled out on the edit page",
request: {
grade_info: "From high to low",
grade_info: "Filter by rank",
run_env: "Operating environment",
select_case: "Search use cases",
case: "Case",

View File

@ -497,7 +497,7 @@ export default {
api_case_passing_rate: "用例通过率",
create_tip: "注: 详细的接口信息可以在编辑页面填写",
request: {
grade_info: "按等级从高到低",
grade_info: "按等级筛选",
run_env: "运行环境",
select_case: "搜索用例",
case: "用例",

View File

@ -497,7 +497,7 @@ export default {
api_case_passing_rate: "用例通過率",
create_tip: "註: 詳細的接口信息可以在編輯頁面填寫",
request: {
grade_info: "按等級從高到低",
grade_info: "按等級筛选",
run_env: "運行環境",
select_case: "搜索用例",
case: "用例",