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) {
|
||||
Map<String, List<String>> envMap = new HashMap<>();
|
||||
if (org.apache.commons.collections.CollectionUtils.isEmpty(planApiCaseIds)) {
|
||||
if (CollectionUtils.isEmpty(planApiCaseIds)) {
|
||||
return envMap;
|
||||
}
|
||||
|
||||
|
@ -699,7 +699,7 @@ public class TestPlanApiCaseService {
|
|||
caseExample.createCriteria().andIdIn(planApiCaseIds);
|
||||
List<TestPlanApiCase> testPlanApiCases = testPlanApiCaseMapper.selectByExample(caseExample);
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -713,7 +713,7 @@ public class TestPlanApiCaseService {
|
|||
String caseId = testPlanApiCase.getApiCaseId();
|
||||
String envId = testPlanApiCase.getEnvironmentId();
|
||||
String projectId = projectCaseIdMap.get(caseId);
|
||||
if (StringUtils.isNotBlank(projectId) && StringUtils.isNotBlank(envId)) {
|
||||
if (StringUtils.isNotBlank(projectId)) {
|
||||
if (envMap.containsKey(projectId)) {
|
||||
List<String> list = envMap.get(projectId);
|
||||
if (!list.contains(envId)) {
|
||||
|
@ -721,7 +721,9 @@ public class TestPlanApiCaseService {
|
|||
}
|
||||
} else {
|
||||
List<String> envs = new ArrayList<>();
|
||||
envs.add(envId);
|
||||
if (StringUtils.isNotBlank(envId)) {
|
||||
envs.add(envId);
|
||||
}
|
||||
envMap.put(projectId, envs);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -825,32 +825,45 @@ public class TestPlanScenarioCaseService {
|
|||
scenarioExample.createCriteria().andIdIn(planApiScenarioIds);
|
||||
List<TestPlanApiScenario> testPlanApiScenarios = testPlanApiScenarioMapper.selectByExampleWithBLOBs(scenarioExample);
|
||||
|
||||
List<String> defaultEnvScenarioIds = new ArrayList<>();
|
||||
for (TestPlanApiScenario testPlanApiScenario : testPlanApiScenarios) {
|
||||
String env = testPlanApiScenario.getEnvironment();
|
||||
if (StringUtils.isBlank(env)) {
|
||||
continue;
|
||||
}
|
||||
Map<String, String> map = JSON.parseObject(env, Map.class);
|
||||
if (!map.isEmpty()) {
|
||||
Set<String> set = map.keySet();
|
||||
for (String s : set) {
|
||||
String e = map.get(s);
|
||||
if (StringUtils.isBlank(e)) {
|
||||
continue;
|
||||
}
|
||||
if (envMap.containsKey(s)) {
|
||||
List<String> list = envMap.get(s);
|
||||
if (!list.contains(e)) {
|
||||
list.add(e);
|
||||
if ((StringUtils.isBlank(env) || StringUtils.equals(env, "{}")) && !defaultEnvScenarioIds.contains(testPlanApiScenario.getApiScenarioId())) {
|
||||
defaultEnvScenarioIds.add(testPlanApiScenario.getApiScenarioId());
|
||||
} else {
|
||||
Map<String, String> map = JSON.parseObject(env, Map.class);
|
||||
if (!map.isEmpty()) {
|
||||
Set<String> set = map.keySet();
|
||||
for (String s : set) {
|
||||
String e = map.get(s);
|
||||
if (StringUtils.isBlank(e)) {
|
||||
continue;
|
||||
}
|
||||
if (envMap.containsKey(s)) {
|
||||
List<String> list = envMap.get(s);
|
||||
if (!list.contains(e)) {
|
||||
list.add(e);
|
||||
}
|
||||
} else {
|
||||
List<String> envs = new ArrayList<>();
|
||||
envs.add(e);
|
||||
envMap.put(s, envs);
|
||||
}
|
||||
} else {
|
||||
List<String> envs = new ArrayList<>();
|
||||
envs.add(e);
|
||||
envMap.put(s, envs);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -171,12 +171,7 @@ import {getCurrentProjectID, getOwnerProjects,} from "@/business/utils/sdk-utils
|
|||
import {getQuotaValidResourcePools} from "@/api/remote/resource-pool";
|
||||
import EnvGroupPopover from "@/business/plan/env/EnvGroupPopover";
|
||||
import {getApiCaseEnv} from "@/api/remote/plan/test-plan-api-case";
|
||||
import {
|
||||
getApiScenarioEnv,
|
||||
getPlanCaseEnv,
|
||||
getPlanCaseProjectIds,
|
||||
getProjectIdsByPlanIdAndCaseType,
|
||||
} from "@/api/remote/plan/test-plan";
|
||||
import {getApiScenarioEnv, getPlanCaseEnv, getPlanCaseProjectIds,} from "@/api/remote/plan/test-plan";
|
||||
import EnvGroupWithOption from "../env/EnvGroupWithOption";
|
||||
import EnvironmentGroup from "@/business/plan/env/EnvironmentGroupList";
|
||||
import EnvSelectPopover from "@/business/plan/env/EnvSelectPopover";
|
||||
|
@ -384,16 +379,11 @@ export default {
|
|||
let data = res.data;
|
||||
if (data) {
|
||||
this.projectEnvListMap = data;
|
||||
}
|
||||
getProjectIdsByPlanIdAndCaseType(this.planId, 'apiCase').then((res) => {
|
||||
let data = res.data;
|
||||
if (data) {
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
this.projectIds.add(data[i]);
|
||||
}
|
||||
for (let d in data) {
|
||||
this.projectIds.add(d);
|
||||
}
|
||||
this.$refs.envSelectPopover.open();
|
||||
});
|
||||
this.$refs.envSelectPopover.open();
|
||||
}
|
||||
});
|
||||
} else if (this.type === "apiScenario") {
|
||||
param = this.planCaseIds;
|
||||
|
@ -401,16 +391,11 @@ export default {
|
|||
let data = res.data;
|
||||
if (data) {
|
||||
this.projectEnvListMap = data;
|
||||
}
|
||||
getProjectIdsByPlanIdAndCaseType(this.planId, 'apiScenario').then((res) => {
|
||||
let data = res.data;
|
||||
if (data) {
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
this.projectIds.add(data[i]);
|
||||
}
|
||||
for (let d in data) {
|
||||
this.projectIds.add(d);
|
||||
}
|
||||
this.$refs.envSelectPopover.open();
|
||||
});
|
||||
}
|
||||
});
|
||||
} else if (this.type === "plan") {
|
||||
param = {id: this.planId};
|
||||
|
|
|
@ -57,19 +57,14 @@
|
|||
</div>
|
||||
</div>
|
||||
</el-row>
|
||||
<el-row
|
||||
class="select-time"
|
||||
v-else
|
||||
style="display: inline-block"
|
||||
>
|
||||
<div style="float: left">
|
||||
{{ $t("commons.environment") + ":" }}
|
||||
</div>
|
||||
<div style="float: right">
|
||||
<div style="margin-left: 42px">
|
||||
<el-row justify="space-between" class="select-time" v-else>
|
||||
<el-col :span="8">
|
||||
<el-form-item :label="$t('commons.environment') + ':'">
|
||||
{{ $t('test_track.report.case_env') }}
|
||||
</div>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8"></el-col>
|
||||
<el-col :span="8"></el-col>
|
||||
|
||||
</el-row>
|
||||
<el-row type="flex" justify="space-between" class="select-time">
|
||||
|
|
Loading…
Reference in New Issue