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) {
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.setProjectId(projectId);
// 初始化集成报告与用例的关联关系
@ -369,7 +369,7 @@ public class ApiTestCaseBatchRunService {
private ApiReport getApiReport(ApiRunModeConfigDTO runModeConfig, ApiTestCase apiTestCase, String userId) {
ApiReport apiReport = getApiReport(runModeConfig, userId);
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.setTriggerMode(TaskTriggerMode.BATCH.name());
return apiReport;

View File

@ -724,7 +724,7 @@ public class ApiTestCaseService extends MoveNodeService {
ApiReport apiReport = getApiReport(userId);
apiReport.setId(reportId);
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.setPoolId(poolId);
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.ExecutionQueueDetail;
import io.metersphere.sdk.util.BeanUtils;
import io.metersphere.sdk.util.DateUtils;
import io.metersphere.sdk.util.LogUtils;
import io.metersphere.system.uid.IDGenerator;
import jakarta.annotation.Resource;
@ -236,7 +237,7 @@ public class ApiScenarioBatchRunService {
*/
private ApiScenarioReport initIntegratedReport(ApiRunModeConfigDTO runModeConfig, List<String> ids, String userId, String projectId) {
ApiScenarioReport apiScenarioReport = getScenarioReport(runModeConfig, userId);
apiScenarioReport.setName(runModeConfig.getCollectionReport().getReportName());
apiScenarioReport.setName(runModeConfig.getCollectionReport().getReportName() + "_" + DateUtils.getTimeString(System.currentTimeMillis()));
apiScenarioReport.setIntegrated(true);
apiScenarioReport.setProjectId(projectId);
// 初始化集成报告与用例的关联关系
@ -334,7 +335,7 @@ public class ApiScenarioBatchRunService {
private ApiScenarioReport getScenarioReport(ApiRunModeConfigDTO runModeConfig, ApiScenario apiScenario, String userId) {
ApiScenarioReport apiScenarioReport = getScenarioReport(runModeConfig, userId);
apiScenarioReport.setEnvironmentId(getEnvId(runModeConfig, apiScenario));
apiScenarioReport.setName(apiScenario.getName());
apiScenarioReport.setName(apiScenario.getName() + "_" + DateUtils.getTimeString(System.currentTimeMillis()));
apiScenarioReport.setProjectId(apiScenario.getProjectId());
apiScenarioReport.setTriggerMode(TaskTriggerMode.BATCH.name());
return apiScenarioReport;

View File

@ -1292,7 +1292,7 @@ public class ApiScenarioService extends MoveNodeService {
ApiScenarioReport scenarioReport = getScenarioReport(userId);
scenarioReport.setId(reportId);
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.setPoolId(poolId);
scenarioReport.setEnvironmentId(apiScenario.getEnvironmentId());