fix(测试跟踪): 修复测试计划执行时未按照所选环境执行的问题
--bug=1020897 --user=宋天阳 【测试跟踪】测试计划关联功能用例时同步关联的接口场景,执行后场景报告结果没有运行环境信息 https://www.tapd.cn/55049933/s/1316945
This commit is contained in:
parent
10737147b7
commit
8410bd4ab2
|
@ -247,6 +247,16 @@ public class ApiScenarioExecuteService {
|
|||
return;
|
||||
}
|
||||
Map<String, ApiScenarioWithBLOBs> scenarioMap = apiScenarios.stream().collect(Collectors.toMap(ApiScenarioWithBLOBs::getId, Function.identity(), (t1, t2) -> t1));
|
||||
//检查环境组
|
||||
Map<String, String> configEnvMap = new HashMap<>();
|
||||
if (request.getConfig() != null) {
|
||||
if (StringUtils.equals(request.getConfig().getEnvironmentType(), EnvironmentType.JSON.toString()) && MapUtils.isNotEmpty(request.getConfig().getEnvMap())) {
|
||||
configEnvMap = request.getConfig().getEnvMap();
|
||||
} else if (StringUtils.equals(request.getConfig().getEnvironmentType(), EnvironmentType.GROUP.toString()) && StringUtils.isNotBlank(request.getConfig().getEnvironmentGroupId())) {
|
||||
configEnvMap = environmentGroupProjectService.getEnvMap(request.getConfig().getEnvironmentGroupId());
|
||||
}
|
||||
}
|
||||
|
||||
for (String testPlanScenarioId : planScenarioIdMap.keySet()) {
|
||||
String scenarioId = planScenarioIdMap.get(testPlanScenarioId);
|
||||
ApiScenarioWithBLOBs scenario = scenarioMap.get(scenarioId);
|
||||
|
@ -268,6 +278,8 @@ public class ApiScenarioExecuteService {
|
|||
} else if (StringUtils.equals(planApiScenario.getEnvironmentType(), EnvironmentType.GROUP.toString()) && StringUtils.isNotBlank(planApiScenario.getEnvironmentGroupId())) {
|
||||
planEnvMap = environmentGroupProjectService.getEnvMap(planApiScenario.getEnvironmentGroupId());
|
||||
}
|
||||
planEnvMap.putAll(configEnvMap);
|
||||
|
||||
if (StringUtils.isEmpty(request.getProjectId())) {
|
||||
request.setProjectId(extTestPlanScenarioCaseMapper.getProjectIdById(testPlanScenarioId));
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ import io.metersphere.commons.utils.RequestParamsUtil;
|
|||
import io.metersphere.dto.JmeterRunRequestDTO;
|
||||
import io.metersphere.environment.service.BaseEnvironmentService;
|
||||
import io.metersphere.utils.LoggerUtil;
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.jorphan.collections.HashTree;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
|
@ -71,8 +72,11 @@ public class ApiScenarioSerialService {
|
|||
} else {
|
||||
TestPlanApiScenario planApiScenario = testPlanApiScenarioMapper.selectByPrimaryKey(queue.getTestId());
|
||||
if (planApiScenario != null) {
|
||||
planEnvMap = apiScenarioEnvService.planEnvMap(queue.getTestId());
|
||||
queue.setEvnMap(JSON.toJSONString(planEnvMap));
|
||||
// envMap不为空的话可以看做是需要指定环境运行; 为空的话则按照默认环境运行
|
||||
if (MapUtils.isEmpty(JSON.parseObject(queue.getEvnMap(), Map.class))) {
|
||||
planEnvMap = apiScenarioEnvService.planEnvMap(queue.getTestId());
|
||||
queue.setEvnMap(JSON.toJSONString(planEnvMap));
|
||||
}
|
||||
scenario = apiScenarioMapper.selectByPrimaryKey(planApiScenario.getApiScenarioId());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,7 +55,9 @@ import {
|
|||
getModuleByProjectId,
|
||||
getModuleByRelevanceProjectId,
|
||||
getModuleByTrash,
|
||||
posScenarioModule, postModuleByProjectId, postModuleByTrash,
|
||||
posScenarioModule,
|
||||
postModuleByProjectId,
|
||||
postModuleByTrash,
|
||||
} from '@/api/scenario-module';
|
||||
|
||||
export default {
|
||||
|
@ -167,17 +169,17 @@ export default {
|
|||
this.param = {};
|
||||
},
|
||||
},
|
||||
created(){
|
||||
this.$EventBus.$on("scenarioConditionBus", (param)=>{
|
||||
created() {
|
||||
this.$EventBus.$on('scenarioConditionBus', (param) => {
|
||||
this.param = param;
|
||||
this.list();
|
||||
})
|
||||
});
|
||||
},
|
||||
beforeDestroy() {
|
||||
this.$EventBus.$off("scenarioConditionBus", (param)=>{
|
||||
this.$EventBus.$off('scenarioConditionBus', (param) => {
|
||||
this.param = param;
|
||||
this.list();
|
||||
})
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
handleImport() {
|
||||
|
@ -352,7 +354,9 @@ export default {
|
|||
},
|
||||
enableTrash() {
|
||||
this.condition.trashEnable = true;
|
||||
this.$emit('enableTrash', this.condition.trashEnable);
|
||||
this.$nextTick(() => {
|
||||
this.$emit('enableTrash', this.condition.trashEnable);
|
||||
});
|
||||
},
|
||||
removeModuleId(nodeIds) {
|
||||
if (localStorage.getItem('scenarioModule') && localStorage.getItem('scenarioModule') === nodeIds[0]) {
|
||||
|
|
|
@ -1,19 +1,116 @@
|
|||
import i18n from "@/i18n";
|
||||
|
||||
export const REPORT_STATUS_MAP = new Map([
|
||||
["success", {name: i18n.t('test_track.plan_view.pass'), itemStyle: {color: '#67C23A'}}],
|
||||
["Success", {name: i18n.t('test_track.plan_view.pass'), itemStyle: {color: '#67C23A'}}],
|
||||
["SUCCESS", {name: i18n.t('test_track.plan_view.pass'), itemStyle: {color: '#67C23A'}}],
|
||||
["Pass", {name: i18n.t('test_track.plan_view.pass'), itemStyle: {color: '#67C23A'}}],
|
||||
["error", {name: i18n.t('test_track.plan_view.failure'), itemStyle: {color: '#F56C6C'}}],
|
||||
["Error", {name: i18n.t('test_track.plan_view.failure'), itemStyle: {color: '#F56C6C'}}],
|
||||
["ERROR", {name: i18n.t('test_track.plan_view.failure'), itemStyle: {color: '#F56C6C'}}],
|
||||
["Fail", {name: i18n.t('test_track.plan_view.failure'), itemStyle: {color: '#F56C6C'}}],
|
||||
["Failure", {name: i18n.t('test_track.plan_view.failure'), itemStyle: {color: '#F56C6C'}}],
|
||||
["Prepare", {name: i18n.t('api_test.home_page.detail_card.unexecute'), itemStyle: {color: '#909399'}}],
|
||||
["PENDING", {name: i18n.t('api_test.home_page.detail_card.unexecute'), itemStyle: {color: '#909399'}}],
|
||||
["Underway", {name: i18n.t('api_test.home_page.detail_card.unexecute'), itemStyle: {color: '#909399'}}],
|
||||
["RERUNNING", {name: i18n.t('api_test.home_page.detail_card.unexecute'), itemStyle: {color: '#909399'}}],
|
||||
["FAKE_ERROR", {name: i18n.t('error_report_library.option.name'), itemStyle: {color: '#F6972A'}}],
|
||||
["run", {name: i18n.t('test_track.plan_view.running'), itemStyle: {color: '#DEDE10'}}],
|
||||
[
|
||||
"success",
|
||||
{
|
||||
name: i18n.t("test_track.plan_view.pass"),
|
||||
itemStyle: { color: "#67C23A" },
|
||||
},
|
||||
],
|
||||
[
|
||||
"Success",
|
||||
{
|
||||
name: i18n.t("test_track.plan_view.pass"),
|
||||
itemStyle: { color: "#67C23A" },
|
||||
},
|
||||
],
|
||||
[
|
||||
"SUCCESS",
|
||||
{
|
||||
name: i18n.t("test_track.plan_view.pass"),
|
||||
itemStyle: { color: "#67C23A" },
|
||||
},
|
||||
],
|
||||
[
|
||||
"Pass",
|
||||
{
|
||||
name: i18n.t("test_track.plan_view.pass"),
|
||||
itemStyle: { color: "#67C23A" },
|
||||
},
|
||||
],
|
||||
[
|
||||
"error",
|
||||
{
|
||||
name: i18n.t("test_track.plan_view.failure"),
|
||||
itemStyle: { color: "#F56C6C" },
|
||||
},
|
||||
],
|
||||
[
|
||||
"Error",
|
||||
{
|
||||
name: i18n.t("test_track.plan_view.failure"),
|
||||
itemStyle: { color: "#F56C6C" },
|
||||
},
|
||||
],
|
||||
[
|
||||
"ERROR",
|
||||
{
|
||||
name: i18n.t("test_track.plan_view.failure"),
|
||||
itemStyle: { color: "#F56C6C" },
|
||||
},
|
||||
],
|
||||
[
|
||||
"Fail",
|
||||
{
|
||||
name: i18n.t("test_track.plan_view.failure"),
|
||||
itemStyle: { color: "#F56C6C" },
|
||||
},
|
||||
],
|
||||
[
|
||||
"Failure",
|
||||
{
|
||||
name: i18n.t("test_track.plan_view.failure"),
|
||||
itemStyle: { color: "#F56C6C" },
|
||||
},
|
||||
],
|
||||
[
|
||||
"Prepare",
|
||||
{
|
||||
name: i18n.t("api_test.home_page.detail_card.unexecute"),
|
||||
itemStyle: { color: "#909399" },
|
||||
},
|
||||
],
|
||||
[
|
||||
"PENDING",
|
||||
{
|
||||
name: i18n.t("api_test.home_page.detail_card.unexecute"),
|
||||
itemStyle: { color: "#909399" },
|
||||
},
|
||||
],
|
||||
[
|
||||
"Underway",
|
||||
{
|
||||
name: i18n.t("api_test.home_page.detail_card.unexecute"),
|
||||
itemStyle: { color: "#909399" },
|
||||
},
|
||||
],
|
||||
[
|
||||
"RERUNNING",
|
||||
{
|
||||
name: i18n.t("api_test.home_page.detail_card.unexecute"),
|
||||
itemStyle: { color: "#909399" },
|
||||
},
|
||||
],
|
||||
[
|
||||
"RUNNING",
|
||||
{
|
||||
name: i18n.t("api_test.home_page.detail_card.unexecute"),
|
||||
itemStyle: { color: "#909399" },
|
||||
},
|
||||
],
|
||||
[
|
||||
"FAKE_ERROR",
|
||||
{
|
||||
name: i18n.t("error_report_library.option.name"),
|
||||
itemStyle: { color: "#F6972A" },
|
||||
},
|
||||
],
|
||||
[
|
||||
"run",
|
||||
{
|
||||
name: i18n.t("test_track.plan_view.running"),
|
||||
itemStyle: { color: "#DEDE10" },
|
||||
},
|
||||
],
|
||||
]);
|
||||
|
|
Loading…
Reference in New Issue