refactor(功能用例): 用例详情增加返回值
This commit is contained in:
parent
e7635483dc
commit
bca630ecf6
|
@ -50,6 +50,9 @@ public class FunctionalCaseDetailDTO implements Serializable {
|
|||
@Schema(description = "版本")
|
||||
private String versionId;
|
||||
|
||||
@Schema(description = "版本名称")
|
||||
private String versionName;
|
||||
|
||||
@Schema(description = "是否是公共用例库")
|
||||
private Boolean publicCase;
|
||||
|
||||
|
@ -59,6 +62,9 @@ public class FunctionalCaseDetailDTO implements Serializable {
|
|||
@Schema(description = "创建人")
|
||||
private String createUser;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
private Long createTime;
|
||||
|
||||
@Schema(description = "用例步骤(JSON),step_model 为 Step 时启用")
|
||||
private String steps;
|
||||
|
||||
|
@ -82,4 +88,7 @@ public class FunctionalCaseDetailDTO implements Serializable {
|
|||
|
||||
@Schema(description = "关注标识")
|
||||
private Boolean followFlag;
|
||||
|
||||
@Schema(description = "用例等级")
|
||||
private String functionalPriority;
|
||||
}
|
||||
|
|
|
@ -19,6 +19,9 @@ public class ReviewFunctionalCaseDTO implements Serializable {
|
|||
@Schema(description = "id")
|
||||
private String id;
|
||||
|
||||
@Schema(description = "业务id")
|
||||
private String num;
|
||||
|
||||
@Schema(description = "用例名称")
|
||||
private String name;
|
||||
|
||||
|
|
|
@ -37,7 +37,8 @@
|
|||
crfc.create_time as createTime,
|
||||
functional_case.version_id as versionId,
|
||||
functional_case.module_id as moduleId,
|
||||
functional_case.name as name
|
||||
functional_case.name as name,
|
||||
functional_case.num as num
|
||||
FROM
|
||||
case_review_functional_case crfc
|
||||
LEFT JOIN functional_case ON crfc.case_id = functional_case.id
|
||||
|
@ -108,7 +109,7 @@
|
|||
<foreach collection="${filter}.entrySet()" index="key" item="values">
|
||||
<if test="values != null and values.size() > 0">
|
||||
<choose>
|
||||
<when test="key=='review_status'">
|
||||
<when test="key=='status'">
|
||||
case_review_functional_case.review_status in
|
||||
<include refid="io.metersphere.system.mapper.BaseMapper.filterInWrapper"/>
|
||||
<include refid="queryType">
|
||||
|
|
|
@ -11,6 +11,7 @@ import io.metersphere.functional.mapper.FunctionalCaseMapper;
|
|||
import io.metersphere.functional.request.*;
|
||||
import io.metersphere.functional.result.CaseManagementResultCode;
|
||||
import io.metersphere.project.domain.FileAssociation;
|
||||
import io.metersphere.project.domain.ProjectVersion;
|
||||
import io.metersphere.project.dto.ModuleCountDTO;
|
||||
import io.metersphere.project.mapper.ExtBaseProjectVersionMapper;
|
||||
import io.metersphere.project.service.ProjectTemplateService;
|
||||
|
@ -21,6 +22,7 @@ import io.metersphere.sdk.constants.TemplateScene;
|
|||
import io.metersphere.sdk.exception.MSException;
|
||||
import io.metersphere.sdk.util.BeanUtils;
|
||||
import io.metersphere.sdk.util.JSON;
|
||||
import io.metersphere.sdk.util.Translator;
|
||||
import io.metersphere.system.dto.sdk.TemplateCustomFieldDTO;
|
||||
import io.metersphere.system.dto.sdk.TemplateDTO;
|
||||
import io.metersphere.system.dto.sdk.request.PosRequest;
|
||||
|
@ -220,6 +222,11 @@ public class FunctionalCaseService {
|
|||
//获取附件信息
|
||||
functionalCaseAttachmentService.getAttachmentInfo(functionalCaseDetailDTO);
|
||||
|
||||
List<ProjectVersion> versions = extBaseProjectVersionMapper.getVersionByIds(List.of(functionalCaseDetailDTO.getVersionId()));
|
||||
if (CollectionUtils.isNotEmpty(versions)) {
|
||||
functionalCaseDetailDTO.setVersionName(versions.get(0).getName());
|
||||
}
|
||||
|
||||
return functionalCaseDetailDTO;
|
||||
|
||||
}
|
||||
|
@ -262,8 +269,12 @@ public class FunctionalCaseService {
|
|||
FunctionalCaseCustomField caseCustomField = functionalCaseCustomFieldService.getCustomField(item.getFieldId(), functionalCase.getId());
|
||||
Optional.ofNullable(caseCustomField).ifPresentOrElse(customField -> {
|
||||
item.setDefaultValue(customField.getValue());
|
||||
if (Translator.get("custom_field.functional_priority").equals(item.getFieldName())) {
|
||||
functionalCaseDetailDTO.setFunctionalPriority(customField.getValue());
|
||||
}
|
||||
}, () -> {
|
||||
});
|
||||
|
||||
});
|
||||
functionalCaseDetailDTO.setCustomFields(customFields);
|
||||
}
|
||||
|
@ -405,7 +416,7 @@ public class FunctionalCaseService {
|
|||
doDelete(ids, userId);
|
||||
}
|
||||
param.put(CaseEvent.Param.USER_ID, userId);
|
||||
param.put(CaseEvent.Param.EVENT_NAME,CaseEvent.Event.DELETE_FUNCTIONAL_CASE);
|
||||
param.put(CaseEvent.Param.EVENT_NAME, CaseEvent.Event.DELETE_FUNCTIONAL_CASE);
|
||||
provider.updateCaseReview(param);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,21 +1,27 @@
|
|||
package io.metersphere.functional.controller;
|
||||
|
||||
import io.metersphere.functional.domain.FunctionalCase;
|
||||
import io.metersphere.functional.domain.FunctionalCaseCustomField;
|
||||
import io.metersphere.functional.dto.CaseCustomFieldDTO;
|
||||
import io.metersphere.functional.dto.FunctionalCasePageDTO;
|
||||
import io.metersphere.functional.mapper.FunctionalCaseCustomFieldMapper;
|
||||
import io.metersphere.functional.request.*;
|
||||
import io.metersphere.functional.result.CaseManagementResultCode;
|
||||
import io.metersphere.functional.utils.FileBaseUtils;
|
||||
import io.metersphere.project.domain.Notification;
|
||||
import io.metersphere.project.domain.NotificationExample;
|
||||
import io.metersphere.project.mapper.NotificationMapper;
|
||||
import io.metersphere.project.service.ProjectTemplateService;
|
||||
import io.metersphere.sdk.constants.CustomFieldType;
|
||||
import io.metersphere.sdk.constants.TemplateScene;
|
||||
import io.metersphere.sdk.constants.TemplateScopeType;
|
||||
import io.metersphere.sdk.util.JSON;
|
||||
import io.metersphere.sdk.util.Translator;
|
||||
import io.metersphere.system.base.BaseTest;
|
||||
import io.metersphere.system.controller.handler.ResultHolder;
|
||||
import io.metersphere.system.domain.CustomField;
|
||||
import io.metersphere.system.dto.sdk.TemplateCustomFieldDTO;
|
||||
import io.metersphere.system.dto.sdk.TemplateDTO;
|
||||
import io.metersphere.system.dto.sdk.request.PosRequest;
|
||||
import io.metersphere.system.mapper.CustomFieldMapper;
|
||||
import io.metersphere.system.notice.constants.NoticeConstants;
|
||||
|
@ -60,6 +66,10 @@ public class FunctionalCaseControllerTests extends BaseTest {
|
|||
|
||||
@Resource
|
||||
private CustomFieldMapper customFieldMapper;
|
||||
@Resource
|
||||
private ProjectTemplateService projectTemplateService;
|
||||
@Resource
|
||||
private FunctionalCaseCustomFieldMapper functionalCaseCustomFieldMapper;
|
||||
|
||||
@Test
|
||||
@Order(1)
|
||||
|
@ -132,6 +142,21 @@ public class FunctionalCaseControllerTests extends BaseTest {
|
|||
ResultHolder resultHolder = JSON.parseObject(returnData, ResultHolder.class);
|
||||
// 返回请求正常
|
||||
Assertions.assertNotNull(resultHolder);
|
||||
this.requestGetWithOkAndReturn(FUNCTIONAL_CASE_DETAIL_URL + "TEST_FUNCTIONAL_CASE_ID_2");
|
||||
|
||||
//增加覆盖率
|
||||
TemplateDTO templateDTO = projectTemplateService.getTemplateDTOById("21312", "100001100001", TemplateScene.FUNCTIONAL.name());
|
||||
List<TemplateCustomFieldDTO> customFields = templateDTO.getCustomFields();
|
||||
customFields.forEach(item ->{
|
||||
if (Translator.get("custom_field.functional_priority").equals(item.getFieldName())) {
|
||||
FunctionalCaseCustomField functionalCaseCustomField = new FunctionalCaseCustomField();
|
||||
functionalCaseCustomField.setCaseId("TEST_FUNCTIONAL_CASE_ID_3");
|
||||
functionalCaseCustomField.setFieldId(item.getFieldId());
|
||||
functionalCaseCustomField.setValue("P3");
|
||||
functionalCaseCustomFieldMapper.insertSelective(functionalCaseCustomField);
|
||||
}
|
||||
});
|
||||
this.requestGetWithOkAndReturn(FUNCTIONAL_CASE_DETAIL_URL + "TEST_FUNCTIONAL_CASE_ID_3");
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ INSERT INTO functional_case(id, num, module_id, project_id, template_id, name, r
|
|||
VALUES ('TEST_FUNCTIONAL_CASE_ID_1', 2, 'TEST_MODULE_ID_GYQ', '100001100001', '100001', '测试多版本', 'UN_REVIEWED', '["测试标签_1"]', 'STEP', 5000, 'v1.0.0', 'TEST_REF_ID', 'UN_EXECUTED', b'0', b'0', b'1', 'admin', 'admin', '', 1698058347559, 1698058347559, NULL);
|
||||
|
||||
INSERT INTO functional_case(id, num, module_id, project_id, template_id, name, review_status, tags, case_edit_type, pos, version_id, ref_id, last_execute_result, deleted, public_case, latest, create_user, update_user, delete_user, create_time, update_time, delete_time)
|
||||
VALUES ('TEST_FUNCTIONAL_CASE_ID_2', 3, 'TEST_MODULE_ID_GYQ', '100001100001', '100001', 'copy_测试多版本', 'UN_REVIEWED', NULL, 'STEP', 15000, 'v2.0.0', 'TEST_REF_ID', 'UN_EXECUTED', b'0', b'0', b'1', 'admin', 'admin', '', 1698058347559, 1698058347559, NULL);
|
||||
VALUES ('TEST_FUNCTIONAL_CASE_ID_2', 3, 'TEST_MODULE_ID_GYQ', '100001100001', '100001', 'copy_测试多版本', 'UN_REVIEWED', NULL, 'STEP', 15000, 'v2.0.1', 'TEST_REF_ID', 'UN_EXECUTED', b'0', b'0', b'1', 'admin', 'admin', '', 1698058347559, 1698058347559, NULL);
|
||||
|
||||
INSERT INTO functional_case(id, num, module_id, project_id, template_id, name, review_status, tags, case_edit_type, pos, version_id, ref_id, last_execute_result, deleted, public_case, latest, create_user, update_user, delete_user, create_time, update_time, delete_time)
|
||||
VALUES ('TEST_FUNCTIONAL_CASE_ID_3', 3, 'TEST_MODULE_ID_GYQ', '100001100001', '100001', 'copy_测试多版本', 'UN_REVIEWED', NULL, 'STEP', 25000, 'v3.0.0', 'TEST_REF_ID', 'UN_EXECUTED', b'0', b'0', b'1', 'admin', 'admin', '', 1698058347559, 1698058347559, NULL);
|
||||
|
@ -69,4 +69,6 @@ INSERT INTO case_review_functional_case(id, review_id, case_id, status, create_t
|
|||
INSERT INTO case_review(id, num, name, module_id, project_id, status, review_pass_rule, pos, start_time, end_time, case_count, pass_rate, tags, description, create_time, create_user, update_time, update_user)
|
||||
VALUES ('wx_review_id',10006,'测试重新提审', 'test_module_one', 'TEST_MODULE_ID_GYQ', 'COMPLETED', 'SINGLE', 001, null, null, 1,100.00,null,null,1698058347559,'admin',1698058347559,'admin');
|
||||
|
||||
INSERT INTO project_version(id, project_id, name, description, status, latest, publish_time, start_time, end_time, create_time, create_user)
|
||||
VALUES ('v2.0.1', 'wx_relationship', 'v1.0', NULL, 'open', b'1', 1698810592000, 1698810592000, 1698810592000, 1698810592000, 'admin');
|
||||
|
||||
|
|
Loading…
Reference in New Issue