fix(测试跟踪): 修复测试计划多选批量执行时执行配置的运行环境显示问题
--bug=1028791 --user=宋天阳 【测试跟踪】测试计划-接口用例列表-批量执行-项目展示错误 https://www.tapd.cn/55049933/s/1404750;--bug=1028772 --user=宋天阳 【测试跟踪】测试计划-场景列表-批量执行-未显示跨项目环境选项 https://www.tapd.cn/55049933/s/1404751;--bug=1028777 --user=宋天阳 【测试跟踪】测试计划-跨项目场景用例-批量执行-运行环境显示了当前项目 https://www.tapd.cn/55049933/s/1404752;
This commit is contained in:
parent
53a491ed48
commit
4151f10024
|
@ -691,7 +691,7 @@ public class TestPlanApiCaseService {
|
||||||
|
|
||||||
public Map<String, List<String>> getApiCaseEnv(List<String> planApiCaseIds) {
|
public Map<String, List<String>> getApiCaseEnv(List<String> planApiCaseIds) {
|
||||||
Map<String, List<String>> envMap = new HashMap<>();
|
Map<String, List<String>> envMap = new HashMap<>();
|
||||||
if (org.apache.commons.collections.CollectionUtils.isEmpty(planApiCaseIds)) {
|
if (CollectionUtils.isEmpty(planApiCaseIds)) {
|
||||||
return envMap;
|
return envMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -699,7 +699,7 @@ public class TestPlanApiCaseService {
|
||||||
caseExample.createCriteria().andIdIn(planApiCaseIds);
|
caseExample.createCriteria().andIdIn(planApiCaseIds);
|
||||||
List<TestPlanApiCase> testPlanApiCases = testPlanApiCaseMapper.selectByExample(caseExample);
|
List<TestPlanApiCase> testPlanApiCases = testPlanApiCaseMapper.selectByExample(caseExample);
|
||||||
List<String> apiCaseIds = testPlanApiCases.stream().map(TestPlanApiCase::getApiCaseId).collect(Collectors.toList());
|
List<String> apiCaseIds = testPlanApiCases.stream().map(TestPlanApiCase::getApiCaseId).collect(Collectors.toList());
|
||||||
if (org.apache.commons.collections.CollectionUtils.isEmpty(apiCaseIds)) {
|
if (CollectionUtils.isEmpty(apiCaseIds)) {
|
||||||
return envMap;
|
return envMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -713,7 +713,7 @@ public class TestPlanApiCaseService {
|
||||||
String caseId = testPlanApiCase.getApiCaseId();
|
String caseId = testPlanApiCase.getApiCaseId();
|
||||||
String envId = testPlanApiCase.getEnvironmentId();
|
String envId = testPlanApiCase.getEnvironmentId();
|
||||||
String projectId = projectCaseIdMap.get(caseId);
|
String projectId = projectCaseIdMap.get(caseId);
|
||||||
if (StringUtils.isNotBlank(projectId) && StringUtils.isNotBlank(envId)) {
|
if (StringUtils.isNotBlank(projectId)) {
|
||||||
if (envMap.containsKey(projectId)) {
|
if (envMap.containsKey(projectId)) {
|
||||||
List<String> list = envMap.get(projectId);
|
List<String> list = envMap.get(projectId);
|
||||||
if (!list.contains(envId)) {
|
if (!list.contains(envId)) {
|
||||||
|
@ -721,7 +721,9 @@ public class TestPlanApiCaseService {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
List<String> envs = new ArrayList<>();
|
List<String> envs = new ArrayList<>();
|
||||||
|
if (StringUtils.isNotBlank(envId)) {
|
||||||
envs.add(envId);
|
envs.add(envId);
|
||||||
|
}
|
||||||
envMap.put(projectId, envs);
|
envMap.put(projectId, envs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -825,11 +825,12 @@ public class TestPlanScenarioCaseService {
|
||||||
scenarioExample.createCriteria().andIdIn(planApiScenarioIds);
|
scenarioExample.createCriteria().andIdIn(planApiScenarioIds);
|
||||||
List<TestPlanApiScenario> testPlanApiScenarios = testPlanApiScenarioMapper.selectByExampleWithBLOBs(scenarioExample);
|
List<TestPlanApiScenario> testPlanApiScenarios = testPlanApiScenarioMapper.selectByExampleWithBLOBs(scenarioExample);
|
||||||
|
|
||||||
|
List<String> defaultEnvScenarioIds = new ArrayList<>();
|
||||||
for (TestPlanApiScenario testPlanApiScenario : testPlanApiScenarios) {
|
for (TestPlanApiScenario testPlanApiScenario : testPlanApiScenarios) {
|
||||||
String env = testPlanApiScenario.getEnvironment();
|
String env = testPlanApiScenario.getEnvironment();
|
||||||
if (StringUtils.isBlank(env)) {
|
if ((StringUtils.isBlank(env) || StringUtils.equals(env, "{}")) && !defaultEnvScenarioIds.contains(testPlanApiScenario.getApiScenarioId())) {
|
||||||
continue;
|
defaultEnvScenarioIds.add(testPlanApiScenario.getApiScenarioId());
|
||||||
}
|
} else {
|
||||||
Map<String, String> map = JSON.parseObject(env, Map.class);
|
Map<String, String> map = JSON.parseObject(env, Map.class);
|
||||||
if (!map.isEmpty()) {
|
if (!map.isEmpty()) {
|
||||||
Set<String> set = map.keySet();
|
Set<String> set = map.keySet();
|
||||||
|
@ -851,6 +852,18 @@ public class TestPlanScenarioCaseService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CollectionUtils.isNotEmpty(defaultEnvScenarioIds)) {
|
||||||
|
RunScenarioRequest runScenarioRequest = new RunScenarioRequest();
|
||||||
|
runScenarioRequest.setIds(defaultEnvScenarioIds);
|
||||||
|
Set<String> projectIDSet = apiAutomationService.getProjectEnvMap(runScenarioRequest).keySet();
|
||||||
|
for (String projectId : projectIDSet) {
|
||||||
|
if (!envMap.containsKey(projectId)) {
|
||||||
|
envMap.put(projectId, new ArrayList<>());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return envMap;
|
return envMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -171,12 +171,7 @@ import {getCurrentProjectID, getOwnerProjects,} from "@/business/utils/sdk-utils
|
||||||
import {getQuotaValidResourcePools} from "@/api/remote/resource-pool";
|
import {getQuotaValidResourcePools} from "@/api/remote/resource-pool";
|
||||||
import EnvGroupPopover from "@/business/plan/env/EnvGroupPopover";
|
import EnvGroupPopover from "@/business/plan/env/EnvGroupPopover";
|
||||||
import {getApiCaseEnv} from "@/api/remote/plan/test-plan-api-case";
|
import {getApiCaseEnv} from "@/api/remote/plan/test-plan-api-case";
|
||||||
import {
|
import {getApiScenarioEnv, getPlanCaseEnv, getPlanCaseProjectIds,} from "@/api/remote/plan/test-plan";
|
||||||
getApiScenarioEnv,
|
|
||||||
getPlanCaseEnv,
|
|
||||||
getPlanCaseProjectIds,
|
|
||||||
getProjectIdsByPlanIdAndCaseType,
|
|
||||||
} from "@/api/remote/plan/test-plan";
|
|
||||||
import EnvGroupWithOption from "../env/EnvGroupWithOption";
|
import EnvGroupWithOption from "../env/EnvGroupWithOption";
|
||||||
import EnvironmentGroup from "@/business/plan/env/EnvironmentGroupList";
|
import EnvironmentGroup from "@/business/plan/env/EnvironmentGroupList";
|
||||||
import EnvSelectPopover from "@/business/plan/env/EnvSelectPopover";
|
import EnvSelectPopover from "@/business/plan/env/EnvSelectPopover";
|
||||||
|
@ -384,16 +379,11 @@ export default {
|
||||||
let data = res.data;
|
let data = res.data;
|
||||||
if (data) {
|
if (data) {
|
||||||
this.projectEnvListMap = data;
|
this.projectEnvListMap = data;
|
||||||
}
|
for (let d in data) {
|
||||||
getProjectIdsByPlanIdAndCaseType(this.planId, 'apiCase').then((res) => {
|
this.projectIds.add(d);
|
||||||
let data = res.data;
|
|
||||||
if (data) {
|
|
||||||
for (let i = 0; i < data.length; i++) {
|
|
||||||
this.projectIds.add(data[i]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
this.$refs.envSelectPopover.open();
|
this.$refs.envSelectPopover.open();
|
||||||
});
|
}
|
||||||
});
|
});
|
||||||
} else if (this.type === "apiScenario") {
|
} else if (this.type === "apiScenario") {
|
||||||
param = this.planCaseIds;
|
param = this.planCaseIds;
|
||||||
|
@ -401,16 +391,11 @@ export default {
|
||||||
let data = res.data;
|
let data = res.data;
|
||||||
if (data) {
|
if (data) {
|
||||||
this.projectEnvListMap = data;
|
this.projectEnvListMap = data;
|
||||||
}
|
for (let d in data) {
|
||||||
getProjectIdsByPlanIdAndCaseType(this.planId, 'apiScenario').then((res) => {
|
this.projectIds.add(d);
|
||||||
let data = res.data;
|
|
||||||
if (data) {
|
|
||||||
for (let i = 0; i < data.length; i++) {
|
|
||||||
this.projectIds.add(data[i]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
this.$refs.envSelectPopover.open();
|
this.$refs.envSelectPopover.open();
|
||||||
});
|
}
|
||||||
});
|
});
|
||||||
} else if (this.type === "plan") {
|
} else if (this.type === "plan") {
|
||||||
param = {id: this.planId};
|
param = {id: this.planId};
|
||||||
|
|
|
@ -57,19 +57,14 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-row
|
<el-row justify="space-between" class="select-time" v-else>
|
||||||
class="select-time"
|
<el-col :span="8">
|
||||||
v-else
|
<el-form-item :label="$t('commons.environment') + ':'">
|
||||||
style="display: inline-block"
|
|
||||||
>
|
|
||||||
<div style="float: left">
|
|
||||||
{{ $t("commons.environment") + ":" }}
|
|
||||||
</div>
|
|
||||||
<div style="float: right">
|
|
||||||
<div style="margin-left: 42px">
|
|
||||||
{{ $t('test_track.report.case_env') }}
|
{{ $t('test_track.report.case_env') }}
|
||||||
</div>
|
</el-form-item>
|
||||||
</div>
|
</el-col>
|
||||||
|
<el-col :span="8"></el-col>
|
||||||
|
<el-col :span="8"></el-col>
|
||||||
|
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-row type="flex" justify="space-between" class="select-time">
|
<el-row type="flex" justify="space-between" class="select-time">
|
||||||
|
|
Loading…
Reference in New Issue