refactor(接口测试): 优化报告查询资源池的逻辑
This commit is contained in:
parent
c005915b68
commit
b6aca28506
|
@ -15,6 +15,7 @@ import io.metersphere.sdk.mapper.EnvironmentMapper;
|
|||
import io.metersphere.sdk.util.BeanUtils;
|
||||
import io.metersphere.sdk.util.SubListUtils;
|
||||
import io.metersphere.sdk.util.Translator;
|
||||
import io.metersphere.system.domain.TestResourcePool;
|
||||
import io.metersphere.system.domain.User;
|
||||
import io.metersphere.system.mapper.TestResourcePoolMapper;
|
||||
import io.metersphere.system.mapper.UserMapper;
|
||||
|
@ -194,7 +195,8 @@ public class ApiReportService {
|
|||
apiReportDTO.setConsole(String.join("\n", consoleList));
|
||||
}
|
||||
//查询资源池名称
|
||||
apiReportDTO.setPoolName(testResourcePoolMapper.selectByPrimaryKey(apiReportDTO.getPoolId()).getName());
|
||||
TestResourcePool testResourcePool = testResourcePoolMapper.selectByPrimaryKey(apiReportDTO.getPoolId());
|
||||
apiReportDTO.setPoolName(testResourcePool != null ? testResourcePool.getName() : null);
|
||||
//查询环境名称
|
||||
String environmentName = null;
|
||||
if (StringUtils.isNoneBlank(apiReportDTO.getEnvironmentId())) {
|
||||
|
|
|
@ -9,7 +9,6 @@ import io.metersphere.api.dto.scenario.ApiScenarioReportDTO;
|
|||
import io.metersphere.api.dto.scenario.ApiScenarioReportDetailDTO;
|
||||
import io.metersphere.api.dto.scenario.ApiScenarioReportStepDTO;
|
||||
import io.metersphere.api.mapper.*;
|
||||
import io.metersphere.api.utils.ApiDataUtils;
|
||||
import io.metersphere.sdk.constants.ExecStatus;
|
||||
import io.metersphere.sdk.constants.ReportStatus;
|
||||
import io.metersphere.sdk.domain.Environment;
|
||||
|
@ -19,6 +18,7 @@ import io.metersphere.sdk.mapper.EnvironmentMapper;
|
|||
import io.metersphere.sdk.util.BeanUtils;
|
||||
import io.metersphere.sdk.util.SubListUtils;
|
||||
import io.metersphere.sdk.util.Translator;
|
||||
import io.metersphere.system.domain.TestResourcePool;
|
||||
import io.metersphere.system.domain.User;
|
||||
import io.metersphere.system.mapper.TestResourcePoolMapper;
|
||||
import io.metersphere.system.mapper.UserMapper;
|
||||
|
@ -224,7 +224,8 @@ public class ApiScenarioReportService {
|
|||
scenarioReportDTO.setConsole(String.join("\n", consoleList));
|
||||
}
|
||||
//查询资源池名称
|
||||
scenarioReportDTO.setPoolName(testResourcePoolMapper.selectByPrimaryKey(scenarioReport.getPoolId()).getName());
|
||||
TestResourcePool testResourcePool = testResourcePoolMapper.selectByPrimaryKey(scenarioReport.getPoolId());
|
||||
scenarioReportDTO.setPoolName(testResourcePool != null ? testResourcePool.getName() : null);
|
||||
//查询环境名称
|
||||
String environmentName = null;
|
||||
if (StringUtils.isNotBlank(scenarioReport.getEnvironmentId())) {
|
||||
|
@ -353,7 +354,7 @@ public class ApiScenarioReportService {
|
|||
ApiScenarioReportDetailDTO apiScenarioReportDetail = apiReportDetails.get(Integer.parseInt(index) - 1);
|
||||
apiReportDetails = Collections.singletonList(apiScenarioReportDetail);
|
||||
}
|
||||
return apiReportDetails;
|
||||
return apiReportDetails;
|
||||
}
|
||||
|
||||
private List<ApiScenarioReportDetailDTO> checkResourceStep(String stepId, String reportId) {
|
||||
|
|
|
@ -362,7 +362,7 @@ public class ApiScenarioReportControllerTests extends BaseTest {
|
|||
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
|
||||
.andExpect(status().is5xxServerError());
|
||||
|
||||
mockMvc.perform(getRequestBuilder(GET + "scenario-report-id2000"))
|
||||
mockMvc.perform(getRequestBuilder(GET + "scenario-report-id200000"))
|
||||
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
|
||||
.andExpect(status().is5xxServerError());
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ export default {
|
|||
'project.taskCenter.batchExecution': 'Batch execution',
|
||||
'project.taskCenter.stop': 'stop',
|
||||
'project.taskCenter.execution': 'execution',
|
||||
'project.taskCenter.viewReport': 'View report',
|
||||
'project.taskCenter.viewReport': 'Execution Result',
|
||||
'project.taskCenter.batchStopTask': 'Are you sure to stop {num} tasks?',
|
||||
'project.taskCenter.stopTask': 'Are you sure to stop {name} task?',
|
||||
'project.taskCenter.stopTaskContent':
|
||||
|
|
|
@ -16,7 +16,7 @@ export default {
|
|||
'project.taskCenter.batchExecution': '批量执行',
|
||||
'project.taskCenter.stop': '停止',
|
||||
'project.taskCenter.execution': '执行',
|
||||
'project.taskCenter.viewReport': '查看报告',
|
||||
'project.taskCenter.viewReport': '执行结果',
|
||||
'project.taskCenter.batchStopTask': '确定停止 {num} 个任务吗?',
|
||||
'project.taskCenter.stopTask': '确定停止 {name} 个任务吗?',
|
||||
'project.taskCenter.stopTaskContent': '停止后会影响报告的生成,执行完成的报告不可以停止',
|
||||
|
|
Loading…
Reference in New Issue