fix(接口自动化): 接口定义,sql请求没法执行;恢复编辑模块更新场景路径
This commit is contained in:
parent
affcb543bc
commit
c9a7d57324
|
@ -76,7 +76,7 @@ public class MsJDBCSampler extends MsTestElement {
|
|||
if (config.getConfig() == null) {
|
||||
// 单独接口执行
|
||||
this.setProjectId(config.getProjectId());
|
||||
config.setConfig(getEnvironmentConfig(useEnvironment));
|
||||
config.setConfig(getEnvironmentConfig(StringUtils.isNotEmpty(useEnvironment) ? useEnvironment : environmentId));
|
||||
}
|
||||
|
||||
// 数据兼容处理
|
||||
|
|
|
@ -878,7 +878,7 @@ public class ApiAutomationService {
|
|||
}
|
||||
testPlan.toHashTree(jmeterHashTree, testPlan.getHashTree(), new ParameterConfig());
|
||||
// 生成集成报告
|
||||
if (request.getConfig() != null && request.getConfig().getMode().equals("serial")) {
|
||||
if (request.getConfig() != null && request.getConfig().getMode().equals("serial") && StringUtils.isNotEmpty(request.getConfig().getReportName())) {
|
||||
request.getConfig().setReportId(UUID.randomUUID().toString());
|
||||
APIScenarioReportResult report = createScenarioReport(request.getConfig().getReportId(), JSON.toJSONString(reportList), request.getConfig().getReportName(), request.getTriggerMode() == null ? ReportTriggerMode.MANUAL.name() : request.getTriggerMode(),
|
||||
ExecuteType.Saved.name(), request.getProjectId(), request.getReportUserID(), request.getConfig());
|
||||
|
|
|
@ -240,6 +240,7 @@ public class ApiModuleService extends NodeTreeService<ApiModuleDTO> {
|
|||
if (apiDefinition != null && StringUtils.isNotBlank(apiDefinition.getModulePath())) {
|
||||
StringBuilder path = new StringBuilder(apiDefinition.getModulePath());
|
||||
List<String> pathLists = Arrays.asList(path.toString().split("/"));
|
||||
if (pathLists.size() > request.getLevel()) {
|
||||
pathLists.set(request.getLevel(), request.getName());
|
||||
path.delete(0, path.length());
|
||||
for (int i = 1; i < pathLists.size(); i++) {
|
||||
|
@ -247,6 +248,7 @@ public class ApiModuleService extends NodeTreeService<ApiModuleDTO> {
|
|||
}
|
||||
apiDefinition.setModulePath(path.toString());
|
||||
}
|
||||
}
|
||||
});
|
||||
batchUpdateApiDefinition(apiDefinitionResults);
|
||||
}
|
||||
|
|
|
@ -189,18 +189,20 @@ public class ApiScenarioModuleService extends NodeTreeService<ApiScenarioModuleD
|
|||
public int editNode(DragApiScenarioModuleRequest request) {
|
||||
request.setUpdateTime(System.currentTimeMillis());
|
||||
checkApiScenarioModuleExist(request);
|
||||
// List<ApiScenarioDTO> apiScenarios = queryByModuleIds(request);
|
||||
// apiScenarios.forEach(apiScenario -> {
|
||||
// StringBuilder path = new StringBuilder(apiScenario.getModulePath());
|
||||
// List<String> pathLists = Arrays.asList(path.toString().split("/"));
|
||||
// pathLists.set(request.getLevel(), request.getName());
|
||||
// path.delete(0, path.length());
|
||||
// for (int i = 1; i < pathLists.size(); i++) {
|
||||
// path.append("/").append(pathLists.get(i));
|
||||
// }
|
||||
// apiScenario.setModulePath(path.toString());
|
||||
// });
|
||||
// batchUpdateApiScenario(apiScenarios);
|
||||
List<ApiScenarioDTO> apiScenarios = queryByModuleIds(request);
|
||||
apiScenarios.forEach(apiScenario -> {
|
||||
StringBuilder path = new StringBuilder(apiScenario.getModulePath());
|
||||
List<String> pathLists = Arrays.asList(path.toString().split("/"));
|
||||
if (pathLists.size() > request.getLevel()) {
|
||||
pathLists.set(request.getLevel(), request.getName());
|
||||
path.delete(0, path.length());
|
||||
for (int i = 1; i < pathLists.size(); i++) {
|
||||
path.append("/").append(pathLists.get(i));
|
||||
}
|
||||
apiScenario.setModulePath(path.toString());
|
||||
}
|
||||
});
|
||||
batchUpdateApiScenario(apiScenarios);
|
||||
|
||||
return apiScenarioModuleMapper.updateByPrimaryKeySelective(request);
|
||||
}
|
||||
|
|
|
@ -117,6 +117,7 @@ public class TestPlanScenarioCaseService {
|
|||
request.setId(testPlanScenarioRequest.getId());
|
||||
request.setExecuteType(ExecuteType.Saved.name());
|
||||
request.setTriggerMode(testPlanScenarioRequest.getTriggerMode());
|
||||
request.setConfig(testPlanScenarioRequest.getConfig());
|
||||
return apiAutomationService.run(request);
|
||||
}
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit e435fe1d01a2495481efa58daf3875be07b2ac9b
|
||||
Subproject commit cd0ea7de5f69a33830725e26e71e65b3345903fe
|
|
@ -114,7 +114,8 @@
|
|||
loading: false,
|
||||
trashEnable: false,
|
||||
selectNodeIds: [],
|
||||
nodeTree: []
|
||||
nodeTree: [],
|
||||
currentModulePath: "",
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
|
@ -180,6 +181,21 @@
|
|||
this.redirectFlag = "none";
|
||||
}
|
||||
},
|
||||
getPath(id, arr) {
|
||||
if (id === null) {
|
||||
return null;
|
||||
}
|
||||
if(arr) {
|
||||
arr.forEach(item => {
|
||||
if (item.id === id) {
|
||||
this.currentModulePath = item.path;
|
||||
}
|
||||
if (item.children && item.children.length > 0) {
|
||||
this.getPath(id, item.children);
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
addTab(tab) {
|
||||
if (tab.name === 'default') {
|
||||
this.$refs.apiScenarioList.search();
|
||||
|
@ -188,6 +204,7 @@
|
|||
this.$warning(this.$t('commons.check_project_tip'));
|
||||
return;
|
||||
}
|
||||
this.currentModulePath = "";
|
||||
if (tab.name === 'add') {
|
||||
let label = this.$t('api_test.automation.add_scenario');
|
||||
let name = getUUID().substring(0, 8);
|
||||
|
@ -199,11 +216,14 @@
|
|||
};
|
||||
if (this.nodeTree && this.nodeTree.length > 0) {
|
||||
currentScenario.apiScenarioModuleId = this.nodeTree[0].id;
|
||||
currentScenario.modulePath = this.nodeTree[0].path;
|
||||
this.getPath(this.nodeTree[0].id, this.moduleOptions);
|
||||
currentScenario.modulePath = this.currentModulePath;
|
||||
}
|
||||
|
||||
if (this.selectNodeIds && this.selectNodeIds.length > 0) {
|
||||
currentScenario.apiScenarioModuleId = this.selectNodeIds[0];
|
||||
this.getPath(this.selectNodeIds[0], this.moduleOptions);
|
||||
currentScenario.modulePath = this.currentModulePath;
|
||||
}
|
||||
this.tabs.push({label: label, name: name, currentScenario: currentScenario});
|
||||
}
|
||||
|
|
|
@ -877,15 +877,11 @@
|
|||
this.reload();
|
||||
}
|
||||
},
|
||||
nodeExpand(data) {
|
||||
if (data.resourceId) {
|
||||
this.expandedNode.push(data.resourceId);
|
||||
}
|
||||
nodeExpand(data, node) {
|
||||
node.expanded = true;
|
||||
},
|
||||
nodeCollapse(data) {
|
||||
if (data.resourceId) {
|
||||
this.expandedNode.splice(this.expandedNode.indexOf(data.resourceId), 1);
|
||||
}
|
||||
nodeCollapse(data,node) {
|
||||
node.expanded = false;
|
||||
},
|
||||
setFiles(item, bodyUploadFiles, obj) {
|
||||
if (item.body) {
|
||||
|
|
|
@ -161,6 +161,7 @@
|
|||
import {API_CASE_LIST, API_LIST} from "@/common/js/constants";
|
||||
|
||||
import MockConfig from "@/business/components/api/definition/components/mock/MockConfig";
|
||||
|
||||
export default {
|
||||
name: "ApiDefinition",
|
||||
computed: {
|
||||
|
@ -228,7 +229,8 @@
|
|||
}],
|
||||
activeDom: "left",
|
||||
syncTabs: [],
|
||||
nodeTree: []
|
||||
nodeTree: [],
|
||||
currentModulePath: "",
|
||||
}
|
||||
},
|
||||
created() {
|
||||
|
@ -269,7 +271,21 @@
|
|||
},
|
||||
|
||||
methods: {
|
||||
|
||||
getPath(id, arr) {
|
||||
if (id === null) {
|
||||
return null;
|
||||
}
|
||||
if(arr) {
|
||||
arr.forEach(item => {
|
||||
if (item.id === id) {
|
||||
this.currentModulePath = item.path;
|
||||
}
|
||||
if (item.children && item.children.length > 0) {
|
||||
this.getPath(id, item.children);
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
changeRedirectParam(redirectIDParam) {
|
||||
this.redirectID = redirectIDParam;
|
||||
},
|
||||
|
@ -313,12 +329,17 @@
|
|||
status: "Underway", method: "GET", userId: getCurrentUser().id,
|
||||
url: "", protocol: this.currentProtocol, environmentId: "", moduleId: 'default-module', modulePath: "/" + this.$t("commons.module_title")
|
||||
};
|
||||
this.currentModulePath = "";
|
||||
if (this.nodeTree && this.nodeTree.length > 0) {
|
||||
api.moduleId = this.nodeTree[0].id;
|
||||
api.modulePath = this.nodeTree[0].path;
|
||||
this.getPath(this.nodeTree[0].id, this.moduleOptions);
|
||||
api.modulePath = this.currentModulePath;
|
||||
}
|
||||
|
||||
if (this.selectNodeIds && this.selectNodeIds.length > 0) {
|
||||
api.moduleId = this.selectNodeIds[0];
|
||||
this.getPath(this.selectNodeIds[0], this.moduleOptions);
|
||||
api.modulePath = this.currentModulePath;
|
||||
}
|
||||
this.handleTabsEdit(this.$t('api_test.definition.request.title'), e, api);
|
||||
},
|
||||
|
|
|
@ -65,7 +65,7 @@
|
|||
|
||||
<!-- 执行组件 -->
|
||||
<ms-run :debug="false" :environment="api.environment" :reportId="reportId" :run-data="runData" :env-map="envMap"
|
||||
@runRefresh="runRefresh" ref="runTest"/>
|
||||
@runRefresh="runRefresh" @errorRefresh="errorRefresh" ref="runTest"/>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
@ -144,6 +144,9 @@
|
|||
}
|
||||
})
|
||||
},
|
||||
errorRefresh(){
|
||||
this.loading = false;
|
||||
},
|
||||
runRefresh(data) {
|
||||
this.responseData = {type: 'HTTP', responseResult: {responseCode: ""}, subRequestResults: []};
|
||||
if (data) {
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
<api-environment-config ref="environmentConfig" @close="environmentConfigClose"/>
|
||||
<!-- 执行组件 -->
|
||||
<ms-run :debug="false" :environment="api.environment" :reportId="reportId" :run-data="runData"
|
||||
@runRefresh="runRefresh" ref="runTest"/>
|
||||
@runRefresh="runRefresh" @errorRefresh="errorRefresh" ref="runTest"/>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
@ -108,6 +108,9 @@ export default {
|
|||
refresh(){
|
||||
this.$emit('refresh');
|
||||
},
|
||||
errorRefresh(){
|
||||
this.loading = false;
|
||||
},
|
||||
runTest() {
|
||||
this.loading = true;
|
||||
this.api.request.name = this.api.id;
|
||||
|
|
Loading…
Reference in New Issue