fix(测试跟踪): 修复测试计划报告里接口场景用例创建人不显示的问题
--bug=1012770 --user=宋天阳 【jenkins插件】通过jenkins执行测试计划,报告中接口用例创建人为空 https://www.tapd.cn/55049933/s/1148362
This commit is contained in:
parent
35b4b87f9e
commit
5bac642bc3
|
@ -171,7 +171,7 @@ public class ShareController {
|
|||
@GetMapping("/api/scenario/report/get/{shareId}/{reportId}")
|
||||
public APIScenarioReportResult get(@PathVariable String shareId, @PathVariable String reportId) {
|
||||
shareInfoService.validateExpired(shareId); // 测试计划,和接口都会用这个
|
||||
return apiScenarioReportService.get(reportId,false);
|
||||
return apiScenarioReportService.get(reportId,true);
|
||||
}
|
||||
|
||||
@GetMapping("/performance/report/{shareId}/{reportId}")
|
||||
|
|
|
@ -96,6 +96,8 @@ public class TestPlanService {
|
|||
@Resource
|
||||
TestPlanTestCaseMapper testPlanTestCaseMapper;
|
||||
@Resource
|
||||
UserService userService;
|
||||
@Resource
|
||||
SqlSessionFactory sqlSessionFactory;
|
||||
@Lazy
|
||||
@Resource
|
||||
|
@ -1545,7 +1547,6 @@ public class TestPlanService {
|
|||
} else if (MapUtils.isNotEmpty(testPlanExecuteReportDTO.getTestPlanApiCaseIdAndReportIdMap())) {
|
||||
apiAllCases = testPlanApiCaseService.getByApiExecReportIds(testPlanExecuteReportDTO.getTestPlanApiCaseIdAndReportIdMap());
|
||||
}
|
||||
report.setApiAllCases(apiAllCases);
|
||||
|
||||
//场景
|
||||
if (CollectionUtils.isNotEmpty(testPlanExecuteReportDTO.getScenarioInfoDTOList())) {
|
||||
|
@ -1553,6 +1554,8 @@ public class TestPlanService {
|
|||
} else if (MapUtils.isNotEmpty(testPlanExecuteReportDTO.getTestPlanScenarioIdAndReportIdMap())) {
|
||||
scenarioAllCases = testPlanScenarioCaseService.getAllCases(testPlanExecuteReportDTO.getTestPlanScenarioIdAndReportIdMap());
|
||||
}
|
||||
this.checkApiCaseCreatorName(apiAllCases,scenarioAllCases);
|
||||
report.setApiAllCases(apiAllCases);
|
||||
report.setScenarioAllCases(scenarioAllCases);
|
||||
}
|
||||
|
||||
|
@ -1562,6 +1565,46 @@ public class TestPlanService {
|
|||
}
|
||||
}
|
||||
|
||||
private void checkApiCaseCreatorName(List<TestPlanFailureApiDTO> apiCases,List<TestPlanFailureScenarioDTO> scenarioCases) {
|
||||
List<String> userIdList = new ArrayList<>();
|
||||
if (CollectionUtils.isNotEmpty(apiCases)) {
|
||||
apiCases.forEach(item -> {
|
||||
if (StringUtils.isEmpty(item.getCreatorName()) && StringUtils.isNotEmpty(item.getCreateUserId())) {
|
||||
userIdList.add(item.getCreateUserId());
|
||||
}
|
||||
});
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(scenarioCases)) {
|
||||
scenarioCases.forEach(item -> {
|
||||
if (StringUtils.isEmpty(item.getCreatorName()) && StringUtils.isNotEmpty(item.getCreateUser())) {
|
||||
userIdList.add(item.getCreateUser());
|
||||
}
|
||||
});
|
||||
}
|
||||
Map<String, User> usersMap = userService.queryNameByIds(userIdList);
|
||||
if (CollectionUtils.isNotEmpty(apiCases)) {
|
||||
for (TestPlanFailureApiDTO dto : apiCases) {
|
||||
if (StringUtils.isEmpty(dto.getCreatorName())) {
|
||||
User user = usersMap.get(dto.getCreateUserId());
|
||||
if (user != null) {
|
||||
dto.setCreatorName(user.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(scenarioCases)) {
|
||||
for (TestPlanFailureScenarioDTO dto : scenarioCases) {
|
||||
if (StringUtils.isEmpty(dto.getCreatorName())) {
|
||||
User user = usersMap.get(dto.getCreateUser());
|
||||
if (user != null) {
|
||||
dto.setCreatorName(user.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void screenScenariosByStatusAndReportConfig(TestPlanSimpleReportDTO report, List<TestPlanFailureScenarioDTO> scenarios, JSONObject reportConfig) {
|
||||
|
||||
if (!CollectionUtils.isEmpty(scenarios)) {
|
||||
|
|
Loading…
Reference in New Issue