feat(用例管理): 测试计划脑图最终结果节点
This commit is contained in:
parent
455a85e98e
commit
d7d10f5f05
|
@ -21,6 +21,8 @@ public class FunctionalCaseManageInterceptor {
|
||||||
configList.add(new MybatisInterceptorConfig(FunctionalCaseMindDTO.class, "expectedResult", CompressUtils.class, "zip", "unzip"));
|
configList.add(new MybatisInterceptorConfig(FunctionalCaseMindDTO.class, "expectedResult", CompressUtils.class, "zip", "unzip"));
|
||||||
configList.add(new MybatisInterceptorConfig(FunctionalCaseMindDTO.class, "prerequisite", CompressUtils.class, "zip", "unzip"));
|
configList.add(new MybatisInterceptorConfig(FunctionalCaseMindDTO.class, "prerequisite", CompressUtils.class, "zip", "unzip"));
|
||||||
configList.add(new MybatisInterceptorConfig(FunctionalCaseMindDTO.class, "description", CompressUtils.class, "zip", "unzip"));
|
configList.add(new MybatisInterceptorConfig(FunctionalCaseMindDTO.class, "description", CompressUtils.class, "zip", "unzip"));
|
||||||
|
configList.add(new MybatisInterceptorConfig(FunctionalCaseMindDTO.class, "content", CompressUtils.class, "zip", "unzip"));
|
||||||
|
|
||||||
|
|
||||||
return configList;
|
return configList;
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,5 +78,6 @@ public class FunctionalCaseMindDTO {
|
||||||
@Schema(description = "备注")
|
@Schema(description = "备注")
|
||||||
private byte[] description;
|
private byte[] description;
|
||||||
|
|
||||||
|
@Schema(description = "执行评论")
|
||||||
|
private byte[] content;
|
||||||
}
|
}
|
||||||
|
|
|
@ -880,12 +880,12 @@
|
||||||
fc.name as name,
|
fc.name as name,
|
||||||
fc.id as caseId,
|
fc.id as caseId,
|
||||||
fc.project_id, fc.template_id, fc.pos, fc.case_edit_type,
|
fc.project_id, fc.template_id, fc.pos, fc.case_edit_type,
|
||||||
IFNULL(history.`steps`, fcb.steps) as steps, execute_history.`steps` as executeSteps, fcb.text_description, fcb.expected_result, fcb.prerequisite, fcb.description
|
IFNULL(history.`steps`, fcb.steps) as steps, execute_history.`steps` as executeSteps, fcb.text_description, fcb.expected_result, fcb.prerequisite, fcb.description, history.`content`
|
||||||
FROM
|
FROM
|
||||||
test_plan_functional_case tpfc
|
test_plan_functional_case tpfc
|
||||||
LEFT JOIN functional_case fc ON tpfc.functional_case_id = fc.id
|
LEFT JOIN functional_case fc ON tpfc.functional_case_id = fc.id
|
||||||
LEFT JOIN functional_case_blob fcb ON fcb.id = fc.id
|
LEFT JOIN functional_case_blob fcb ON fcb.id = fc.id
|
||||||
LEFT JOIN (select * from (SELECT tpceh.test_plan_case_id, tpceh.`status`,tpceh.`steps`, ROW_NUMBER() OVER (PARTITION BY tpceh.test_plan_case_id ORDER BY tpceh.create_time DESC) as rn from test_plan_case_execute_history tpceh where tpceh.test_plan_id = #{request.planId} and tpceh.deleted = false
|
LEFT JOIN (select * from (SELECT tpceh.test_plan_case_id, tpceh.`status`,tpceh.`steps`, tpceh.`content`, ROW_NUMBER() OVER (PARTITION BY tpceh.test_plan_case_id ORDER BY tpceh.create_time DESC) as rn from test_plan_case_execute_history tpceh where tpceh.test_plan_id = #{request.planId} and tpceh.deleted = false
|
||||||
|
|
||||||
order by tpceh.create_time desc ) as history_filter WHERE rn = 1 ) as history ON history.test_plan_case_id = tpfc.id
|
order by tpceh.create_time desc ) as history_filter WHERE rn = 1 ) as history ON history.test_plan_case_id = tpfc.id
|
||||||
LEFT JOIN (select * from (SELECT tpceh.test_plan_case_id, tpceh.`status`,tpceh.`steps`, ROW_NUMBER() OVER (PARTITION BY tpceh.test_plan_case_id ORDER BY tpceh.create_time DESC) as rn from test_plan_case_execute_history tpceh where tpceh.test_plan_id = #{request.planId} and tpceh.deleted = false and tpceh.steps IS NOT NULL
|
LEFT JOIN (select * from (SELECT tpceh.test_plan_case_id, tpceh.`status`,tpceh.`steps`, ROW_NUMBER() OVER (PARTITION BY tpceh.test_plan_case_id ORDER BY tpceh.create_time DESC) as rn from test_plan_case_execute_history tpceh where tpceh.test_plan_id = #{request.planId} and tpceh.deleted = false and tpceh.steps IS NOT NULL
|
||||||
|
|
|
@ -310,16 +310,15 @@ public class FunctionalCaseFileService {
|
||||||
if (StringUtils.isEmpty(request.getVersionId())) {
|
if (StringUtils.isEmpty(request.getVersionId())) {
|
||||||
request.setVersionId(extBaseProjectVersionMapper.getDefaultVersion(request.getProjectId()));
|
request.setVersionId(extBaseProjectVersionMapper.getDefaultVersion(request.getProjectId()));
|
||||||
}
|
}
|
||||||
Long nextPos = functionalCaseService.getNextOrder(request.getProjectId());
|
Long lasePos = 0L;
|
||||||
Long lasePos = nextPos + ((long) ServiceUtils.POS_STEP * Integer.parseInt(request.getCount()));
|
|
||||||
//获取当前项目默认模板的自定义字段
|
//获取当前项目默认模板的自定义字段
|
||||||
List<TemplateCustomFieldDTO> customFields = getCustomFields(request.getProjectId());
|
List<TemplateCustomFieldDTO> customFields = getCustomFields(request.getProjectId());
|
||||||
XMindCaseParser xMindParser = new XMindCaseParser(request, customFields, user, lasePos);
|
XMindCaseParser xMindParser = new XMindCaseParser(request, customFields, user, lasePos);
|
||||||
errList = xMindParser.parse(multipartFile);
|
errList = xMindParser.parse(multipartFile);
|
||||||
xMindParser.clear();
|
|
||||||
response.setErrorMessages(errList);
|
response.setErrorMessages(errList);
|
||||||
response.setSuccessCount(xMindParser.getList().size() + xMindParser.getUpdateList().size());
|
response.setSuccessCount(xMindParser.getList().size() + xMindParser.getUpdateList().size());
|
||||||
response.setFailCount(errList.size());
|
response.setFailCount(errList.size());
|
||||||
|
xMindParser.clear();
|
||||||
return response;
|
return response;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LogUtils.error("checkImportExcel error", e);
|
LogUtils.error("checkImportExcel error", e);
|
||||||
|
@ -393,10 +392,10 @@ public class FunctionalCaseFileService {
|
||||||
errList.add(excelErrData);
|
errList.add(excelErrData);
|
||||||
}
|
}
|
||||||
xmindParser.saveData();
|
xmindParser.saveData();
|
||||||
xmindParser.clear();
|
|
||||||
response.setErrorMessages(errList);
|
response.setErrorMessages(errList);
|
||||||
response.setSuccessCount(xmindParser.getList().size() + xmindParser.getUpdateList().size());
|
response.setSuccessCount(xmindParser.getList().size() + xmindParser.getUpdateList().size());
|
||||||
response.setFailCount(errList.size());
|
response.setFailCount(errList.size());
|
||||||
|
xmindParser.clear();
|
||||||
return response;
|
return response;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LogUtils.error("checkImportExcel error", e);
|
LogUtils.error("checkImportExcel error", e);
|
||||||
|
|
|
@ -252,6 +252,16 @@ public class FunctionalCaseMinderService {
|
||||||
children.add(descriptionFunctionalMinderTreeDTO);
|
children.add(descriptionFunctionalMinderTreeDTO);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (addActualResult) {
|
||||||
|
String contentText = StringUtils.EMPTY;
|
||||||
|
if (functionalCaseMindDTO.getContent() != null ) {
|
||||||
|
contentText = new String(functionalCaseMindDTO.getContent(), StandardCharsets.UTF_8);
|
||||||
|
}
|
||||||
|
FunctionalMinderTreeDTO contentFunctionalMinderTreeDTO = getFunctionalMinderTreeDTO(StringUtils.isBlank(contentText) ? StringUtils.EMPTY : contentText, Translator.get("minder_extra_node.steps_actual_result"), (long) (i + 1));
|
||||||
|
children.add(contentFunctionalMinderTreeDTO);
|
||||||
|
}
|
||||||
|
|
||||||
return children;
|
return children;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,7 @@
|
||||||
package io.metersphere.functional.controller;
|
package io.metersphere.functional.controller;
|
||||||
|
|
||||||
import io.metersphere.functional.domain.*;
|
import io.metersphere.functional.domain.*;
|
||||||
import io.metersphere.functional.dto.CaseCustomFieldDTO;
|
import io.metersphere.functional.dto.*;
|
||||||
import io.metersphere.functional.dto.FunctionalCaseStepDTO;
|
|
||||||
import io.metersphere.functional.dto.FunctionalMinderTreeDTO;
|
|
||||||
import io.metersphere.functional.dto.MinderOptionDTO;
|
|
||||||
import io.metersphere.functional.mapper.*;
|
import io.metersphere.functional.mapper.*;
|
||||||
import io.metersphere.functional.request.*;
|
import io.metersphere.functional.request.*;
|
||||||
import io.metersphere.plan.domain.TestPlanCaseExecuteHistory;
|
import io.metersphere.plan.domain.TestPlanCaseExecuteHistory;
|
||||||
|
@ -413,6 +410,7 @@ public class FunctionalCaseMinderControllerTest extends BaseTest {
|
||||||
@Test
|
@Test
|
||||||
@Order(5)
|
@Order(5)
|
||||||
public void testGetCasePlanList() throws Exception {
|
public void testGetCasePlanList() throws Exception {
|
||||||
|
String content = "执行评论";
|
||||||
FunctionalCasePlanMindRequest request = new FunctionalCasePlanMindRequest();
|
FunctionalCasePlanMindRequest request = new FunctionalCasePlanMindRequest();
|
||||||
request.setProjectId("project-case-minder-test");
|
request.setProjectId("project-case-minder-test");
|
||||||
request.setModuleId("TEST_MINDER_MODULE_ID_GYQ4");
|
request.setModuleId("TEST_MINDER_MODULE_ID_GYQ4");
|
||||||
|
@ -443,6 +441,7 @@ public class FunctionalCaseMinderControllerTest extends BaseTest {
|
||||||
functionalCaseStepDTO.setExecuteResult("BLOCKED");
|
functionalCaseStepDTO.setExecuteResult("BLOCKED");
|
||||||
list.add(functionalCaseStepDTO);
|
list.add(functionalCaseStepDTO);
|
||||||
executeHistory.setSteps(JSON.toJSONString(list).getBytes(StandardCharsets.UTF_8));
|
executeHistory.setSteps(JSON.toJSONString(list).getBytes(StandardCharsets.UTF_8));
|
||||||
|
executeHistory.setContent(content.getBytes());
|
||||||
executeHistory.setDeleted(false);
|
executeHistory.setDeleted(false);
|
||||||
executeHistory.setNotifier("admin");
|
executeHistory.setNotifier("admin");
|
||||||
executeHistory.setCreateUser("admin");
|
executeHistory.setCreateUser("admin");
|
||||||
|
@ -450,14 +449,13 @@ public class FunctionalCaseMinderControllerTest extends BaseTest {
|
||||||
testPlanCaseExecuteHistoryMapper.insert(executeHistory);
|
testPlanCaseExecuteHistoryMapper.insert(executeHistory);
|
||||||
TestPlanCaseExecuteHistory testPlanCaseExecuteHistory = testPlanCaseExecuteHistoryMapper.selectByPrimaryKey(nextStr);
|
TestPlanCaseExecuteHistory testPlanCaseExecuteHistory = testPlanCaseExecuteHistoryMapper.selectByPrimaryKey(nextStr);
|
||||||
Assertions.assertNotNull(testPlanCaseExecuteHistory);
|
Assertions.assertNotNull(testPlanCaseExecuteHistory);
|
||||||
String prerequisiteText = new String(testPlanCaseExecuteHistory.getSteps(), StandardCharsets.UTF_8);
|
|
||||||
MvcResult mvcResultPage = this.requestPostWithOkAndReturn(FUNCTIONAL_CASE_PLAN_LIST_URL, request);
|
MvcResult mvcResultPage = this.requestPostWithOkAndReturn(FUNCTIONAL_CASE_PLAN_LIST_URL, request);
|
||||||
Pager<List<FunctionalMinderTreeDTO>> tableData = JSON.parseObject(JSON.toJSONString(
|
Pager<List<FunctionalMinderTreeDTO>> tableData = JSON.parseObject(JSON.toJSONString(
|
||||||
JSON.parseObject(mvcResultPage.getResponse().getContentAsString(StandardCharsets.UTF_8), ResultHolder.class).getData()),
|
JSON.parseObject(mvcResultPage.getResponse().getContentAsString(StandardCharsets.UTF_8), ResultHolder.class).getData()),
|
||||||
Pager.class);
|
Pager.class);
|
||||||
Assertions.assertNotNull(tableData.getList());
|
Assertions.assertNotNull(tableData.getList());
|
||||||
Assertions.assertEquals(2, tableData.getList().size());
|
Assertions.assertEquals(2, tableData.getList().size());
|
||||||
// System.out.println(JSON.toJSONString(tableData.getList()));
|
//System.out.println(JSON.toJSONString(tableData.getList()));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue