fix(测试跟踪): 导出测试计划报告时自动化用例报告的获取方法使用分流处理
--bug=1026654 --user=宋天阳 【测试跟踪】github#24697,测试计划导出报告报错 https://www.tapd.cn/55049933/s/1386303
This commit is contained in:
parent
9405957a2f
commit
113e31bd73
|
@ -10,6 +10,7 @@ import io.metersphere.plan.request.api.ApiTestCaseRequest;
|
||||||
import io.metersphere.plan.service.TestPlanService;
|
import io.metersphere.plan.service.TestPlanService;
|
||||||
import io.metersphere.plan.utils.TestPlanReportUtil;
|
import io.metersphere.plan.utils.TestPlanReportUtil;
|
||||||
import io.metersphere.plan.utils.TestPlanStatusCalculator;
|
import io.metersphere.plan.utils.TestPlanStatusCalculator;
|
||||||
|
import io.metersphere.utils.BatchProcessingUtil;
|
||||||
import io.metersphere.utils.DiscoveryUtil;
|
import io.metersphere.utils.DiscoveryUtil;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
|
@ -181,7 +182,15 @@ public class PlanTestPlanApiCaseService extends ApiTestService {
|
||||||
if (CollectionUtils.isEmpty(apiAllCases)) {
|
if (CollectionUtils.isEmpty(apiAllCases)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return microService.postForDataArray(serviceName, BASE_UEL + "/build/response", apiAllCases, TestPlanApiDTO.class);
|
//分批处理参数时为了不影响初始参数,这里使用新的对象进行处理
|
||||||
|
List<TestPlanApiDTO> returnList = new ArrayList<>();
|
||||||
|
List<TestPlanApiDTO> paramList = new ArrayList<>(apiAllCases);
|
||||||
|
while (CollectionUtils.isNotEmpty(paramList)) {
|
||||||
|
List<TestPlanApiDTO> requestList = BatchProcessingUtil.subList(paramList, 20);
|
||||||
|
returnList.addAll(microService.postForDataArray(serviceName, BASE_UEL + "/build/response", requestList, TestPlanApiDTO.class));
|
||||||
|
paramList.removeAll(requestList);
|
||||||
|
}
|
||||||
|
return returnList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object relevanceList(int pageNum, int pageSize, ApiTestCaseRequest request) {
|
public Object relevanceList(int pageNum, int pageSize, ApiTestCaseRequest request) {
|
||||||
|
|
|
@ -12,6 +12,7 @@ import io.metersphere.plan.request.api.ApiScenarioRequest;
|
||||||
import io.metersphere.plan.service.TestPlanService;
|
import io.metersphere.plan.service.TestPlanService;
|
||||||
import io.metersphere.plan.utils.TestPlanReportUtil;
|
import io.metersphere.plan.utils.TestPlanReportUtil;
|
||||||
import io.metersphere.plan.utils.TestPlanStatusCalculator;
|
import io.metersphere.plan.utils.TestPlanStatusCalculator;
|
||||||
|
import io.metersphere.utils.BatchProcessingUtil;
|
||||||
import io.metersphere.utils.DiscoveryUtil;
|
import io.metersphere.utils.DiscoveryUtil;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
|
@ -195,7 +196,15 @@ public class PlanTestPlanScenarioCaseService extends ApiTestService {
|
||||||
if (CollectionUtils.isEmpty(scenarioCases)) {
|
if (CollectionUtils.isEmpty(scenarioCases)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return microService.postForDataArray(serviceName, BASE_UEL + "/build/response", scenarioCases, TestPlanScenarioDTO.class);
|
//分批处理参数时为了不影响初始参数,这里使用新的对象进行处理
|
||||||
|
List<TestPlanScenarioDTO> paramList = new ArrayList<>(scenarioCases);
|
||||||
|
List<TestPlanScenarioDTO> returnList = new ArrayList<>();
|
||||||
|
while (CollectionUtils.isNotEmpty(paramList)) {
|
||||||
|
List<TestPlanScenarioDTO> requestList = BatchProcessingUtil.subList(paramList, 5);
|
||||||
|
returnList.addAll(microService.postForDataArray(serviceName, BASE_UEL + "/build/response", scenarioCases, TestPlanScenarioDTO.class));
|
||||||
|
paramList.removeAll(requestList);
|
||||||
|
}
|
||||||
|
return returnList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object relevanceList(ApiScenarioRequest request, int pageNum, int pageSize) {
|
public Object relevanceList(ApiScenarioRequest request, int pageNum, int pageSize) {
|
||||||
|
|
|
@ -15,6 +15,7 @@ import io.metersphere.plan.request.performance.LoadPlanReportDTO;
|
||||||
import io.metersphere.plan.service.TestPlanService;
|
import io.metersphere.plan.service.TestPlanService;
|
||||||
import io.metersphere.plan.utils.TestPlanReportUtil;
|
import io.metersphere.plan.utils.TestPlanReportUtil;
|
||||||
import io.metersphere.plan.utils.TestPlanStatusCalculator;
|
import io.metersphere.plan.utils.TestPlanStatusCalculator;
|
||||||
|
import io.metersphere.utils.BatchProcessingUtil;
|
||||||
import io.metersphere.utils.DiscoveryUtil;
|
import io.metersphere.utils.DiscoveryUtil;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
|
@ -138,7 +139,14 @@ public class PlanTestPlanLoadCaseService extends LoadTestService {
|
||||||
if (CollectionUtils.isEmpty(loadCases)) {
|
if (CollectionUtils.isEmpty(loadCases)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
List<TestPlanLoadCaseDTO> returnList = microService.postForDataArray(serviceName, BASE_UEL + "/build/response", loadCases, TestPlanLoadCaseDTO.class);
|
//分批处理参数时为了不影响初始参数,这里使用新的对象进行处理
|
||||||
|
List<TestPlanLoadCaseDTO> paramList = new ArrayList<>(loadCases);
|
||||||
|
List<TestPlanLoadCaseDTO> returnList = new ArrayList<>();
|
||||||
|
while (CollectionUtils.isNotEmpty(paramList)) {
|
||||||
|
List<TestPlanLoadCaseDTO> requestList = BatchProcessingUtil.subList(paramList, 5);
|
||||||
|
returnList.addAll(microService.postForDataArray(serviceName, BASE_UEL + "/build/response", loadCases, TestPlanLoadCaseDTO.class));
|
||||||
|
paramList.removeAll(requestList);
|
||||||
|
}
|
||||||
return returnList;
|
return returnList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@ import io.metersphere.plan.service.remote.api.PlanUiScenarioReportService;
|
||||||
import io.metersphere.plan.utils.TestPlanReportUtil;
|
import io.metersphere.plan.utils.TestPlanReportUtil;
|
||||||
import io.metersphere.plan.utils.TestPlanStatusCalculator;
|
import io.metersphere.plan.utils.TestPlanStatusCalculator;
|
||||||
import io.metersphere.request.ResetOrderRequest;
|
import io.metersphere.request.ResetOrderRequest;
|
||||||
|
import io.metersphere.utils.BatchProcessingUtil;
|
||||||
import io.metersphere.utils.DiscoveryUtil;
|
import io.metersphere.utils.DiscoveryUtil;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
|
@ -158,7 +159,16 @@ public class PlanTestPlanUiScenarioCaseService extends UiTestService {
|
||||||
if (CollectionUtils.isEmpty(uiCases)) {
|
if (CollectionUtils.isEmpty(uiCases)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return microService.postForDataArray(serviceName, BASE_URL + "/build/response", uiCases, TestPlanUiScenarioDTO.class);
|
|
||||||
|
//分批处理参数时为了不影响初始参数,这里使用新的对象进行处理
|
||||||
|
List<TestPlanUiScenarioDTO> paramList = new ArrayList<>(uiCases);
|
||||||
|
List<TestPlanUiScenarioDTO> returnList = new ArrayList<>();
|
||||||
|
while (CollectionUtils.isNotEmpty(paramList)) {
|
||||||
|
List<TestPlanUiScenarioDTO> requestList = BatchProcessingUtil.subList(paramList, 5);
|
||||||
|
returnList.addAll(microService.postForDataArray(serviceName, BASE_URL + "/build/response", uiCases, TestPlanUiScenarioDTO.class));
|
||||||
|
paramList.removeAll(requestList);
|
||||||
|
}
|
||||||
|
return returnList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object relevanceList(ApiScenarioRequest request, int pageNum, int pageSize) {
|
public Object relevanceList(ApiScenarioRequest request, int pageNum, int pageSize) {
|
||||||
|
|
|
@ -95,4 +95,15 @@ public class BatchProcessingUtil {
|
||||||
}
|
}
|
||||||
return returnList;
|
return returnList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static <T> List<T> subList(List<T> paramList, int size) {
|
||||||
|
if (CollectionUtils.isNotEmpty(paramList)) {
|
||||||
|
if (paramList.size() > size) {
|
||||||
|
return paramList.subList(0, size);
|
||||||
|
} else {
|
||||||
|
return paramList;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue