fix(接口定义): 修复case选择环境组执行生成报告有未执行的缺陷
--bug=1023586 --user=王孝刚 【接口测试】场景中引用了case,选择环境组,执行场景后,这个case还是没有环境 https://www.tapd.cn/55049933/s/1340015
This commit is contained in:
parent
effcf95ba6
commit
c6ac505574
|
@ -31,6 +31,7 @@ import io.metersphere.commons.enums.*;
|
||||||
import io.metersphere.commons.exception.MSException;
|
import io.metersphere.commons.exception.MSException;
|
||||||
import io.metersphere.commons.utils.*;
|
import io.metersphere.commons.utils.*;
|
||||||
import io.metersphere.dto.*;
|
import io.metersphere.dto.*;
|
||||||
|
import io.metersphere.environment.service.BaseEnvGroupProjectService;
|
||||||
import io.metersphere.environment.service.BaseEnvironmentService;
|
import io.metersphere.environment.service.BaseEnvironmentService;
|
||||||
import io.metersphere.i18n.Translator;
|
import io.metersphere.i18n.Translator;
|
||||||
import io.metersphere.log.utils.ReflexObjectUtil;
|
import io.metersphere.log.utils.ReflexObjectUtil;
|
||||||
|
@ -53,6 +54,7 @@ import io.metersphere.service.plan.TestPlanApiCaseService;
|
||||||
import io.metersphere.service.scenario.ApiScenarioService;
|
import io.metersphere.service.scenario.ApiScenarioService;
|
||||||
import io.metersphere.xpack.api.service.ApiCaseBatchSyncService;
|
import io.metersphere.xpack.api.service.ApiCaseBatchSyncService;
|
||||||
import io.metersphere.xpack.api.service.ApiDefinitionSyncService;
|
import io.metersphere.xpack.api.service.ApiDefinitionSyncService;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
import org.apache.commons.beanutils.BeanComparator;
|
import org.apache.commons.beanutils.BeanComparator;
|
||||||
import org.apache.commons.beanutils.BeanMap;
|
import org.apache.commons.beanutils.BeanMap;
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
|
@ -73,7 +75,6 @@ import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import jakarta.annotation.Resource;
|
|
||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
@ -162,6 +163,8 @@ public class ApiDefinitionService {
|
||||||
private ApiDefinitionImportUtilService apiDefinitionImportUtilService;
|
private ApiDefinitionImportUtilService apiDefinitionImportUtilService;
|
||||||
@Resource
|
@Resource
|
||||||
private BaseQuotaService baseQuotaService;
|
private BaseQuotaService baseQuotaService;
|
||||||
|
@Resource
|
||||||
|
private BaseEnvGroupProjectService environmentGroupProjectService;
|
||||||
|
|
||||||
|
|
||||||
private static final String COPY = "Copy";
|
private static final String COPY = "Copy";
|
||||||
|
@ -1943,6 +1946,10 @@ public class ApiDefinitionService {
|
||||||
if (request.getConfig() == null) {
|
if (request.getConfig() == null) {
|
||||||
request.setConfig(new RunModeConfigDTO());
|
request.setConfig(new RunModeConfigDTO());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (StringUtils.isNotBlank(request.getEnvironmentGroupId())) {
|
||||||
|
request.setEnvironmentMap(environmentGroupProjectService.getEnvMap(request.getEnvironmentGroupId()));
|
||||||
|
}
|
||||||
// 验证是否本地执行
|
// 验证是否本地执行
|
||||||
jMeterService.verifyPool(request.getProjectId(), request.getConfig());
|
jMeterService.verifyPool(request.getProjectId(), request.getConfig());
|
||||||
if (!request.isDebug()) {
|
if (!request.isDebug()) {
|
||||||
|
|
|
@ -450,7 +450,7 @@ export default {
|
||||||
selectEnvId = store.scenarioEnvMap.get(this.currentScenario.id + '_' + this.request.projectId);
|
selectEnvId = store.scenarioEnvMap.get(this.currentScenario.id + '_' + this.request.projectId);
|
||||||
this.environmentMap = this.envMap;
|
this.environmentMap = this.envMap;
|
||||||
}
|
}
|
||||||
if (!selectEnvId) {
|
if (!selectEnvId && !this.environmentGroupId) {
|
||||||
this.$warning(this.$t('api_test.automation.env_message'));
|
this.$warning(this.$t('api_test.automation.env_message'));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -483,6 +483,7 @@ export default {
|
||||||
headers: this.currentScenario.headers,
|
headers: this.currentScenario.headers,
|
||||||
enableCookieShare: this.enableCookieShare,
|
enableCookieShare: this.enableCookieShare,
|
||||||
environmentId: selectEnvId,
|
environmentId: selectEnvId,
|
||||||
|
environmentGroupId: this.environmentGroupId,
|
||||||
hashTree: [this.request],
|
hashTree: [this.request],
|
||||||
};
|
};
|
||||||
// 合并自身依赖场景变量
|
// 合并自身依赖场景变量
|
||||||
|
|
|
@ -152,6 +152,9 @@ export default {
|
||||||
if (this.runData[0].useEnvironment) {
|
if (this.runData[0].useEnvironment) {
|
||||||
reqObj.environmentId = this.runData[0].useEnvironment;
|
reqObj.environmentId = this.runData[0].useEnvironment;
|
||||||
}
|
}
|
||||||
|
if (this.runData[0]) {
|
||||||
|
reqObj.environmentGroupId = this.runData[0].environmentGroupId;
|
||||||
|
}
|
||||||
reqObj.reportId = this.reportId;
|
reqObj.reportId = this.reportId;
|
||||||
if (!this.debug) {
|
if (!this.debug) {
|
||||||
reqObj.syncResult = true;
|
reqObj.syncResult = true;
|
||||||
|
|
Loading…
Reference in New Issue