feat(测试跟踪): 模块树支持过滤功能

--story=1010667 --user=张勇 【UI/接口测试】模块树支持过滤功能 https://www.tapd.cn/55049933/s/1316102
This commit is contained in:
zhangyong 2022-12-15 21:47:00 +08:00 committed by zhangyongfit2cloud
parent dc0afe9c2c
commit f786537863
5 changed files with 29 additions and 21 deletions

View File

@ -376,8 +376,13 @@ public class TestPlanController {
testPlanService.resetStatus(planId); testPlanService.resetStatus(planId);
} }
@GetMapping("/ext/report/{planId}") @GetMapping("/ext/report/{reportId}")
public TestPlanExtReportDTO getExtReport(@PathVariable String planId) throws JsonProcessingException { public TestPlanExtReportDTO getExtReport(@PathVariable String reportId) throws JsonProcessingException {
return testPlanService.getExtReport(planId); return testPlanService.getExtInfoByReportId(reportId);
}
@GetMapping("/ext/plan/{planId}")
public TestPlanExtReportDTO getExtPlan(@PathVariable String planId) throws JsonProcessingException {
return testPlanService.getExtInfoByPlanId(planId);
} }
} }

View File

@ -1049,7 +1049,7 @@ public class TestPlanReportService {
TestPlanService testPlanService = CommonBeanFactory.getBean(TestPlanService.class); TestPlanService testPlanService = CommonBeanFactory.getBean(TestPlanService.class);
TestPlanExtReportDTO extReport = null; TestPlanExtReportDTO extReport = null;
try { try {
extReport = testPlanService.getExtReportByReportId(reportId); extReport = testPlanService.getExtInfoByReportId(reportId);
} catch (JsonProcessingException e) { } catch (JsonProcessingException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }

View File

@ -1388,7 +1388,7 @@ public class TestPlanService {
public void exportPlanReport(String planId, String lang, HttpServletResponse response) throws UnsupportedEncodingException, JsonProcessingException { public void exportPlanReport(String planId, String lang, HttpServletResponse response) throws UnsupportedEncodingException, JsonProcessingException {
TestPlanSimpleReportDTO report = buildPlanReport(planId, true); TestPlanSimpleReportDTO report = buildPlanReport(planId, true);
report.setLang(lang); report.setLang(lang);
TestPlanExtReportDTO extReport = getExtReport(planId); TestPlanExtReportDTO extReport = getExtInfoByPlanId(planId);
if(extReport != null) { if(extReport != null) {
BeanUtils.copyBean(report, extReport); BeanUtils.copyBean(report, extReport);
} }
@ -1397,7 +1397,7 @@ public class TestPlanService {
public void exportPlanDbReport(String reportId, String lang, HttpServletResponse response) throws UnsupportedEncodingException, JsonProcessingException { public void exportPlanDbReport(String reportId, String lang, HttpServletResponse response) throws UnsupportedEncodingException, JsonProcessingException {
TestPlanSimpleReportDTO report = testPlanReportService.getReport(reportId); TestPlanSimpleReportDTO report = testPlanReportService.getReport(reportId);
TestPlanExtReportDTO extReport = getExtReportByReportId(reportId); TestPlanExtReportDTO extReport = getExtInfoByReportId(reportId);
if(extReport != null) { if(extReport != null) {
BeanUtils.copyBean(report, extReport); BeanUtils.copyBean(report, extReport);
} }
@ -1967,11 +1967,7 @@ public class TestPlanService {
this.deleteTestPlans(ids); this.deleteTestPlans(ids);
} }
public TestPlanExtReportDTO getExtReport(String planId) throws JsonProcessingException { public TestPlanExtReportDTO getExtInfoByReportId(String reportId) throws JsonProcessingException {
String reportId = testPlanReportService.getLastReportByPlanId(planId);
if(StringUtils.isEmpty(reportId)){
return null;
}
TestPlanExtReportDTO testPlanExtReportDTO = new TestPlanExtReportDTO(); TestPlanExtReportDTO testPlanExtReportDTO = new TestPlanExtReportDTO();
Set<String> serviceIdSet = DiscoveryUtil.getServiceIdSet(); Set<String> serviceIdSet = DiscoveryUtil.getServiceIdSet();
if (serviceIdSet.contains(MicroServiceName.API_TEST)) { if (serviceIdSet.contains(MicroServiceName.API_TEST)) {
@ -1992,7 +1988,7 @@ public class TestPlanService {
return testPlanExtReportDTO; return testPlanExtReportDTO;
} }
} }
return null; return testPlanExtReportDTO;
} }
private void convertEnvConfig(String envConfig, TestPlanExtReportDTO testPlanExtReportDTO) throws JsonProcessingException { private void convertEnvConfig(String envConfig, TestPlanExtReportDTO testPlanExtReportDTO) throws JsonProcessingException {
@ -2017,7 +2013,11 @@ public class TestPlanService {
testPlanExtReportDTO.setResourcePool(testResourcePool == null ? null : testResourcePool.getName()); testPlanExtReportDTO.setResourcePool(testResourcePool == null ? null : testResourcePool.getName());
} }
public TestPlanExtReportDTO getExtReportByReportId(String reportId) throws JsonProcessingException { public TestPlanExtReportDTO getExtInfoByPlanId(String planId) throws JsonProcessingException {
String reportId = testPlanReportService.getLastReportByPlanId(planId);
if(StringUtils.isEmpty(reportId)){
return null;
}
TestPlanExtReportDTO testPlanExtReportDTO = new TestPlanExtReportDTO(); TestPlanExtReportDTO testPlanExtReportDTO = new TestPlanExtReportDTO();
Set<String> serviceIdSet = DiscoveryUtil.getServiceIdSet(); Set<String> serviceIdSet = DiscoveryUtil.getServiceIdSet();
if (serviceIdSet.contains(MicroServiceName.API_TEST)) { if (serviceIdSet.contains(MicroServiceName.API_TEST)) {
@ -2038,6 +2038,6 @@ public class TestPlanService {
return testPlanExtReportDTO; return testPlanExtReportDTO;
} }
} }
return null; return testPlanExtReportDTO;
} }
} }

View File

@ -309,9 +309,13 @@ export function testPlanLoadCaseEditStatus(planId) {
return post(BASE_URL + `edit/status/${planId}`, new Promise(() => {})); return post(BASE_URL + `edit/status/${planId}`, new Promise(() => {}));
} }
export function getTestPlanExtReport(planId) { export function getTestPlanExtReport(planId, reportId) {
if (planId) { if (reportId) {
return get('/test/plan/ext/report/' + planId); return get('/test/plan/ext/report/' + reportId);
} else if (planId) {
return get('/test/plan/ext/plan/' + planId);
} else {
return {};
} }
} }

View File

@ -71,13 +71,13 @@ export default {
isDb: Boolean, isDb: Boolean,
shareId: String, shareId: String,
reportId: String, reportId: String,
runMode: String,
resourcePool: String,
needMoveBar: Boolean needMoveBar: Boolean
}, },
data() { data() {
return { return {
report: {}, report: {},
runMode: '',
resourcePool: '',
loading: false, loading: false,
shareUrl: '' shareUrl: ''
}; };
@ -187,8 +187,7 @@ export default {
}); });
} }
} }
getTestPlanExtReport(this.planId, this.reportId).then((response) => {
getTestPlanExtReport(this.planId).then((response) => {
this.runMode = response.data.runMode; this.runMode = response.data.runMode;
this.resourcePool = response.data.resourcePool; this.resourcePool = response.data.resourcePool;
}) })