fix(接口测试): 修复接口场景集合报告时生成报告出错的问题
--bug=1023161 --user=宋天阳 【接口测试】场景列表-批量执行-串行/并行-集合报告-local资源池-任务一直Running中 https://www.tapd.cn/55049933/s/1336500
This commit is contained in:
parent
085f826ce6
commit
8c222c5618
|
@ -217,7 +217,7 @@ public class TestResultService {
|
|||
|
||||
String environment = StringUtils.EMPTY;
|
||||
//执行人
|
||||
String userName = StringUtils.EMPTY;
|
||||
String userName = apiAutomationService.getUser(scenarioReport.getUserId());
|
||||
//负责人
|
||||
String principal = StringUtils.EMPTY;
|
||||
|
||||
|
@ -227,14 +227,21 @@ public class TestResultService {
|
|||
ApiScenarioWithBLOBs apiScenario = apiScenarioMapper.selectByPrimaryKey(testPlanApiScenario.getApiScenarioId());
|
||||
if (apiScenario != null) {
|
||||
scenarioExecutionInfoService.insertScenarioInfo(apiScenario, scenarioReport, dto);
|
||||
environment = apiScenarioReportService.getEnvironment(apiScenario);
|
||||
principal = apiAutomationService.getUser(apiScenario.getPrincipal());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ApiScenarioWithBLOBs apiScenario = apiScenarioMapper.selectByPrimaryKey(scenarioReport.getScenarioId());
|
||||
//集合报告查不出场景。场景的执行次数统计是在margeReport函数中进行的。所以这里要进行一个判断。
|
||||
if (apiScenario != null) {
|
||||
scenarioExecutionInfoService.insertScenarioInfo(apiScenario, scenarioReport, dto);
|
||||
environment = apiScenarioReportService.getEnvironment(apiScenario);
|
||||
userName = apiAutomationService.getUser(apiScenario.getUserId());
|
||||
principal = apiAutomationService.getUser(apiScenario.getPrincipal());
|
||||
} else {
|
||||
//负责人取当前负责人
|
||||
principal = apiAutomationService.getUser(scenarioReport.getUserId());
|
||||
}
|
||||
}
|
||||
|
||||
//报告内容
|
||||
|
|
|
@ -9,14 +9,14 @@ import io.metersphere.commons.enums.ExecutionExecuteTypeEnum;
|
|||
import io.metersphere.commons.utils.JSON;
|
||||
import io.metersphere.commons.utils.LogUtil;
|
||||
import io.metersphere.dto.ResultDTO;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
|
@ -48,6 +48,9 @@ public class ApiScenarioExecutionInfoService {
|
|||
|
||||
@Lazy
|
||||
public void insertScenarioInfo(ApiScenarioWithBLOBs apiScenario, ApiScenarioReport scenarioReport, ResultDTO dto) {
|
||||
if (ObjectUtils.anyNull(apiScenario, scenarioReport, dto)) {
|
||||
return;
|
||||
}
|
||||
if (StringUtils.equalsAnyIgnoreCase(dto.getRunMode(), ApiRunMode.SCENARIO_PLAN.name(), ApiRunMode.SCHEDULE_SCENARIO_PLAN.name(), ApiRunMode.JENKINS_SCENARIO_PLAN.name())) {
|
||||
this.insertExecutionInfo(dto.getTestId(), scenarioReport.getStatus(), scenarioReport.getTriggerMode(), scenarioReport.getProjectId() == null ? apiScenario.getProjectId() : scenarioReport.getProjectId(), ExecutionExecuteTypeEnum.TEST_PLAN.name(), apiScenario.getVersionId());
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue