feat(测试计划): 新增测试计划-用例详情-行内编辑执行状态
This commit is contained in:
parent
b769894a80
commit
bc4fed9553
|
@ -170,4 +170,12 @@ public class TestPlanFunctionalCaseController {
|
||||||
return testPlanFunctionalCaseService.getCaseExecHistory(request);
|
return testPlanFunctionalCaseService.getCaseExecHistory(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("/edit")
|
||||||
|
@Operation(summary = "测试计划-计划详情-功能用例-编辑执行结果")
|
||||||
|
@RequiresPermissions(PermissionConstants.TEST_PLAN_READ_UPDATE)
|
||||||
|
@CheckOwner(resourceId = "#request.getTestPlanId()", resourceType = "test_plan")
|
||||||
|
public void editFunctionalCase(@Validated @RequestBody TestPlanCaseEditRequest request) {
|
||||||
|
testPlanFunctionalCaseService.editFunctionalCase(request, SessionUtils.getUserId());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
package io.metersphere.plan.dto.request;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import jakarta.validation.constraints.NotBlank;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author wx
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class TestPlanCaseEditRequest implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Schema(description = "测试计划id",requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@NotBlank(message = "{test_plan.id.not_blank}")
|
||||||
|
private String testPlanId;
|
||||||
|
|
||||||
|
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@NotBlank(message = "{id.not_blank}")
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
@Schema(description = "最终执行结果")
|
||||||
|
@NotBlank(message = "{test_plan.last_exec_result.not_blank}")
|
||||||
|
private String lastExecResult;
|
||||||
|
|
||||||
|
}
|
|
@ -567,4 +567,31 @@ public class TestPlanFunctionalCaseService extends TestPlanResourceService {
|
||||||
});
|
});
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void editFunctionalCase(TestPlanCaseEditRequest request, String userId) {
|
||||||
|
TestPlanFunctionalCase planFunctionalCase = testPlanFunctionalCaseMapper.selectByPrimaryKey(request.getId());
|
||||||
|
TestPlanFunctionalCase functionalCase = new TestPlanFunctionalCase();
|
||||||
|
functionalCase.setId(request.getId());
|
||||||
|
functionalCase.setLastExecResult(request.getLastExecResult());
|
||||||
|
functionalCase.setLastExecTime(System.currentTimeMillis());
|
||||||
|
testPlanFunctionalCaseMapper.updateByPrimaryKeySelective(functionalCase);
|
||||||
|
|
||||||
|
updateFunctionalCaseStatus(Arrays.asList(planFunctionalCase.getFunctionalCaseId()), request.getLastExecResult());
|
||||||
|
|
||||||
|
//执行历史
|
||||||
|
TestPlanCaseExecuteHistory executeHistory = new TestPlanCaseExecuteHistory();
|
||||||
|
executeHistory.setId(IDGenerator.nextStr());
|
||||||
|
executeHistory.setTestPlanCaseId(planFunctionalCase.getId());
|
||||||
|
executeHistory.setCaseId(planFunctionalCase.getFunctionalCaseId());
|
||||||
|
executeHistory.setStatus(request.getLastExecResult());
|
||||||
|
executeHistory.setDeleted(false);
|
||||||
|
executeHistory.setCreateUser(userId);
|
||||||
|
executeHistory.setCreateTime(System.currentTimeMillis());
|
||||||
|
testPlanCaseExecuteHistoryMapper.insert(executeHistory);
|
||||||
|
|
||||||
|
//通知
|
||||||
|
handleFileAndNotice(planFunctionalCase.getFunctionalCaseId(), null, null, userId, null, null, request.getTestPlanId(), request.getLastExecResult());
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,6 +44,7 @@ public class TestPlanCaseControllerTests extends BaseTest {
|
||||||
public static final String FUNCTIONAL_CASE_BATCH_RUN_URL = "/test-plan/functional/case/batch/run";
|
public static final String FUNCTIONAL_CASE_BATCH_RUN_URL = "/test-plan/functional/case/batch/run";
|
||||||
public static final String FUNCTIONAL_CASE_BATCH_UPDATE_EXECUTOR_URL = "/test-plan/functional/case/batch/update/executor";
|
public static final String FUNCTIONAL_CASE_BATCH_UPDATE_EXECUTOR_URL = "/test-plan/functional/case/batch/update/executor";
|
||||||
public static final String FUNCTIONAL_CASE_EXEC_HISTORY_URL = "/test-plan/functional/case/exec/history";
|
public static final String FUNCTIONAL_CASE_EXEC_HISTORY_URL = "/test-plan/functional/case/exec/history";
|
||||||
|
public static final String FUNCTIONAL_CASE_EDIT_URL = "/test-plan/functional/case/edit";
|
||||||
@Resource
|
@Resource
|
||||||
private TestPlanFunctionalCaseMapper testPlanFunctionalCaseMapper;
|
private TestPlanFunctionalCaseMapper testPlanFunctionalCaseMapper;
|
||||||
@Resource
|
@Resource
|
||||||
|
@ -239,4 +240,15 @@ public class TestPlanCaseControllerTests extends BaseTest {
|
||||||
request.setCaseId("fc_1");
|
request.setCaseId("fc_1");
|
||||||
this.requestPostWithOk(FUNCTIONAL_CASE_EXEC_HISTORY_URL, request);
|
this.requestPostWithOk(FUNCTIONAL_CASE_EXEC_HISTORY_URL, request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Order(15)
|
||||||
|
public void testFunctionalCaseEdit() throws Exception {
|
||||||
|
TestPlanCaseEditRequest request = new TestPlanCaseEditRequest();
|
||||||
|
request.setId("relate_case_1");
|
||||||
|
request.setTestPlanId("plan_1");
|
||||||
|
request.setLastExecResult("SUCCESS");
|
||||||
|
this.requestPostWithOk(FUNCTIONAL_CASE_EDIT_URL, request);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue