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