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