refactor(接口测试): 接口报告命名优化

This commit is contained in:
AgAngle 2024-03-28 10:38:49 +08:00 committed by Craftsman
parent 2157d8670d
commit f76ac42e24
4 changed files with 7 additions and 6 deletions

View File

@ -274,7 +274,7 @@ public class ApiTestCaseBatchRunService {
*/ */
private ApiReport initIntegratedReport(ApiRunModeConfigDTO runModeConfig, List<String> ids, String userId, String projectId) { private ApiReport initIntegratedReport(ApiRunModeConfigDTO runModeConfig, List<String> ids, String userId, String projectId) {
ApiReport apiReport = getApiReport(runModeConfig, userId); ApiReport apiReport = getApiReport(runModeConfig, userId);
apiReport.setName(runModeConfig.getCollectionReport().getReportName() + DateUtils.getTimeString(System.currentTimeMillis())); apiReport.setName(runModeConfig.getCollectionReport().getReportName() + "_" + DateUtils.getTimeString(System.currentTimeMillis()));
apiReport.setIntegrated(true); apiReport.setIntegrated(true);
apiReport.setProjectId(projectId); apiReport.setProjectId(projectId);
// 初始化集成报告与用例的关联关系 // 初始化集成报告与用例的关联关系
@ -369,7 +369,7 @@ public class ApiTestCaseBatchRunService {
private ApiReport getApiReport(ApiRunModeConfigDTO runModeConfig, ApiTestCase apiTestCase, String userId) { private ApiReport getApiReport(ApiRunModeConfigDTO runModeConfig, ApiTestCase apiTestCase, String userId) {
ApiReport apiReport = getApiReport(runModeConfig, userId); ApiReport apiReport = getApiReport(runModeConfig, userId);
apiReport.setEnvironmentId(getEnvId(runModeConfig, apiTestCase)); apiReport.setEnvironmentId(getEnvId(runModeConfig, apiTestCase));
apiReport.setName(apiTestCase.getName() + DateUtils.getTimeString(System.currentTimeMillis())); apiReport.setName(apiTestCase.getName() + "_" + DateUtils.getTimeString(System.currentTimeMillis()));
apiReport.setProjectId(apiTestCase.getProjectId()); apiReport.setProjectId(apiTestCase.getProjectId());
apiReport.setTriggerMode(TaskTriggerMode.BATCH.name()); apiReport.setTriggerMode(TaskTriggerMode.BATCH.name());
return apiReport; return apiReport;

View File

@ -724,7 +724,7 @@ public class ApiTestCaseService extends MoveNodeService {
ApiReport apiReport = getApiReport(userId); ApiReport apiReport = getApiReport(userId);
apiReport.setId(reportId); apiReport.setId(reportId);
apiReport.setTriggerMode(TaskTriggerMode.MANUAL.name()); apiReport.setTriggerMode(TaskTriggerMode.MANUAL.name());
apiReport.setName(apiTestCase.getName() + DateUtils.getTimeString(System.currentTimeMillis())); apiReport.setName(apiTestCase.getName() + "_" + DateUtils.getTimeString(System.currentTimeMillis()));
apiReport.setRunMode(ApiBatchRunMode.PARALLEL.name()); apiReport.setRunMode(ApiBatchRunMode.PARALLEL.name());
apiReport.setPoolId(poolId); apiReport.setPoolId(poolId);
apiReport.setEnvironmentId(apiTestCase.getEnvironmentId()); apiReport.setEnvironmentId(apiTestCase.getEnvironmentId());

View File

@ -23,6 +23,7 @@ import io.metersphere.sdk.dto.api.task.TaskRequestDTO;
import io.metersphere.sdk.dto.queue.ExecutionQueue; import io.metersphere.sdk.dto.queue.ExecutionQueue;
import io.metersphere.sdk.dto.queue.ExecutionQueueDetail; import io.metersphere.sdk.dto.queue.ExecutionQueueDetail;
import io.metersphere.sdk.util.BeanUtils; import io.metersphere.sdk.util.BeanUtils;
import io.metersphere.sdk.util.DateUtils;
import io.metersphere.sdk.util.LogUtils; import io.metersphere.sdk.util.LogUtils;
import io.metersphere.system.uid.IDGenerator; import io.metersphere.system.uid.IDGenerator;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
@ -236,7 +237,7 @@ public class ApiScenarioBatchRunService {
*/ */
private ApiScenarioReport initIntegratedReport(ApiRunModeConfigDTO runModeConfig, List<String> ids, String userId, String projectId) { private ApiScenarioReport initIntegratedReport(ApiRunModeConfigDTO runModeConfig, List<String> ids, String userId, String projectId) {
ApiScenarioReport apiScenarioReport = getScenarioReport(runModeConfig, userId); ApiScenarioReport apiScenarioReport = getScenarioReport(runModeConfig, userId);
apiScenarioReport.setName(runModeConfig.getCollectionReport().getReportName()); apiScenarioReport.setName(runModeConfig.getCollectionReport().getReportName() + "_" + DateUtils.getTimeString(System.currentTimeMillis()));
apiScenarioReport.setIntegrated(true); apiScenarioReport.setIntegrated(true);
apiScenarioReport.setProjectId(projectId); apiScenarioReport.setProjectId(projectId);
// 初始化集成报告与用例的关联关系 // 初始化集成报告与用例的关联关系
@ -334,7 +335,7 @@ public class ApiScenarioBatchRunService {
private ApiScenarioReport getScenarioReport(ApiRunModeConfigDTO runModeConfig, ApiScenario apiScenario, String userId) { private ApiScenarioReport getScenarioReport(ApiRunModeConfigDTO runModeConfig, ApiScenario apiScenario, String userId) {
ApiScenarioReport apiScenarioReport = getScenarioReport(runModeConfig, userId); ApiScenarioReport apiScenarioReport = getScenarioReport(runModeConfig, userId);
apiScenarioReport.setEnvironmentId(getEnvId(runModeConfig, apiScenario)); apiScenarioReport.setEnvironmentId(getEnvId(runModeConfig, apiScenario));
apiScenarioReport.setName(apiScenario.getName()); apiScenarioReport.setName(apiScenario.getName() + "_" + DateUtils.getTimeString(System.currentTimeMillis()));
apiScenarioReport.setProjectId(apiScenario.getProjectId()); apiScenarioReport.setProjectId(apiScenario.getProjectId());
apiScenarioReport.setTriggerMode(TaskTriggerMode.BATCH.name()); apiScenarioReport.setTriggerMode(TaskTriggerMode.BATCH.name());
return apiScenarioReport; return apiScenarioReport;

View File

@ -1292,7 +1292,7 @@ public class ApiScenarioService extends MoveNodeService {
ApiScenarioReport scenarioReport = getScenarioReport(userId); ApiScenarioReport scenarioReport = getScenarioReport(userId);
scenarioReport.setId(reportId); scenarioReport.setId(reportId);
scenarioReport.setTriggerMode(TaskTriggerMode.MANUAL.name()); scenarioReport.setTriggerMode(TaskTriggerMode.MANUAL.name());
scenarioReport.setName(apiScenario.getName() + DateUtils.getTimeString(System.currentTimeMillis())); scenarioReport.setName(apiScenario.getName() + "_" + DateUtils.getTimeString(System.currentTimeMillis()));
scenarioReport.setRunMode(ApiBatchRunMode.PARALLEL.name()); scenarioReport.setRunMode(ApiBatchRunMode.PARALLEL.name());
scenarioReport.setPoolId(poolId); scenarioReport.setPoolId(poolId);
scenarioReport.setEnvironmentId(apiScenario.getEnvironmentId()); scenarioReport.setEnvironmentId(apiScenario.getEnvironmentId());