fix(接口测试): 修复触发方式显示错误问题

--bug=1009180 --user=赵勇 【任务中心】测试计划里,手动点击执行按钮执行接口用例,显示了定时任务触发 https://www.tapd.cn/55049933/s/1086387
This commit is contained in:
fit2-zhao 2021-12-23 18:03:50 +08:00 committed by BugKing
parent 3d3ac62b03
commit 0d74d9aac9
5 changed files with 6 additions and 6 deletions

View File

@ -12,6 +12,7 @@ import io.metersphere.base.domain.ApiTestCaseWithBLOBs;
import io.metersphere.base.domain.ApiTestEnvironment;
import io.metersphere.commons.constants.NoticeConstants;
import io.metersphere.commons.constants.OperLogConstants;
import io.metersphere.commons.constants.ReportTriggerMode;
import io.metersphere.commons.utils.PageUtils;
import io.metersphere.commons.utils.Pager;
import io.metersphere.controller.request.ResetOrderRequest;
@ -192,6 +193,7 @@ public class ApiTestCaseController {
@PostMapping(value = "/batch/run")
@MsAuditLog(module = "api_definition_case", type = OperLogConstants.EXECUTE, content = "#msClass.getLogDetails(#request.caseId)", msClass = ApiTestCaseService.class)
public void batchRun(@RequestBody ApiCaseRunRequest request) {
request.setTriggerMode(ReportTriggerMode.BATCH.name());
apiTestCaseService.batchRun(request);
}

View File

@ -11,6 +11,7 @@ import java.util.List;
@Setter
public class ApiCaseRunRequest {
private String reportId;
private String triggerMode;
private String id;
private List<String> ids;
private List<OrderRequest> orders;

View File

@ -91,6 +91,7 @@ public class ApiExecuteService {
for (ApiTestCaseWithBLOBs caseWithBLOBs : list) {
ApiDefinitionExecResult report = ApiDefinitionExecResultUtil.initBase(caseWithBLOBs.getId(), APITestStatus.Running.name(), null);
report.setName(caseWithBLOBs.getName());
report.setTriggerMode(request.getTriggerMode());
caseWithBLOBs.setLastResultId(report.getId());
caseWithBLOBs.setUpdateTime(System.currentTimeMillis());
caseWithBLOBs.setStatus(APITestStatus.Running.name());

View File

@ -325,11 +325,7 @@ public class ApiDefinitionExecResultService {
saveResult.setId(reportId);
saveResult.setActuator("LOCAL");
saveResult.setName(item.getName());
if (StringUtils.equals(type, ApiRunMode.JENKINS_API_PLAN.name())) {
saveResult.setTriggerMode(TriggerMode.API.name());
} else if (StringUtils.equals(type, ApiRunMode.MANUAL_PLAN.name())) {
saveResult.setTriggerMode(TriggerMode.MANUAL.name());
} else {
if (StringUtils.equals(type, TriggerMode.SCHEDULE.name())) {
saveResult.setTriggerMode(TriggerMode.SCHEDULE.name());
}
saveResult.setType(type);

View File

@ -768,7 +768,7 @@ public class ApiTestCaseService {
//提前生成报告
ApiDefinitionExecResult report = ApiDefinitionExecResultUtil.add(caseWithBLOBs.getId(), APITestStatus.Running.name(), request.getReportId());
report.setName(caseWithBLOBs.getName());
report.setTriggerMode(ApiRunMode.API.name());
report.setTriggerMode(ApiRunMode.JENKINS.name());
report.setType(ApiRunMode.JENKINS.name());
apiDefinitionExecResultMapper.insert(report);
//更新接口案例的最后执行状态等信息