feat(测试计划): 测试计划关联的用例增加关联缺陷接口
This commit is contained in:
parent
0c3ed10966
commit
05d11c04ec
|
@ -57,4 +57,6 @@ public interface BaseAssociateBugProvider {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<BugProviderDTO> hasAssociateBugPage(AssociateBugPageRequest request);
|
List<BugProviderDTO> hasAssociateBugPage(AssociateBugPageRequest request);
|
||||||
|
|
||||||
|
List<BugProviderDTO> hasTestPlanAssociateBugPage(AssociateBugPageRequest request);
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ public class AssociateBugPageRequest extends BaseProviderCondition {
|
||||||
@Schema(description = "用例id", requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(description = "用例id", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
private String caseId;
|
private String caseId;
|
||||||
|
|
||||||
@Schema(description = "关联测试计划用例ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(description = "关联测试计划用例ID 如果是测试计划关联用例的缺陷,这个参数必填", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
private String testPlanCaseId;
|
private String testPlanCaseId;
|
||||||
|
|
||||||
@Schema(description = "项目ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(description = "项目ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@ -32,15 +32,15 @@ public class AssociateBugPageRequest extends BaseProviderCondition {
|
||||||
|
|
||||||
|
|
||||||
@Min(value = 1, message = "当前页码必须大于0")
|
@Min(value = 1, message = "当前页码必须大于0")
|
||||||
@Schema(description = "当前页码")
|
@Schema(description = "当前页码")
|
||||||
private int current;
|
private int current;
|
||||||
|
|
||||||
@Min(value = 5, message = "每页显示条数必须不小于5")
|
@Min(value = 5, message = "每页显示条数必须不小于5")
|
||||||
@Max(value = 500, message = "每页显示条数不能大于500")
|
@Max(value = 500, message = "每页显示条数不能大于500")
|
||||||
@Schema(description = "每页显示条数")
|
@Schema(description = "每页显示条数")
|
||||||
private int pageSize;
|
private int pageSize;
|
||||||
|
|
||||||
@Schema(description = "排序字段(model中的字段 : asc/desc)")
|
@Schema(description = "排序字段(model中的字段 : asc/desc)")
|
||||||
private Map<@Valid @Pattern(regexp = "^[A-Za-z]+$") String, @Valid @NotBlank String> sort;
|
private Map<@Valid @Pattern(regexp = "^[A-Za-z]+$") String, @Valid @NotBlank String> sort;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -81,4 +81,6 @@ public interface ExtBugRelateCaseMapper {
|
||||||
long countByCaseId(String caseId);
|
long countByCaseId(String caseId);
|
||||||
|
|
||||||
List<CaseRelateBugDTO> getBugCountByIds(@Param("ids") List<String> ids);
|
List<CaseRelateBugDTO> getBugCountByIds(@Param("ids") List<String> ids);
|
||||||
|
|
||||||
|
List<BugProviderDTO> getTestPlanAssociateBugs(@Param("request") AssociateBugPageRequest request, @Param("sort") String sort);
|
||||||
}
|
}
|
||||||
|
|
|
@ -275,4 +275,38 @@
|
||||||
ORDER BY
|
ORDER BY
|
||||||
bug.pos DESC
|
bug.pos DESC
|
||||||
</select>
|
</select>
|
||||||
|
<select id="getTestPlanAssociateBugs" resultType="io.metersphere.dto.BugProviderDTO">
|
||||||
|
SELECT
|
||||||
|
brc.id as id,
|
||||||
|
brc.bug_id bugId,
|
||||||
|
b.num as num,
|
||||||
|
b.title as name,
|
||||||
|
b.handle_user handleUser,
|
||||||
|
b.`status`,
|
||||||
|
bc.description as content,
|
||||||
|
brc.test_plan_id testPlanId,
|
||||||
|
tp.name testPlanName
|
||||||
|
FROM
|
||||||
|
bug_relation_case brc
|
||||||
|
INNER JOIN bug b ON brc.bug_id = b.id
|
||||||
|
INNER JOIN bug_content bc ON brc.bug_id = bc.bug_id
|
||||||
|
left join test_plan tp on brc.test_plan_id = tp.id
|
||||||
|
<where>
|
||||||
|
<if test="request.testPlanCaseId != null and request.testPlanCaseId != ''">
|
||||||
|
and brc.test_plan_case_id = #{request.testPlanCaseId}
|
||||||
|
|
||||||
|
</if>
|
||||||
|
<if test="request.keyword != null and request.keyword != ''">
|
||||||
|
and b.title like concat('%', #{request.keyword},'%')
|
||||||
|
</if>
|
||||||
|
<include refid="filter"/>
|
||||||
|
order by
|
||||||
|
<if test="sort != null and sort != ''">
|
||||||
|
brc.${sort}
|
||||||
|
</if>
|
||||||
|
<if test="sort == null or sort == ''">
|
||||||
|
brc.create_time desc
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
|
@ -96,13 +96,20 @@ public class AssociateBugProvider implements BaseAssociateBugProvider {
|
||||||
return buildAssociateBugs(associateBugs, request.getProjectId());
|
return buildAssociateBugs(associateBugs, request.getProjectId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<BugProviderDTO> hasTestPlanAssociateBugPage(AssociateBugPageRequest request) {
|
||||||
|
List<BugProviderDTO> associateBugs = extBugRelateCaseMapper.getTestPlanAssociateBugs(request, request.getSortString());
|
||||||
|
return buildAssociateBugs(associateBugs, request.getProjectId());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 关联缺陷列表数据处理
|
* 关联缺陷列表数据处理
|
||||||
|
*
|
||||||
* @param associateBugs 关联缺陷
|
* @param associateBugs 关联缺陷
|
||||||
* @param projectId 项目ID
|
* @param projectId 项目ID
|
||||||
* @return 关联缺陷列表
|
* @return 关联缺陷列表
|
||||||
*/
|
*/
|
||||||
private List<BugProviderDTO> buildAssociateBugs(List<BugProviderDTO> associateBugs, String projectId) {
|
public List<BugProviderDTO> buildAssociateBugs(List<BugProviderDTO> associateBugs, String projectId) {
|
||||||
List<SelectOption> headerHandlerOption = bugCommonService.getHeaderHandlerOption(projectId);
|
List<SelectOption> headerHandlerOption = bugCommonService.getHeaderHandlerOption(projectId);
|
||||||
List<SelectOption> statusOption = bugStatusService.getHeaderStatusOption(projectId);
|
List<SelectOption> statusOption = bugStatusService.getHeaderStatusOption(projectId);
|
||||||
associateBugs.forEach(item -> {
|
associateBugs.forEach(item -> {
|
||||||
|
|
|
@ -10,6 +10,7 @@ import io.metersphere.plan.dto.response.TestPlanCasePageResponse;
|
||||||
import io.metersphere.plan.dto.response.TestPlanResourceSortResponse;
|
import io.metersphere.plan.dto.response.TestPlanResourceSortResponse;
|
||||||
import io.metersphere.plan.service.TestPlanFunctionalCaseService;
|
import io.metersphere.plan.service.TestPlanFunctionalCaseService;
|
||||||
import io.metersphere.plan.service.TestPlanManagementService;
|
import io.metersphere.plan.service.TestPlanManagementService;
|
||||||
|
import io.metersphere.request.AssociateBugPageRequest;
|
||||||
import io.metersphere.request.BugPageProviderRequest;
|
import io.metersphere.request.BugPageProviderRequest;
|
||||||
import io.metersphere.sdk.constants.HttpMethodConstants;
|
import io.metersphere.sdk.constants.HttpMethodConstants;
|
||||||
import io.metersphere.sdk.constants.PermissionConstants;
|
import io.metersphere.sdk.constants.PermissionConstants;
|
||||||
|
@ -131,4 +132,12 @@ public class TestPlanFunctionalCaseController {
|
||||||
testPlanFunctionalCaseService.run(request, new LogInsertModule(SessionUtils.getUserId(), "/test-plan/functional/case/run", HttpMethodConstants.POST.name()));
|
testPlanFunctionalCaseService.run(request, new LogInsertModule(SessionUtils.getUserId(), "/test-plan/functional/case/run", HttpMethodConstants.POST.name()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/has/associate/bug/page")
|
||||||
|
@Operation(summary = "测试计划-计划详情-功能用例-获取已关联的缺陷列表")
|
||||||
|
@CheckOwner(resourceId = "#request.getTestPlanCaseId()", resourceType = "test_plan_functional_case")
|
||||||
|
public Pager<List<BugProviderDTO>> getAssociateBugList(@Validated @RequestBody AssociateBugPageRequest request) {
|
||||||
|
Page<Object> page = PageHelper.startPage(request.getCurrent(), request.getPageSize());
|
||||||
|
return PageUtils.setPageInfo(page, testPlanFunctionalCaseService.hasAssociateBugPage(request));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,6 +32,7 @@ import io.metersphere.plan.mapper.*;
|
||||||
import io.metersphere.project.domain.Project;
|
import io.metersphere.project.domain.Project;
|
||||||
import io.metersphere.project.dto.ModuleCountDTO;
|
import io.metersphere.project.dto.ModuleCountDTO;
|
||||||
import io.metersphere.provider.BaseAssociateBugProvider;
|
import io.metersphere.provider.BaseAssociateBugProvider;
|
||||||
|
import io.metersphere.request.AssociateBugPageRequest;
|
||||||
import io.metersphere.request.BugPageProviderRequest;
|
import io.metersphere.request.BugPageProviderRequest;
|
||||||
import io.metersphere.sdk.constants.CaseType;
|
import io.metersphere.sdk.constants.CaseType;
|
||||||
import io.metersphere.sdk.constants.FunctionalCaseExecuteResult;
|
import io.metersphere.sdk.constants.FunctionalCaseExecuteResult;
|
||||||
|
@ -411,4 +412,8 @@ public class TestPlanFunctionalCaseService extends TestPlanResourceService {
|
||||||
executeHistory.setCreateTime(System.currentTimeMillis());
|
executeHistory.setCreateTime(System.currentTimeMillis());
|
||||||
return executeHistory;
|
return executeHistory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<BugProviderDTO> hasAssociateBugPage(AssociateBugPageRequest request) {
|
||||||
|
return baseAssociateBugProvider.hasTestPlanAssociateBugPage(request);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,13 +6,10 @@ import io.metersphere.bug.mapper.BugRelationCaseMapper;
|
||||||
import io.metersphere.dto.BugProviderDTO;
|
import io.metersphere.dto.BugProviderDTO;
|
||||||
import io.metersphere.plan.domain.TestPlanFunctionalCase;
|
import io.metersphere.plan.domain.TestPlanFunctionalCase;
|
||||||
import io.metersphere.plan.domain.TestPlanFunctionalCaseExample;
|
import io.metersphere.plan.domain.TestPlanFunctionalCaseExample;
|
||||||
import io.metersphere.plan.dto.request.BasePlanCaseBatchRequest;
|
import io.metersphere.plan.dto.request.*;
|
||||||
import io.metersphere.plan.dto.request.TestPlanCaseAssociateBugRequest;
|
|
||||||
import io.metersphere.plan.dto.request.TestPlanCaseRequest;
|
|
||||||
import io.metersphere.plan.dto.request.TestPlanCaseRunRequest;
|
|
||||||
import io.metersphere.plan.dto.request.TestPlanDisassociationRequest;
|
|
||||||
import io.metersphere.plan.mapper.TestPlanFunctionalCaseMapper;
|
import io.metersphere.plan.mapper.TestPlanFunctionalCaseMapper;
|
||||||
import io.metersphere.provider.BaseAssociateBugProvider;
|
import io.metersphere.provider.BaseAssociateBugProvider;
|
||||||
|
import io.metersphere.request.AssociateBugPageRequest;
|
||||||
import io.metersphere.request.BugPageProviderRequest;
|
import io.metersphere.request.BugPageProviderRequest;
|
||||||
import io.metersphere.sdk.util.JSON;
|
import io.metersphere.sdk.util.JSON;
|
||||||
import io.metersphere.system.base.BaseTest;
|
import io.metersphere.system.base.BaseTest;
|
||||||
|
@ -156,6 +153,14 @@ public class TestPlanCaseControllerTests extends BaseTest {
|
||||||
ids.add("bug_1");
|
ids.add("bug_1");
|
||||||
Mockito.when(baseAssociateBugProvider.getSelectBugs(request, false)).thenReturn(ids);
|
Mockito.when(baseAssociateBugProvider.getSelectBugs(request, false)).thenReturn(ids);
|
||||||
this.requestPostWithOkAndReturn("/test-plan/functional/case/associate/bug", request);
|
this.requestPostWithOkAndReturn("/test-plan/functional/case/associate/bug", request);
|
||||||
|
AssociateBugPageRequest associateBugPageRequest = new AssociateBugPageRequest();
|
||||||
|
associateBugPageRequest.setProjectId(DEFAULT_PROJECT_ID);
|
||||||
|
associateBugPageRequest.setCurrent(1);
|
||||||
|
associateBugPageRequest.setPageSize(10);
|
||||||
|
associateBugPageRequest.setTestPlanCaseId("relate_case_1");
|
||||||
|
this.requestPostWithOkAndReturn("/test-plan/functional/case/has/associate/bug/page", associateBugPageRequest);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -168,7 +173,6 @@ public class TestPlanCaseControllerTests extends BaseTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Order(11)
|
@Order(11)
|
||||||
public void testFunctionalCaseRun() throws Exception {
|
public void testFunctionalCaseRun() throws Exception {
|
||||||
|
|
Loading…
Reference in New Issue