fix(接口测试): 测试计划执行,明细的报告耗时显示有误

--bug=1046028 --user=陈建星 [接口测试]github#32918测试计划报告中的单场景报告中的“报告总耗时”指标统计错误 https://www.tapd.cn/55049933/s/1591890
This commit is contained in:
AgAngle 2024-10-15 10:53:08 +08:00 committed by Craftsman
parent 28a090f5dc
commit e03fb236e4
4 changed files with 58 additions and 2 deletions

View File

@ -0,0 +1,27 @@
package io.metersphere.sdk.dto.pool;
import lombok.Data;
/**
* @Author: jianxing
* @CreateTime: 2024-10-14 18:28
*/
@Data
public class ResourcePoolNodeMetric {
/**
* 并发数
*/
private Integer concurrentNumber;
/**
* 已占用的并发数
*/
private Integer occupiedConcurrentNumber;
/**
* CPU使用率
*/
private Double CPUUsage;
/**
* 内存使用率
*/
private Double memoryUsage;
}

View File

@ -57,9 +57,9 @@ public class ApiExecuteResourceService {
// 非调试执行更新报告状态 // 非调试执行更新报告状态
switch (apiExecuteResourceType) { switch (apiExecuteResourceType) {
case API_SCENARIO, TEST_PLAN_API_SCENARIO, PLAN_RUN_API_SCENARIO -> case API_SCENARIO, TEST_PLAN_API_SCENARIO, PLAN_RUN_API_SCENARIO ->
apiScenarioReportService.updateReportStatus(reportId, ExecStatus.RUNNING.name()); apiScenarioReportService.updateReportRunningStatus(reportId);
case API_CASE, TEST_PLAN_API_CASE, PLAN_RUN_API_CASE -> case API_CASE, TEST_PLAN_API_CASE, PLAN_RUN_API_CASE ->
apiReportService.updateReportStatus(reportId, ExecStatus.RUNNING.name()); apiReportService.updateReportRunningStatus(reportId);
default -> throw new MSException("不支持的资源类型: " + request.getResourceType()); default -> throw new MSException("不支持的资源类型: " + request.getResourceType());
} }
} }

View File

@ -250,6 +250,21 @@ public class ApiReportService {
return apiReportDetails; return apiReportDetails;
} }
/**
* 更新执行中的用例报告
*
* @param reportId
*/
public void updateReportRunningStatus(String reportId) {
ApiReport apiReport = new ApiReport();
apiReport.setId(reportId);
apiReport.setExecStatus(ExecStatus.RUNNING.name());
apiReport.setStartTime(System.currentTimeMillis());
apiReport.setUpdateTime(System.currentTimeMillis());
apiReportMapper.updateByPrimaryKeySelective(apiReport);
}
/** /**
* 更新执行中的用例报告 * 更新执行中的用例报告
* *

View File

@ -371,6 +371,20 @@ public class ApiScenarioReportService {
return apiReportDetails; return apiReportDetails;
} }
/**
* 更新进行中的报告状态和开始执行时间
*
* @param reportId
*/
public void updateReportRunningStatus(String reportId) {
ApiScenarioReport scenarioReport = new ApiScenarioReport();
scenarioReport.setId(reportId);
scenarioReport.setExecStatus(ExecStatus.RUNNING.name());
scenarioReport.setStartTime(System.currentTimeMillis());
scenarioReport.setUpdateTime(System.currentTimeMillis());
apiScenarioReportMapper.updateByPrimaryKeySelective(scenarioReport);
}
/** /**
* 更新执行中的场景报告 * 更新执行中的场景报告
* *