refactor(用例管理): 用例详情测试计划去重以及增加脑图覆盖率
This commit is contained in:
parent
c94c50a375
commit
009c0efbc8
|
@ -74,6 +74,7 @@
|
|||
<include refid="planFilters">
|
||||
<property name="filter" value="request.filter"/>
|
||||
</include>
|
||||
group by tpfc.test_plan_id
|
||||
</select>
|
||||
|
||||
<select id="getPlanExecuteHistoryList" resultType="io.metersphere.functional.dto.TestPlanCaseExecuteHistoryDTO">
|
||||
|
|
|
@ -11,6 +11,5 @@ public class FunctionalCaseMindRequest {
|
|||
private String projectId;
|
||||
|
||||
@Schema(description = "模块ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotBlank(message = "{file_module.id.not_blank}")
|
||||
private String moduleId;
|
||||
}
|
||||
|
|
|
@ -126,6 +126,9 @@ public class FunctionalCaseMinderService {
|
|||
public List<FunctionalMinderTreeDTO> getMindFunctionalCase(FunctionalCaseMindRequest request, boolean deleted) {
|
||||
List<FunctionalMinderTreeDTO> list = new ArrayList<>();
|
||||
//查出当前模块下的所有用例
|
||||
if (StringUtils.isBlank(request.getModuleId())) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
List<FunctionalCaseMindDTO> functionalCaseMindDTOList = extFunctionalCaseMapper.getMinderCaseList(request, deleted);
|
||||
//构造父子级数据
|
||||
buildList(functionalCaseMindDTOList, list);
|
||||
|
|
|
@ -55,11 +55,17 @@ public class FunctionalCaseMinderControllerTest extends BaseTest {
|
|||
public void testGetPageList() throws Exception {
|
||||
FunctionalCaseMindRequest request = new FunctionalCaseMindRequest();
|
||||
request.setProjectId("project-case-minder-test");
|
||||
request.setModuleId("TEST_MINDER_MODULE_ID_GYQ");
|
||||
MvcResult mvcResultPage = this.requestPostWithOkAndReturn(FUNCTIONAL_CASE_LIST_URL, request);
|
||||
String contentAsString = mvcResultPage.getResponse().getContentAsString(StandardCharsets.UTF_8);
|
||||
ResultHolder resultHolder = JSON.parseObject(contentAsString, ResultHolder.class);
|
||||
Assertions.assertNotNull(resultHolder);
|
||||
request = new FunctionalCaseMindRequest();
|
||||
request.setProjectId("project-case-minder-test");
|
||||
request.setModuleId("TEST_MINDER_MODULE_ID_GYQ");
|
||||
mvcResultPage = this.requestPostWithOkAndReturn(FUNCTIONAL_CASE_LIST_URL, request);
|
||||
contentAsString = mvcResultPage.getResponse().getContentAsString(StandardCharsets.UTF_8);
|
||||
resultHolder = JSON.parseObject(contentAsString, ResultHolder.class);
|
||||
Assertions.assertNotNull(resultHolder);
|
||||
FunctionalCaseBlob functionalCaseBlob = new FunctionalCaseBlob();
|
||||
functionalCaseBlob.setId("TEST_FUNCTIONAL_MINDER_CASE_ID_2");
|
||||
functionalCaseBlob.setSteps(JSON.toJSONString(new ArrayList<>()).getBytes(StandardCharsets.UTF_8));
|
||||
|
@ -76,21 +82,25 @@ public class FunctionalCaseMinderControllerTest extends BaseTest {
|
|||
functionalCaseBlob6.setPrerequisite(StringUtils.EMPTY.getBytes(StandardCharsets.UTF_8));
|
||||
functionalCaseBlob6.setDescription(StringUtils.EMPTY.getBytes(StandardCharsets.UTF_8));
|
||||
functionalCaseBlobMapper.updateByPrimaryKeyWithBLOBs(functionalCaseBlob6);
|
||||
mvcResultPage = this.requestPostWithOkAndReturn(FUNCTIONAL_CASE_LIST_URL, request);
|
||||
contentAsString = mvcResultPage.getResponse().getContentAsString(StandardCharsets.UTF_8);
|
||||
resultHolder = JSON.parseObject(contentAsString, ResultHolder.class);
|
||||
Assertions.assertNotNull(resultHolder);
|
||||
List<FunctionalCaseStepDTO> list = new ArrayList<>();
|
||||
FunctionalCaseStepDTO functionalCaseStepDTO = new FunctionalCaseStepDTO();
|
||||
functionalCaseStepDTO.setId("12455");
|
||||
functionalCaseStepDTO.setNum(0);
|
||||
functionalCaseStepDTO.setDesc("步骤一");
|
||||
functionalCaseStepDTO.setDesc("");
|
||||
functionalCaseStepDTO.setResult("步骤一结果");
|
||||
list.add(functionalCaseStepDTO);
|
||||
functionalCaseStepDTO = new FunctionalCaseStepDTO();
|
||||
functionalCaseStepDTO.setId("12ddd455");
|
||||
functionalCaseStepDTO.setNum(1);
|
||||
functionalCaseStepDTO.setDesc("步骤二");
|
||||
functionalCaseStepDTO.setResult("步骤二结果");
|
||||
functionalCaseStepDTO.setResult("");
|
||||
list.add(functionalCaseStepDTO);
|
||||
String textDescription = "hahahahah,这是文本描述";
|
||||
String expectedResult = "文本描述的结果";
|
||||
String expectedResult = "";
|
||||
String prerequisite = "前置条件";
|
||||
String description = "备注";
|
||||
|
||||
|
@ -98,7 +108,7 @@ public class FunctionalCaseMinderControllerTest extends BaseTest {
|
|||
functionalCaseBlob.setId("TEST_FUNCTIONAL_MINDER_CASE_ID_2");
|
||||
functionalCaseBlob.setSteps(JSON.toJSONString(list).getBytes(StandardCharsets.UTF_8));
|
||||
functionalCaseBlob.setTextDescription(textDescription.getBytes(StandardCharsets.UTF_8));
|
||||
functionalCaseBlob.setExpectedResult(expectedResult.getBytes(StandardCharsets.UTF_8));
|
||||
functionalCaseBlob.setExpectedResult(null);
|
||||
functionalCaseBlob.setPrerequisite(prerequisite.getBytes(StandardCharsets.UTF_8));
|
||||
functionalCaseBlob.setDescription(description.getBytes(StandardCharsets.UTF_8));
|
||||
functionalCaseBlobMapper.updateByPrimaryKeyWithBLOBs(functionalCaseBlob);
|
||||
|
@ -106,10 +116,24 @@ public class FunctionalCaseMinderControllerTest extends BaseTest {
|
|||
functionalCaseBlob6.setId("TEST_FUNCTIONAL_MINDER_CASE_ID_1");
|
||||
functionalCaseBlob6.setSteps(JSON.toJSONString(list).getBytes(StandardCharsets.UTF_8));
|
||||
functionalCaseBlob6.setTextDescription(textDescription.getBytes(StandardCharsets.UTF_8));
|
||||
functionalCaseBlob6.setExpectedResult(expectedResult.getBytes(StandardCharsets.UTF_8));
|
||||
functionalCaseBlob6.setExpectedResult(null);
|
||||
functionalCaseBlob6.setPrerequisite(prerequisite.getBytes(StandardCharsets.UTF_8));
|
||||
functionalCaseBlob6.setDescription(description.getBytes(StandardCharsets.UTF_8));
|
||||
functionalCaseBlobMapper.updateByPrimaryKeyWithBLOBs(functionalCaseBlob6);
|
||||
mvcResultPage = this.requestPostWithOkAndReturn(FUNCTIONAL_CASE_LIST_URL, request);
|
||||
contentAsString = mvcResultPage.getResponse().getContentAsString(StandardCharsets.UTF_8);
|
||||
resultHolder = JSON.parseObject(contentAsString, ResultHolder.class);
|
||||
Assertions.assertNotNull(resultHolder);
|
||||
expectedResult = "文本描述的结果";
|
||||
functionalCaseBlob = new FunctionalCaseBlob();
|
||||
functionalCaseBlob.setId("TEST_FUNCTIONAL_MINDER_CASE_ID_2");
|
||||
functionalCaseBlob.setExpectedResult(expectedResult.getBytes(StandardCharsets.UTF_8));
|
||||
functionalCaseBlobMapper.updateByPrimaryKeyWithBLOBs(functionalCaseBlob);
|
||||
functionalCaseBlob6 = new FunctionalCaseBlob();
|
||||
functionalCaseBlob6.setId("TEST_FUNCTIONAL_MINDER_CASE_ID_1");
|
||||
functionalCaseBlob6.setExpectedResult(expectedResult.getBytes(StandardCharsets.UTF_8));
|
||||
functionalCaseBlobMapper.updateByPrimaryKeyWithBLOBs(functionalCaseBlob6);
|
||||
|
||||
|
||||
mvcResultPage = this.requestPostWithOkAndReturn(FUNCTIONAL_CASE_LIST_URL, request);
|
||||
contentAsString = mvcResultPage.getResponse().getContentAsString(StandardCharsets.UTF_8);
|
||||
|
|
|
@ -17,4 +17,5 @@ INSERT INTO project(id, num, organization_id, name, description, create_time, up
|
|||
|
||||
INSERT INTO test_plan_functional_case(id, test_plan_id, functional_case_id, create_time, create_user, last_exec_time, last_exec_result, pos)
|
||||
VALUES ('associate_case_plan_gyq_one','test_plan_associate_case_gyq_one', 'gyq_associate_function_case', UNIX_TIMESTAMP() * 1000, 'admin', UNIX_TIMESTAMP() * 1000, 'SUCCESS', 200),
|
||||
('associate_case_plan_gyq_three','test_plan_associate_case_gyq_one', 'gyq_associate_function_case', UNIX_TIMESTAMP() * 1000, 'admin', UNIX_TIMESTAMP() * 1000, 'SUCCESS', 200),
|
||||
('associate_case_plan_gyq_two','test_plan_associate_case_gyq_two', 'gyq_associate_function_case', UNIX_TIMESTAMP() * 1000, 'admin', UNIX_TIMESTAMP() * 1000, 'SUCCESS', 200);
|
Loading…
Reference in New Issue