fix(接口测试): 接口执行初始化报告没有设置环境ID

This commit is contained in:
AgAngle 2024-03-20 19:53:02 +08:00 committed by Craftsman
parent 1a3b4fb276
commit 04b10fb846
3 changed files with 5 additions and 3 deletions

View File

@ -27,7 +27,6 @@ import io.metersphere.sdk.util.BeanUtils;
import io.metersphere.sdk.util.LogUtils;
import io.metersphere.sdk.util.SubListUtils;
import jakarta.annotation.Resource;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

View File

@ -735,6 +735,7 @@ public class ApiTestCaseService extends MoveNodeService {
apiReport.setName(apiTestCase.getName());
apiReport.setRunMode(ApiBatchRunMode.PARALLEL.name());
apiReport.setPoolId(poolId);
apiReport.setEnvironmentId(apiTestCase.getEnvironmentId());
apiReport.setProjectId(apiTestCase.getProjectId());
// 创建报告和用例的关联关系

View File

@ -1134,7 +1134,7 @@ public class ApiScenarioService extends MoveNodeService {
parseConfig.setReportId(reportId);
// 初始化报告
initApiReport(apiScenario, reportId, poolId, userId);
initApiReport(apiScenario, reportId, parseParam.getEnvironmentId(), poolId, userId);
// 初始化报告步骤
initScenarioReportSteps(steps, taskRequest.getReportId());
@ -1150,7 +1150,7 @@ public class ApiScenarioService extends MoveNodeService {
* @param userId
* @return
*/
public ApiScenarioRecord initApiReport(ApiScenario apiScenario, String reportId, String poolId, String userId) {
public ApiScenarioRecord initApiReport(ApiScenario apiScenario, String envId, String reportId, String poolId, String userId) {
// 初始化报告
ApiScenarioReport scenarioReport = getScenarioReport(userId);
scenarioReport.setId(reportId);
@ -1158,6 +1158,8 @@ public class ApiScenarioService extends MoveNodeService {
scenarioReport.setName(apiScenario.getName());
scenarioReport.setRunMode(ApiBatchRunMode.PARALLEL.name());
scenarioReport.setPoolId(poolId);
scenarioReport.setEnvironmentId(apiScenario.getEnvironmentId());
scenarioReport.setEnvironmentId(envId);
scenarioReport.setProjectId(apiScenario.getProjectId());
// 创建报告和用例的关联关系