mirror of
https://gitee.com/fit2cloud-feizhiyun/MeterSphere.git
synced 2024-11-30 19:18:59 +08:00
feat(测试计划): 增加集合报告查看报告列表
This commit is contained in:
parent
4f7b6aae67
commit
7d47d08c09
@ -84,14 +84,14 @@ public class TestPlanReportController {
|
||||
testPlanReportService.batchSetReportDelete(request, SessionUtils.getUserId());
|
||||
}
|
||||
|
||||
@PostMapping("/gen")
|
||||
@Operation(summary = "测试计划-详情-生成报告")
|
||||
@RequiresPermissions(PermissionConstants.TEST_PLAN_READ_EXECUTE)
|
||||
@CheckOwner(resourceId = "#request.getTestPlanId()", resourceType = "test_plan")
|
||||
public void genReportByManual(@Validated @RequestBody TestPlanReportGenRequest request) {
|
||||
@PostMapping("/gen")
|
||||
@Operation(summary = "测试计划-详情-生成报告")
|
||||
@RequiresPermissions(PermissionConstants.TEST_PLAN_READ_EXECUTE)
|
||||
@CheckOwner(resourceId = "#request.getTestPlanId()", resourceType = "test_plan")
|
||||
public void genReportByManual(@Validated @RequestBody TestPlanReportGenRequest request) {
|
||||
testPlanService.checkTestPlanNotArchived(request.getTestPlanId());
|
||||
testPlanReportService.genReportByManual(request, SessionUtils.getUserId());
|
||||
}
|
||||
}
|
||||
|
||||
// 报告详情开始
|
||||
|
||||
@ -158,4 +158,14 @@ public class TestPlanReportController {
|
||||
StringUtils.isNotBlank(request.getSortString()) ? request.getSortString() : "tpras.api_scenario_num, tpras.id desc");
|
||||
return PageUtils.setPageInfo(page, testPlanReportService.listReportDetailCases(request, AssociateCaseType.API_SCENARIO));
|
||||
}
|
||||
|
||||
@PostMapping("/detail/plan/report/page")
|
||||
@Operation(summary = "测试计划-报告-集合报告详情")
|
||||
@RequiresPermissions(PermissionConstants.TEST_PLAN_REPORT_READ)
|
||||
@CheckOwner(resourceId = "#request.getReportId()", resourceType = "test_plan_report")
|
||||
public Pager<List<TestPlanReportDetailResponse>> planReportPage(@Validated @RequestBody TestPlanReportDetailPageRequest request) {
|
||||
Page<Object> page = PageHelper.startPage(request.getCurrent(), request.getPageSize(),
|
||||
StringUtils.isNotBlank(request.getSortString()) ? request.getSortString() : "tpr.create_time desc");
|
||||
return PageUtils.setPageInfo(page, testPlanReportService.planReportList(request));
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,12 @@ package io.metersphere.plan.controller;
|
||||
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import io.metersphere.api.dto.definition.ApiReportDTO;
|
||||
import io.metersphere.api.dto.definition.ApiReportDetailDTO;
|
||||
import io.metersphere.api.dto.scenario.ApiScenarioReportDTO;
|
||||
import io.metersphere.api.dto.scenario.ApiScenarioReportDetailDTO;
|
||||
import io.metersphere.api.service.definition.ApiReportService;
|
||||
import io.metersphere.api.service.scenario.ApiScenarioReportService;
|
||||
import io.metersphere.bug.dto.response.BugDTO;
|
||||
import io.metersphere.plan.constants.AssociateCaseType;
|
||||
import io.metersphere.plan.dto.ReportDetailCasePageDTO;
|
||||
@ -33,78 +39,128 @@ import java.util.List;
|
||||
@Tag(name = "测试计划-分享")
|
||||
public class TestPlanReportShareController {
|
||||
|
||||
@Resource
|
||||
private TestPlanReportService testPlanReportService;
|
||||
@Resource
|
||||
private TestPlanReportShareService testPlanReportShareService;
|
||||
@Resource
|
||||
private TestPlanReportService testPlanReportService;
|
||||
@Resource
|
||||
private TestPlanReportShareService testPlanReportShareService;
|
||||
@Resource
|
||||
private ApiReportService apiReportService;
|
||||
@Resource
|
||||
private ApiScenarioReportService apiScenarioReportService;
|
||||
|
||||
@PostMapping("/gen")
|
||||
@Operation(summary = "测试计划-报告-分享")
|
||||
@RequiresPermissions(PermissionConstants.TEST_PLAN_REPORT_READ_SHARE)
|
||||
@CheckOwner(resourceId = "#request.getProjectId()", resourceType = "project")
|
||||
public TestPlanShareInfo genReportShareInfo(@RequestBody TestPlanReportShareRequest request) {
|
||||
return testPlanReportShareService.gen(request, SessionUtils.getUserId());
|
||||
}
|
||||
@PostMapping("/gen")
|
||||
@Operation(summary = "测试计划-报告-分享")
|
||||
@RequiresPermissions(PermissionConstants.TEST_PLAN_REPORT_READ_SHARE)
|
||||
@CheckOwner(resourceId = "#request.getProjectId()", resourceType = "project")
|
||||
public TestPlanShareInfo genReportShareInfo(@RequestBody TestPlanReportShareRequest request) {
|
||||
return testPlanReportShareService.gen(request, SessionUtils.getUserId());
|
||||
}
|
||||
|
||||
@GetMapping("/get/{id}")
|
||||
@Operation(summary = "测试计划-报告-获取分享链接")
|
||||
public TestPlanShareResponse get(@PathVariable String id) {
|
||||
return testPlanReportShareService.get(id);
|
||||
}
|
||||
@GetMapping("/get/{id}")
|
||||
@Operation(summary = "测试计划-报告-获取分享链接")
|
||||
public TestPlanShareResponse get(@PathVariable String id) {
|
||||
return testPlanReportShareService.get(id);
|
||||
}
|
||||
|
||||
@GetMapping("/get-share-time/{id}")
|
||||
@Operation(summary = "测试计划-报告-获取分享链接的有效时间")
|
||||
public String getShareTime(@PathVariable String id) {
|
||||
return testPlanReportShareService.getShareTime(id);
|
||||
}
|
||||
@GetMapping("/get-share-time/{id}")
|
||||
@Operation(summary = "测试计划-报告-获取分享链接的有效时间")
|
||||
public String getShareTime(@PathVariable String id) {
|
||||
return testPlanReportShareService.getShareTime(id);
|
||||
}
|
||||
|
||||
// 分享报告详情开始
|
||||
// 分享报告详情开始
|
||||
|
||||
@GetMapping("/get/detail/{shareId}/{reportId}")
|
||||
@Operation(summary = "测试计划-报告分享-详情查看")
|
||||
public TestPlanReportDetailResponse getDetail(@PathVariable String shareId, @PathVariable String reportId) {
|
||||
ShareInfo shareInfo = testPlanReportShareService.checkResource(shareId);
|
||||
testPlanReportShareService.validateExpired(shareInfo);
|
||||
return testPlanReportService.getReport(reportId);
|
||||
}
|
||||
@GetMapping("/get/detail/{shareId}/{reportId}")
|
||||
@Operation(summary = "测试计划-报告分享-详情查看")
|
||||
public TestPlanReportDetailResponse getDetail(@PathVariable String shareId, @PathVariable String reportId) {
|
||||
ShareInfo shareInfo = testPlanReportShareService.checkResource(shareId);
|
||||
testPlanReportShareService.validateExpired(shareInfo);
|
||||
return testPlanReportService.getReport(reportId);
|
||||
}
|
||||
|
||||
@PostMapping("/detail/bug/page")
|
||||
@Operation(summary = "测试计划-报告-详情-缺陷分页查询")
|
||||
public Pager<List<BugDTO>> pageBug(@Validated @RequestBody TestPlanShareReportDetailRequest request) {
|
||||
ShareInfo shareInfo = testPlanReportShareService.checkResource(request.getShareId());
|
||||
testPlanReportShareService.validateExpired(shareInfo);
|
||||
Page<Object> page = PageHelper.startPage(request.getCurrent(), request.getPageSize(),
|
||||
StringUtils.isNotBlank(request.getSortString()) ? request.getSortString() : "tprb.bug_num, tprb.id desc");
|
||||
return PageUtils.setPageInfo(page, testPlanReportService.listReportDetailBugs(request));
|
||||
}
|
||||
@PostMapping("/detail/bug/page")
|
||||
@Operation(summary = "测试计划-报告-详情-缺陷分页查询")
|
||||
public Pager<List<BugDTO>> pageBug(@Validated @RequestBody TestPlanShareReportDetailRequest request) {
|
||||
ShareInfo shareInfo = testPlanReportShareService.checkResource(request.getShareId());
|
||||
testPlanReportShareService.validateExpired(shareInfo);
|
||||
Page<Object> page = PageHelper.startPage(request.getCurrent(), request.getPageSize(),
|
||||
StringUtils.isNotBlank(request.getSortString()) ? request.getSortString() : "tprb.bug_num, tprb.id desc");
|
||||
return PageUtils.setPageInfo(page, testPlanReportService.listReportDetailBugs(request));
|
||||
}
|
||||
|
||||
@PostMapping("/detail/functional/case/page")
|
||||
@Operation(summary = "测试计划-报告-详情-功能用例分页查询")
|
||||
public Pager<List<ReportDetailCasePageDTO>> pageFunctionalCase(@Validated @RequestBody TestPlanShareReportDetailRequest request) {
|
||||
ShareInfo shareInfo = testPlanReportShareService.checkResource(request.getShareId());
|
||||
testPlanReportShareService.validateExpired(shareInfo);
|
||||
Page<Object> page = PageHelper.startPage(request.getCurrent(), request.getPageSize(),
|
||||
StringUtils.isNotBlank(request.getSortString()) ? request.getSortString() : "tprfc.function_case_num, tprfc.id desc");
|
||||
return PageUtils.setPageInfo(page, testPlanReportService.listReportDetailCases(request, AssociateCaseType.FUNCTIONAL));
|
||||
}
|
||||
@PostMapping("/detail/functional/case/page")
|
||||
@Operation(summary = "测试计划-报告-详情-功能用例分页查询")
|
||||
public Pager<List<ReportDetailCasePageDTO>> pageFunctionalCase(@Validated @RequestBody TestPlanShareReportDetailRequest request) {
|
||||
ShareInfo shareInfo = testPlanReportShareService.checkResource(request.getShareId());
|
||||
testPlanReportShareService.validateExpired(shareInfo);
|
||||
Page<Object> page = PageHelper.startPage(request.getCurrent(), request.getPageSize(),
|
||||
StringUtils.isNotBlank(request.getSortString()) ? request.getSortString() : "tprfc.function_case_num, tprfc.id desc");
|
||||
return PageUtils.setPageInfo(page, testPlanReportService.listReportDetailCases(request, AssociateCaseType.FUNCTIONAL));
|
||||
}
|
||||
|
||||
@PostMapping("/detail/api/case/page")
|
||||
@Operation(summary = "测试计划-报告-详情-接口用例分页查询")
|
||||
public Pager<List<ReportDetailCasePageDTO>> pageApiCase(@Validated @RequestBody TestPlanShareReportDetailRequest request) {
|
||||
ShareInfo shareInfo = testPlanReportShareService.checkResource(request.getShareId());
|
||||
testPlanReportShareService.validateExpired(shareInfo);
|
||||
Page<Object> page = PageHelper.startPage(request.getCurrent(), request.getPageSize(),
|
||||
StringUtils.isNotBlank(request.getSortString()) ? request.getSortString() : "tprac.api_case_num, tprac.id desc");
|
||||
return PageUtils.setPageInfo(page, testPlanReportService.listReportDetailCases(request, AssociateCaseType.API_CASE));
|
||||
}
|
||||
@PostMapping("/detail/api/case/page")
|
||||
@Operation(summary = "测试计划-报告-详情-接口用例分页查询")
|
||||
public Pager<List<ReportDetailCasePageDTO>> pageApiCase(@Validated @RequestBody TestPlanShareReportDetailRequest request) {
|
||||
ShareInfo shareInfo = testPlanReportShareService.checkResource(request.getShareId());
|
||||
testPlanReportShareService.validateExpired(shareInfo);
|
||||
Page<Object> page = PageHelper.startPage(request.getCurrent(), request.getPageSize(),
|
||||
StringUtils.isNotBlank(request.getSortString()) ? request.getSortString() : "tprac.api_case_num, tprac.id desc");
|
||||
return PageUtils.setPageInfo(page, testPlanReportService.listReportDetailCases(request, AssociateCaseType.API_CASE));
|
||||
}
|
||||
|
||||
@PostMapping("/detail/scenario/case/page")
|
||||
@Operation(summary = "测试计划-报告-详情-场景用例分页查询")
|
||||
public Pager<List<ReportDetailCasePageDTO>> pageScenarioCase(@Validated @RequestBody TestPlanShareReportDetailRequest request) {
|
||||
ShareInfo shareInfo = testPlanReportShareService.checkResource(request.getShareId());
|
||||
testPlanReportShareService.validateExpired(shareInfo);
|
||||
Page<Object> page = PageHelper.startPage(request.getCurrent(), request.getPageSize(),
|
||||
StringUtils.isNotBlank(request.getSortString()) ? request.getSortString() : "tpras.api_scenario_num, tpras.id desc");
|
||||
return PageUtils.setPageInfo(page, testPlanReportService.listReportDetailCases(request, AssociateCaseType.API_SCENARIO));
|
||||
}
|
||||
@PostMapping("/detail/scenario/case/page")
|
||||
@Operation(summary = "测试计划-报告-详情-场景用例分页查询")
|
||||
public Pager<List<ReportDetailCasePageDTO>> pageScenarioCase(@Validated @RequestBody TestPlanShareReportDetailRequest request) {
|
||||
ShareInfo shareInfo = testPlanReportShareService.checkResource(request.getShareId());
|
||||
testPlanReportShareService.validateExpired(shareInfo);
|
||||
Page<Object> page = PageHelper.startPage(request.getCurrent(), request.getPageSize(),
|
||||
StringUtils.isNotBlank(request.getSortString()) ? request.getSortString() : "tpras.api_scenario_num, tpras.id desc");
|
||||
return PageUtils.setPageInfo(page, testPlanReportService.listReportDetailCases(request, AssociateCaseType.API_SCENARIO));
|
||||
}
|
||||
|
||||
@PostMapping("/detail/plan/report/page")
|
||||
@Operation(summary = "测试计划-报告-集合报告详情")
|
||||
public Pager<List<TestPlanReportDetailResponse>> planReportPage(@Validated @RequestBody TestPlanShareReportDetailRequest request) {
|
||||
ShareInfo shareInfo = testPlanReportShareService.checkResource(request.getShareId());
|
||||
testPlanReportShareService.validateExpired(shareInfo);
|
||||
Page<Object> page = PageHelper.startPage(request.getCurrent(), request.getPageSize(),
|
||||
StringUtils.isNotBlank(request.getSortString()) ? request.getSortString() : "tpr.create_time desc");
|
||||
return PageUtils.setPageInfo(page, testPlanReportService.planReportList(request));
|
||||
}
|
||||
|
||||
@GetMapping("/detail/api-report/{shareId}/{reportId}")
|
||||
@Operation(summary = "测试计划-接口用例-查看报告")
|
||||
public ApiReportDTO getApiReport(@PathVariable String shareId, @PathVariable String reportId) {
|
||||
ShareInfo shareInfo = testPlanReportShareService.checkResource(shareId);
|
||||
testPlanReportShareService.validateExpired(shareInfo);
|
||||
return apiReportService.get(reportId);
|
||||
}
|
||||
|
||||
@GetMapping("/detail/api-report/get/{shareId}/{reportId}/{stepId}")
|
||||
@Operation(summary = "测试计划-接口用例-查看报告详情")
|
||||
public List<ApiReportDetailDTO> getReportContent(@PathVariable String shareId,
|
||||
@PathVariable String reportId,
|
||||
@PathVariable String stepId) {
|
||||
ShareInfo shareInfo = testPlanReportShareService.checkResource(shareId);
|
||||
testPlanReportShareService.validateExpired(shareInfo);
|
||||
return apiReportService.getDetail(reportId, stepId);
|
||||
}
|
||||
|
||||
@GetMapping("/detail/scenario-report/{shareId}/{reportId}")
|
||||
@Operation(summary = "测试计划-接口场景-查看报告")
|
||||
public ApiScenarioReportDTO getScenarioReport(@PathVariable String shareId, @PathVariable String reportId) {
|
||||
ShareInfo shareInfo = testPlanReportShareService.checkResource(shareId);
|
||||
testPlanReportShareService.validateExpired(shareInfo);
|
||||
return apiScenarioReportService.get(reportId);
|
||||
}
|
||||
|
||||
@GetMapping("/detail/scenario-report/get/{shareId}/{reportId}/{stepId}")
|
||||
@Operation(summary = "测试计划-接口场景-查看报告详情")
|
||||
public List<ApiScenarioReportDetailDTO> selectReportContent(@PathVariable String shareId,
|
||||
@PathVariable String reportId,
|
||||
@PathVariable String stepId) {
|
||||
ShareInfo shareInfo = testPlanReportShareService.checkResource(shareId);
|
||||
testPlanReportShareService.validateExpired(shareInfo);
|
||||
return apiScenarioReportService.getDetail(reportId, stepId);
|
||||
}
|
||||
}
|
||||
|
@ -9,57 +9,59 @@ import lombok.Data;
|
||||
@Data
|
||||
public class TestPlanReportDetailResponse {
|
||||
|
||||
@Schema(description = "报告ID")
|
||||
private String id;
|
||||
@Schema(description = "报告名称")
|
||||
private String name;
|
||||
@Schema(description = "报告开始时间")
|
||||
private Long startTime;
|
||||
@Schema(description = "报告执行开始时间")
|
||||
private Long executeTime;
|
||||
@Schema(description = "报告结束(执行)时间")
|
||||
private Long endTime;
|
||||
@Schema(description = "报告内容")
|
||||
private String summary;
|
||||
@Schema(description = "报告ID")
|
||||
private String id;
|
||||
@Schema(description = "报告名称")
|
||||
private String name;
|
||||
@Schema(description = "报告开始时间")
|
||||
private Long startTime;
|
||||
@Schema(description = "报告执行开始时间")
|
||||
private Long executeTime;
|
||||
@Schema(description = "报告结束(执行)时间")
|
||||
private Long endTime;
|
||||
@Schema(description = "报告内容")
|
||||
private String summary;
|
||||
|
||||
/**
|
||||
* 报告分析
|
||||
*/
|
||||
@Schema(description = "通过阈值")
|
||||
@JsonSerialize(using = CustomRateSerializer.class)
|
||||
private Double passThreshold;
|
||||
@Schema(description = "通过率")
|
||||
@JsonSerialize(using = CustomRateSerializer.class)
|
||||
private Double passRate;
|
||||
@Schema(description = "执行完成率")
|
||||
@JsonSerialize(using = CustomRateSerializer.class)
|
||||
private Double executeRate;
|
||||
@Schema(description = "缺陷总数")
|
||||
private Integer bugCount;
|
||||
@Schema(description = "计划总数")
|
||||
private Integer planCount;
|
||||
/**
|
||||
* 报告分析
|
||||
*/
|
||||
@Schema(description = "通过阈值")
|
||||
@JsonSerialize(using = CustomRateSerializer.class)
|
||||
private Double passThreshold;
|
||||
@Schema(description = "通过率")
|
||||
@JsonSerialize(using = CustomRateSerializer.class)
|
||||
private Double passRate;
|
||||
@Schema(description = "执行完成率")
|
||||
@JsonSerialize(using = CustomRateSerializer.class)
|
||||
private Double executeRate;
|
||||
@Schema(description = "缺陷总数")
|
||||
private Integer bugCount;
|
||||
@Schema(description = "计划总数")
|
||||
private Integer planCount;
|
||||
|
||||
|
||||
@Schema(description = "用例总数")
|
||||
private Integer caseTotal = 0;
|
||||
/**
|
||||
* 执行分析
|
||||
*/
|
||||
@Schema(description = "执行分析-用例数")
|
||||
private CaseCount executeCount;
|
||||
/**
|
||||
* 功能用例分析
|
||||
*/
|
||||
@Schema(description = "功能用例分析-用例数")
|
||||
private CaseCount functionalCount;
|
||||
/**
|
||||
* 接口用例分析
|
||||
*/
|
||||
@Schema(description = "接口用例分析-用例数")
|
||||
private CaseCount apiCaseCount;
|
||||
/**
|
||||
* 接口场景用例分析
|
||||
*/
|
||||
@Schema(description = "接口场景用例分析-用例数")
|
||||
private CaseCount apiScenarioCount;
|
||||
@Schema(description = "用例总数")
|
||||
private Integer caseTotal = 0;
|
||||
/**
|
||||
* 执行分析
|
||||
*/
|
||||
@Schema(description = "执行分析-用例数")
|
||||
private CaseCount executeCount;
|
||||
/**
|
||||
* 功能用例分析
|
||||
*/
|
||||
@Schema(description = "功能用例分析-用例数")
|
||||
private CaseCount functionalCount;
|
||||
/**
|
||||
* 接口用例分析
|
||||
*/
|
||||
@Schema(description = "接口用例分析-用例数")
|
||||
private CaseCount apiCaseCount;
|
||||
/**
|
||||
* 接口场景用例分析
|
||||
*/
|
||||
@Schema(description = "接口场景用例分析-用例数")
|
||||
private CaseCount apiScenarioCount;
|
||||
|
||||
private boolean deleted;
|
||||
}
|
||||
|
@ -2,7 +2,9 @@ package io.metersphere.plan.mapper;
|
||||
|
||||
import io.metersphere.plan.domain.TestPlanReport;
|
||||
import io.metersphere.plan.dto.request.TestPlanReportBatchRequest;
|
||||
import io.metersphere.plan.dto.request.TestPlanReportDetailPageRequest;
|
||||
import io.metersphere.plan.dto.request.TestPlanReportPageRequest;
|
||||
import io.metersphere.plan.dto.response.TestPlanReportDetailResponse;
|
||||
import io.metersphere.plan.dto.response.TestPlanReportPageResponse;
|
||||
import io.metersphere.system.dto.sdk.ApiReportMessageDTO;
|
||||
import io.metersphere.system.dto.taskcenter.TaskCenterDTO;
|
||||
@ -42,4 +44,5 @@ public interface ExtTestPlanReportMapper {
|
||||
List<TaskCenterDTO> taskCenterlist(@Param("request") TaskCenterPageRequest request, @Param("projectIds") List<String> projectIds,
|
||||
@Param("startTime") long startTime, @Param("endTime") long endTime);
|
||||
|
||||
List<TestPlanReportDetailResponse> getPlanReportListById(@Param("request") TestPlanReportDetailPageRequest request);
|
||||
}
|
||||
|
@ -96,6 +96,39 @@
|
||||
</if>
|
||||
<include refid="filter"/>
|
||||
</select>
|
||||
<select id="getPlanReportListById"
|
||||
resultType="io.metersphere.plan.dto.response.TestPlanReportDetailResponse">
|
||||
|
||||
SELECT tpr.id,
|
||||
tp.name,
|
||||
tpr.result_status,
|
||||
tpr.pass_rate,
|
||||
tpc.pass_threshold,
|
||||
(tprs.functional_case_count + tprs.api_case_count + tprs.api_scenario_count + tprs.bug_count) as caseTotal,
|
||||
tpr.create_time,
|
||||
tpr.deleted
|
||||
|
||||
from test_plan_report tpr
|
||||
INNER JOIN test_plan tp on tpr.test_plan_id = tp.id
|
||||
INNER JOIN test_plan_report_summary tprs on tpr.id = tprs.id
|
||||
INNER JOIN test_plan_config tpc on tp.id = tpc.test_plan_id
|
||||
|
||||
<include refid="queryWhereConditionByParentId"/>
|
||||
</select>
|
||||
|
||||
<sql id="queryWhereConditionByParentId">
|
||||
<where>
|
||||
<if test="request.reportId != null and request.reportId != ''">
|
||||
and tpr.parent_id = #{request.reportId}
|
||||
</if>
|
||||
<include refid="filter"/>
|
||||
<include refid="combine">
|
||||
<property name="condition" value="request.combine"/>
|
||||
<property name="searchMode" value="request.searchMode"/>
|
||||
<property name="combineTag" value="request.combine.tag"/>
|
||||
</include>
|
||||
</where>
|
||||
</sql>
|
||||
|
||||
<sql id="queryWhereCondition">
|
||||
<where>
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -33,6 +33,7 @@ import org.springframework.test.web.servlet.MvcResult;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.*;
|
||||
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
||||
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
||||
@ -52,6 +53,7 @@ public class TestPlanReportControllerTests extends BaseTest {
|
||||
private static final String GET_PLAN_REPORT_DETAIL_FUNCTIONAL_PAGE = "/test-plan/report/detail/functional/case/page";
|
||||
private static final String GET_PLAN_REPORT_DETAIL_API_PAGE = "/test-plan/report/detail/api/case/page";
|
||||
private static final String GET_PLAN_REPORT_DETAIL_SCENARIO_PAGE = "/test-plan/report/detail/scenario/case/page";
|
||||
private static final String GET_PLAN_REPORT_DETAIL_PLAN_PAGE = "/test-plan/report/detail/plan/report/page";
|
||||
private static final String GEN_AND_SHARE = "/test-plan/report/share/gen";
|
||||
private static final String GET_SHARE_INFO = "/test-plan/report/share/get";
|
||||
private static final String GET_SHARE_TIME = "/test-plan/report/share/get-share-time";
|
||||
@ -60,6 +62,9 @@ public class TestPlanReportControllerTests extends BaseTest {
|
||||
private static final String GET_SHARE_REPORT_FUNCTIONAL_LIST = "/test-plan/report/share/detail/functional/case/page";
|
||||
private static final String GET_SHARE_REPORT_API_LIST = "/test-plan/report/share/detail/api/case/page";
|
||||
private static final String GET_SHARE_REPORT_SCENARIO_LIST = "/test-plan/report/share/detail/scenario/case/page";
|
||||
private static final String GET_SHARE_REPORT_PLAN_LIST = "/test-plan/report/share/detail/plan/report/page";
|
||||
private static final String GET_SHARE_REPORT_API_REPORT_LIST = "/test-plan/report/share/detail/api-report";
|
||||
private static final String GET_SHARE_REPORT_SCENARIO_REPORT_LIST = "/test-plan/report/share/detail/scenario-report";
|
||||
|
||||
@Autowired
|
||||
private TestPlanReportMapper testPlanReportMapper;
|
||||
@ -175,7 +180,7 @@ public class TestPlanReportControllerTests extends BaseTest {
|
||||
|
||||
@Test
|
||||
@Order(8)
|
||||
void testGetShareReportTableList() throws Exception{
|
||||
void testGetShareReportTableList() throws Exception {
|
||||
TestPlanShareReportDetailRequest request = new TestPlanShareReportDetailRequest();
|
||||
request.setCurrent(1);
|
||||
request.setPageSize(10);
|
||||
@ -186,16 +191,33 @@ public class TestPlanReportControllerTests extends BaseTest {
|
||||
this.requestPostWithOk(GET_SHARE_REPORT_FUNCTIONAL_LIST, request);
|
||||
this.requestPostWithOk(GET_SHARE_REPORT_API_LIST, request);
|
||||
this.requestPostWithOk(GET_SHARE_REPORT_SCENARIO_LIST, request);
|
||||
this.requestPostWithOk(GET_SHARE_REPORT_PLAN_LIST, request);
|
||||
request.setSort(Map.of("num", "asc"));
|
||||
this.requestPostWithOk(GET_SHARE_REPORT_BUG_LIST, request);
|
||||
this.requestPostWithOk(GET_SHARE_REPORT_FUNCTIONAL_LIST, request);
|
||||
this.requestPostWithOk(GET_SHARE_REPORT_API_LIST, request);
|
||||
this.requestPostWithOk(GET_SHARE_REPORT_SCENARIO_LIST, request);
|
||||
|
||||
mockMvc.perform(getRequestBuilder(GET_SHARE_REPORT_API_REPORT_LIST + "/" + GEN_SHARE_ID + "/" + "test"))
|
||||
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
|
||||
.andExpect(status().is5xxServerError());
|
||||
|
||||
mockMvc.perform(getRequestBuilder(GET_SHARE_REPORT_API_REPORT_LIST + "/get/" + GEN_SHARE_ID + "/" + "test" + "/111"))
|
||||
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
|
||||
.andExpect(status().isOk());
|
||||
|
||||
mockMvc.perform(getRequestBuilder(GET_SHARE_REPORT_SCENARIO_REPORT_LIST + "/" + GEN_SHARE_ID + "/" + "test"))
|
||||
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
|
||||
.andExpect(status().is5xxServerError());
|
||||
|
||||
mockMvc.perform(getRequestBuilder(GET_SHARE_REPORT_SCENARIO_REPORT_LIST + "/get/" + GEN_SHARE_ID + "/" + "test" + "/111"))
|
||||
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
|
||||
.andExpect(status().isOk());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(9)
|
||||
void testGetShareReport() throws Exception{
|
||||
void testGetShareReport() throws Exception {
|
||||
// 获取分享的报告
|
||||
this.requestGet(GET_SHARE_REPORT + "/" + GEN_SHARE_ID + "/test-plan-report-id-1");
|
||||
ProjectApplicationExample example = new ProjectApplicationExample();
|
||||
@ -287,6 +309,7 @@ public class TestPlanReportControllerTests extends BaseTest {
|
||||
this.requestPostWithOk(GET_PLAN_REPORT_DETAIL_FUNCTIONAL_PAGE, request);
|
||||
this.requestPostWithOk(GET_PLAN_REPORT_DETAIL_API_PAGE, request);
|
||||
this.requestPostWithOk(GET_PLAN_REPORT_DETAIL_SCENARIO_PAGE, request);
|
||||
this.requestPostWithOk(GET_PLAN_REPORT_DETAIL_PLAN_PAGE, request);
|
||||
request.setSort(Map.of("num", "asc"));
|
||||
this.requestPostWithOk(GET_PLAN_REPORT_DETAIL_FUNCTIONAL_PAGE, request);
|
||||
this.requestPostWithOk(GET_PLAN_REPORT_DETAIL_API_PAGE, request);
|
||||
@ -368,6 +391,7 @@ public class TestPlanReportControllerTests extends BaseTest {
|
||||
|
||||
/**
|
||||
* 获取生成的报告ID
|
||||
*
|
||||
* @param planId 计划ID
|
||||
* @return 报告ID
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user