fix:用例和场景的请求参数显示优化 post请求 默认选中请求体 get和delete默认选中QUERY参数

This commit is contained in:
wenyann 2021-06-09 17:47:07 +08:00 committed by 刘瑞斌
parent 648b9a930f
commit 056f5cf1a8
5 changed files with 24 additions and 13 deletions

View File

@ -160,6 +160,6 @@ public class TestPlanController {
api.setMode(testplanRunRequest.getMode()); api.setMode(testplanRunRequest.getMode());
api.setResourcePoolId(testplanRunRequest.getResourcePoolId()); api.setResourcePoolId(testplanRunRequest.getResourcePoolId());
String apiRunConfig = JSONObject.toJSONString(api); String apiRunConfig = JSONObject.toJSONString(api);
testPlanService.run(testplanRunRequest.getTestPlanID(), testplanRunRequest.getProjectID(), testplanRunRequest.getUserId(), testplanRunRequest.getTriggerMode(), apiRunConfig); testPlanService.run(testplanRunRequest.getTestPlanId(), testplanRunRequest.getProjectId(), testplanRunRequest.getUserId(), testplanRunRequest.getTriggerMode(), apiRunConfig);
} }
} }

View File

@ -7,14 +7,14 @@ import lombok.Setter;
@Getter @Getter
@Setter @Setter
public class TestplanRunRequest { public class TestplanRunRequest {
private String testPlanID; private String testPlanId;
private String projectID; private String projectId;
private String userId; private String userId;
private String triggerMode; private String triggerMode;//触发方式
private String mode; private String mode;//运行模式
private String reportType; private String reportType;//报告展示方式
private String onSampleError; private String onSampleError;//是否失败停止
private String runWithinResourcePool; private String runWithinResourcePool;//是否选择资源池
private String resourcePoolId; private String resourcePoolId;//资源池Id
} }

View File

@ -382,7 +382,7 @@ public class TestPlanReportService {
testPlanMapper.updateByPrimaryKeySelective(testPlan); testPlanMapper.updateByPrimaryKeySelective(testPlan);
} }
if (StringUtils.equalsAny(report.getTriggerMode(), ReportTriggerMode.SCHEDULE.name())) { if (StringUtils.equals(report.getTriggerMode(), ReportTriggerMode.API.name()) || StringUtils.equals(report.getTriggerMode(), ReportTriggerMode.SCHEDULE.name())) {
//发送通知 //发送通知
sendMessage(report); sendMessage(report);
} }

View File

@ -1058,7 +1058,11 @@ public class TestPlanService {
RunTestPlanRequest performanceRequest = new RunTestPlanRequest(); RunTestPlanRequest performanceRequest = new RunTestPlanRequest();
performanceRequest.setId(caseID); performanceRequest.setId(caseID);
performanceRequest.setTestPlanLoadId(caseID); performanceRequest.setTestPlanLoadId(caseID);
performanceRequest.setTriggerMode(ReportTriggerMode.TEST_PLAN_SCHEDULE.name()); if (StringUtils.equals(ReportTriggerMode.API.name(), triggerMode)) {
performanceRequest.setTriggerMode(ReportTriggerMode.API.name());
} else {
performanceRequest.setTriggerMode(ReportTriggerMode.TEST_PLAN_SCHEDULE.name());
}
String reportId = null; String reportId = null;
try { try {
reportId = performanceTestService.run(performanceRequest); reportId = performanceTestService.run(performanceRequest);
@ -1091,6 +1095,7 @@ public class TestPlanService {
if (!performaneReportIDList.isEmpty()) { if (!performaneReportIDList.isEmpty()) {
//性能测试时保存性能测试报告ID在结果返回时用于捕捉并进行 //性能测试时保存性能测试报告ID在结果返回时用于捕捉并进行
testPlanReportService.updatePerformanceInfo(testPlanReport, performaneReportIDList, ReportTriggerMode.SCHEDULE.name()); testPlanReportService.updatePerformanceInfo(testPlanReport, performaneReportIDList, ReportTriggerMode.SCHEDULE.name());
} }
@ -1114,7 +1119,11 @@ public class TestPlanService {
scenarioRequest.setId(senarionReportID); scenarioRequest.setId(senarionReportID);
scenarioRequest.setReportId(senarionReportID); scenarioRequest.setReportId(senarionReportID);
scenarioRequest.setProjectId(projectID); scenarioRequest.setProjectId(projectID);
scenarioRequest.setTriggerMode(ReportTriggerMode.SCHEDULE.name()); if (StringUtils.equals(triggerMode, ReportTriggerMode.API.name())) {
scenarioRequest.setTriggerMode(ReportTriggerMode.API.name());
} else {
scenarioRequest.setTriggerMode(ReportTriggerMode.SCHEDULE.name());
}
scenarioRequest.setExecuteType(ExecuteType.Saved.name()); scenarioRequest.setExecuteType(ExecuteType.Saved.name());
Map<String, Map<String, String>> testPlanScenarioIdMap = new HashMap<>(); Map<String, Map<String, String>> testPlanScenarioIdMap = new HashMap<>();
testPlanScenarioIdMap.put(testPlanID, planScenarioIdMap); testPlanScenarioIdMap.put(testPlanID, planScenarioIdMap);

View File

@ -110,6 +110,7 @@
MsApiAssertions MsApiAssertions
}, },
props: { props: {
method: String,
request: {}, request: {},
response: {}, response: {},
showScript: { showScript: {
@ -144,7 +145,7 @@
} }
}; };
return { return {
activeName: "headers", activeName: this.request.method === "POST" ? "body" : "parameters",
rules: { rules: {
name: [ name: [
{max: 300, message: this.$t('commons.input_limit', [1, 300]), trigger: 'blur'} {max: 300, message: this.$t('commons.input_limit', [1, 300]), trigger: 'blur'}
@ -187,6 +188,7 @@
}) })
}, },
init() { init() {
if (!this.request.body) { if (!this.request.body) {
this.request.body = new Body(); this.request.body = new Body();
} }