feat(测试计划): 新增测试计划详情页功能用例脑图接口
This commit is contained in:
parent
74edb30ea3
commit
41a2a37050
|
@ -4,6 +4,7 @@ import com.alibaba.excel.util.StringUtils;
|
||||||
import io.metersphere.functional.dto.FunctionalMinderTreeDTO;
|
import io.metersphere.functional.dto.FunctionalMinderTreeDTO;
|
||||||
import io.metersphere.functional.request.FunctionalCaseMindRequest;
|
import io.metersphere.functional.request.FunctionalCaseMindRequest;
|
||||||
import io.metersphere.functional.request.FunctionalCaseMinderEditRequest;
|
import io.metersphere.functional.request.FunctionalCaseMinderEditRequest;
|
||||||
|
import io.metersphere.functional.request.FunctionalCasePlanMindRequest;
|
||||||
import io.metersphere.functional.request.FunctionalCaseReviewMindRequest;
|
import io.metersphere.functional.request.FunctionalCaseReviewMindRequest;
|
||||||
import io.metersphere.functional.service.FunctionalCaseMinderService;
|
import io.metersphere.functional.service.FunctionalCaseMinderService;
|
||||||
import io.metersphere.sdk.constants.PermissionConstants;
|
import io.metersphere.sdk.constants.PermissionConstants;
|
||||||
|
@ -69,4 +70,12 @@ public class FunctionalCaseMinderController {
|
||||||
return functionalCaseMinderService.getReviewMindFunctionalCase(request, false, userId, viewStatusUserId);
|
return functionalCaseMinderService.getReviewMindFunctionalCase(request, false, userId, viewStatusUserId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/plan/list")
|
||||||
|
@Operation(summary = "测试计划-功能用例-脑图用例跟根据模块ID查询列表")
|
||||||
|
@RequiresPermissions(PermissionConstants.FUNCTIONAL_CASE_READ_MINDER)
|
||||||
|
@CheckOwner(resourceId = "#request.getProjectId()", resourceType = "project")
|
||||||
|
public List<FunctionalMinderTreeDTO> getPlanFunctionalCaseMinderTree(@Validated @RequestBody FunctionalCasePlanMindRequest request) {
|
||||||
|
return functionalCaseMinderService.getPlanMindFunctionalCase(request, false);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,10 +3,7 @@ package io.metersphere.functional.mapper;
|
||||||
import io.metersphere.dto.TestCaseProviderDTO;
|
import io.metersphere.dto.TestCaseProviderDTO;
|
||||||
import io.metersphere.functional.domain.FunctionalCase;
|
import io.metersphere.functional.domain.FunctionalCase;
|
||||||
import io.metersphere.functional.dto.*;
|
import io.metersphere.functional.dto.*;
|
||||||
import io.metersphere.functional.request.FunctionalCaseBatchMoveRequest;
|
import io.metersphere.functional.request.*;
|
||||||
import io.metersphere.functional.request.FunctionalCaseMindRequest;
|
|
||||||
import io.metersphere.functional.request.FunctionalCasePageRequest;
|
|
||||||
import io.metersphere.functional.request.FunctionalCaseReviewMindRequest;
|
|
||||||
import io.metersphere.project.dto.ModuleCountDTO;
|
import io.metersphere.project.dto.ModuleCountDTO;
|
||||||
import io.metersphere.request.AssociateOtherCaseRequest;
|
import io.metersphere.request.AssociateOtherCaseRequest;
|
||||||
import io.metersphere.request.TestCasePageProviderRequest;
|
import io.metersphere.request.TestCasePageProviderRequest;
|
||||||
|
@ -90,4 +87,7 @@ public interface ExtFunctionalCaseMapper {
|
||||||
*/
|
*/
|
||||||
List<FunctionalCaseMindDTO> getMinderCaseReviewList(@Param("request") FunctionalCaseReviewMindRequest request, @Param("deleted") boolean delete, @Param("userId") String userId, @Param("viewStatusUserId") String viewStatusUserId);
|
List<FunctionalCaseMindDTO> getMinderCaseReviewList(@Param("request") FunctionalCaseReviewMindRequest request, @Param("deleted") boolean delete, @Param("userId") String userId, @Param("viewStatusUserId") String viewStatusUserId);
|
||||||
|
|
||||||
|
List<FunctionalCaseMindDTO> getMinderTestPlanList(@Param("request") FunctionalCasePlanMindRequest request, @Param("deleted") boolean delete);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -813,7 +813,7 @@
|
||||||
|
|
||||||
<select id="getMinderCaseReviewList" resultType="io.metersphere.functional.dto.FunctionalCaseMindDTO">
|
<select id="getMinderCaseReviewList" resultType="io.metersphere.functional.dto.FunctionalCaseMindDTO">
|
||||||
SELECT
|
SELECT
|
||||||
crfc.case_id as id,
|
crfc.id as id,
|
||||||
history.`status` as status,
|
history.`status` as status,
|
||||||
fc.module_id as moduleId,
|
fc.module_id as moduleId,
|
||||||
fc.name as name,
|
fc.name as name,
|
||||||
|
@ -845,4 +845,32 @@
|
||||||
AND cf.internal= true
|
AND cf.internal= true
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getMinderTestPlanList" resultType="io.metersphere.functional.dto.FunctionalCaseMindDTO">
|
||||||
|
SELECT
|
||||||
|
tpfc.id as id,
|
||||||
|
history.`status` as status,
|
||||||
|
fc.module_id as moduleId,
|
||||||
|
fc.name as name,
|
||||||
|
fcb.steps, fcb.expected_result, fcb.prerequisite, fcb.description, fccf.value as priority
|
||||||
|
FROM
|
||||||
|
test_plan_functional_case tpfc
|
||||||
|
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_custom_field fccf ON fccf.case_id = fc.id
|
||||||
|
LEFT JOIN custom_field cf ON cf.id = fccf.field_id
|
||||||
|
LEFT JOIN ( SELECT GROUP_CONCAT(DISTINCT tpceh.test_plan_case_id) AS test_plan_case_id, tpceh.`status` from test_plan_case_execute_history tpceh where tpceh.test_plan_id = #{request.planId}
|
||||||
|
GROUP BY test_plan_case_id order by tpceh.create_time desc ) as history ON history.test_plan_case_id = tpfc.id
|
||||||
|
WHERE
|
||||||
|
tpfc.test_plan_id = #{request.planId}
|
||||||
|
AND fc.deleted = #{deleted}
|
||||||
|
AND
|
||||||
|
fc.project_Id = #{request.projectId}
|
||||||
|
AND
|
||||||
|
fc.module_id = #{request.moduleId}
|
||||||
|
AND
|
||||||
|
cf.name = 'functional_priority'
|
||||||
|
AND cf.scene = 'FUNCTIONAL'
|
||||||
|
AND cf.internal= true
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
|
@ -0,0 +1,15 @@
|
||||||
|
package io.metersphere.functional.request;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import jakarta.validation.constraints.NotBlank;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class FunctionalCasePlanMindRequest extends FunctionalCaseMindRequest {
|
||||||
|
|
||||||
|
@Schema(description = "测试计划id", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@NotBlank(message = "{test_plan_functional_case.test_plan_id.not_blank}")
|
||||||
|
private String planId;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -782,4 +782,14 @@ public class FunctionalCaseMinderService {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public List<FunctionalMinderTreeDTO> getPlanMindFunctionalCase(FunctionalCasePlanMindRequest request, boolean deleted) {
|
||||||
|
List<FunctionalMinderTreeDTO> list = new ArrayList<>();
|
||||||
|
//查出当前模块下的所有用例
|
||||||
|
List<FunctionalCaseMindDTO> functionalCaseMindDTOList = extFunctionalCaseMapper.getMinderTestPlanList(request, deleted);
|
||||||
|
//构造父子级数据
|
||||||
|
buildList(functionalCaseMindDTOList, list);
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,6 +41,10 @@ public class FunctionalCaseMinderControllerTest extends BaseTest {
|
||||||
//评审
|
//评审
|
||||||
public static final String FUNCTIONAL_CASE_REVIEW_LIST_URL = "/functional/mind/case/review/list";
|
public static final String FUNCTIONAL_CASE_REVIEW_LIST_URL = "/functional/mind/case/review/list";
|
||||||
|
|
||||||
|
//测试计划
|
||||||
|
public static final String FUNCTIONAL_CASE_PLAN_LIST_URL = "/functional/mind/case/plan/list";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private FunctionalCaseBlobMapper functionalCaseBlobMapper;
|
private FunctionalCaseBlobMapper functionalCaseBlobMapper;
|
||||||
|
@ -261,4 +265,20 @@ public class FunctionalCaseMinderControllerTest extends BaseTest {
|
||||||
Assertions.assertEquals(1, baseTreeNodes.size());
|
Assertions.assertEquals(1, baseTreeNodes.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Order(4)
|
||||||
|
public void testGetCasePlanList() throws Exception {
|
||||||
|
FunctionalCasePlanMindRequest request = new FunctionalCasePlanMindRequest();
|
||||||
|
request.setProjectId("project-case-minder-test");
|
||||||
|
request.setModuleId("TEST_MINDER_MODULE_ID_GYQ4");
|
||||||
|
request.setPlanId("TEST_MINDER_PLAN_ID_1");
|
||||||
|
MvcResult mvcResultPage = this.requestPostWithOkAndReturn(FUNCTIONAL_CASE_PLAN_LIST_URL, request);
|
||||||
|
String contentAsString = mvcResultPage.getResponse().getContentAsString(StandardCharsets.UTF_8);
|
||||||
|
ResultHolder resultHolder = JSON.parseObject(contentAsString, ResultHolder.class);
|
||||||
|
List<FunctionalMinderTreeDTO> baseTreeNodes = JSON.parseArray(JSON.toJSONString(resultHolder.getData()), FunctionalMinderTreeDTO.class);
|
||||||
|
Assertions.assertNotNull(baseTreeNodes);
|
||||||
|
Assertions.assertEquals(2, baseTreeNodes.size());
|
||||||
|
System.out.println(baseTreeNodes);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,6 +47,12 @@ VALUES
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
|
INSERT INTO test_plan(id, num, project_id, group_id, module_id, name, status, type, tags, create_time, create_user, update_time, update_user, planned_start_time, planned_end_time, actual_start_time, actual_end_time, description)
|
||||||
|
VALUE ('TEST_MINDER_PLAN_ID_1', 1000, 'project-case-minder-test', 'none', 'TEST_MINDER_PLAN_MODULE', '脑图测试计划', 'PREPARED', 'TEST_PLAN', null, 1669174143999, 'admin', 1669174143999, 'admin', null, null, null,null,null);
|
||||||
|
|
||||||
|
INSERT INTO test_plan_functional_case(id, test_plan_id, functional_case_id, create_time, create_user, execute_user, last_exec_time, last_exec_result, pos)
|
||||||
|
VALUES ('test_plan_functional_case_minder_id1', 'TEST_MINDER_PLAN_ID_1', 'TEST_FUNCTIONAL_MINDER_CASE_ID_5', 1669174143999, 'admin', 'admin', 1669174143999, 'SUCCESS', 5000),
|
||||||
|
('test_plan_functional_case_minder_id2', 'TEST_MINDER_PLAN_ID_1', 'TEST_FUNCTIONAL_MINDER_CASE_ID_5', 1669174143999, 'admin', 'admin', 1669174143999, 'SUCCESS', 10000);
|
||||||
|
|
||||||
INSERT INTO custom_field (id, name, scene, type, remark, internal, scope_type, create_time, update_time, create_user, scope_id) VALUES
|
INSERT INTO custom_field (id, name, scene, type, remark, internal, scope_type, create_time, update_time, create_user, scope_id) VALUES
|
||||||
('custom_field_minder_gyq_id_2', 'functional_priority', 'FUNCTIONAL', 'SELECT', '', true, 'ORGANIZATION', UNIX_TIMESTAMP() * 1000, UNIX_TIMESTAMP() * 1000, 'admin', '100001'),
|
('custom_field_minder_gyq_id_2', 'functional_priority', 'FUNCTIONAL', 'SELECT', '', true, 'ORGANIZATION', UNIX_TIMESTAMP() * 1000, UNIX_TIMESTAMP() * 1000, 'admin', '100001'),
|
||||||
|
|
|
@ -627,7 +627,13 @@
|
||||||
dialogLoading.value = false;
|
dialogLoading.value = false;
|
||||||
resetSelector();
|
resetSelector();
|
||||||
loadList();
|
loadList();
|
||||||
emit('refresh', tableParams.value);
|
emit('refresh', {
|
||||||
|
...tableParams.value,
|
||||||
|
current: propsRes.value.msPagination?.current,
|
||||||
|
pageSize: propsRes.value.msPagination?.pageSize,
|
||||||
|
total: propsRes.value.msPagination?.total,
|
||||||
|
moduleIds: [],
|
||||||
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// eslint-disable-next-line no-console
|
// eslint-disable-next-line no-console
|
||||||
console.log(error);
|
console.log(error);
|
||||||
|
@ -680,7 +686,13 @@
|
||||||
Message.success(t('common.updateSuccess'));
|
Message.success(t('common.updateSuccess'));
|
||||||
dialogVisible.value = false;
|
dialogVisible.value = false;
|
||||||
resetSelector();
|
resetSelector();
|
||||||
emit('refresh', tableParams.value);
|
emit('refresh', {
|
||||||
|
...tableParams.value,
|
||||||
|
current: propsRes.value.msPagination?.current,
|
||||||
|
pageSize: propsRes.value.msPagination?.pageSize,
|
||||||
|
total: propsRes.value.msPagination?.total,
|
||||||
|
moduleIds: [],
|
||||||
|
});
|
||||||
loadList();
|
loadList();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// eslint-disable-next-line no-console
|
// eslint-disable-next-line no-console
|
||||||
|
@ -741,7 +753,13 @@
|
||||||
Message.success(t('caseManagement.caseReview.reviewSuccess'));
|
Message.success(t('caseManagement.caseReview.reviewSuccess'));
|
||||||
dialogVisible.value = false;
|
dialogVisible.value = false;
|
||||||
resetSelector();
|
resetSelector();
|
||||||
emit('refresh', tableParams.value);
|
emit('refresh', {
|
||||||
|
...tableParams.value,
|
||||||
|
current: propsRes.value.msPagination?.current,
|
||||||
|
pageSize: propsRes.value.msPagination?.pageSize,
|
||||||
|
total: propsRes.value.msPagination?.total,
|
||||||
|
moduleIds: [],
|
||||||
|
});
|
||||||
loadList();
|
loadList();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// eslint-disable-next-line no-console
|
// eslint-disable-next-line no-console
|
||||||
|
|
Loading…
Reference in New Issue