feat(测试跟踪): 测试计划保存的运行环境回显,并且作为当前计划下所有用例的环境的默认值
--user=郭雨琦 --story=1008894 https://www.tapd.cn/55049933/prong/stories/view/1155049933001008894 --story=1008895 https://www.tapd.cn/55049933/prong/stories/view/1155049933001008895
This commit is contained in:
parent
a38e2799f4
commit
bb7b3dd342
|
@ -1,7 +1,6 @@
|
|||
package io.metersphere.track.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import io.metersphere.api.dto.datacount.request.ScheduleInfoRequest;
|
||||
|
@ -19,7 +18,7 @@ import io.metersphere.track.dto.*;
|
|||
import io.metersphere.track.request.testcase.PlanCaseRelevanceRequest;
|
||||
import io.metersphere.track.request.testcase.QueryTestPlanRequest;
|
||||
import io.metersphere.track.request.testplan.AddTestPlanRequest;
|
||||
import io.metersphere.track.request.testplan.TestplanRunRequest;
|
||||
import io.metersphere.track.request.testplan.TestPlanRunRequest;
|
||||
import io.metersphere.track.request.testplancase.TestCaseRelevanceRequest;
|
||||
import io.metersphere.track.service.TestPlanProjectService;
|
||||
import io.metersphere.track.service.TestPlanService;
|
||||
|
@ -207,18 +206,18 @@ public class TestPlanController {
|
|||
|
||||
|
||||
@PostMapping("/edit/runModeConfig")
|
||||
public void updateRunModeConfig(@RequestBody TestplanRunRequest testplanRunRequest) {
|
||||
public void updateRunModeConfig(@RequestBody TestPlanRunRequest testplanRunRequest) {
|
||||
testPlanService.updateRunModeConfig(testplanRunRequest);
|
||||
}
|
||||
|
||||
@PostMapping("/run")
|
||||
public String run(@RequestBody TestplanRunRequest testplanRunRequest) {
|
||||
public String run(@RequestBody TestPlanRunRequest testplanRunRequest) {
|
||||
return testPlanService.runPlan(testplanRunRequest);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/run/batch")
|
||||
@MsAuditLog(module = OperLogModule.TRACK_TEST_PLAN, type = OperLogConstants.EXECUTE, content = "#msClass.getLogDetails(#request.ids)", msClass = TestPlanService.class)
|
||||
public void runBatch(@RequestBody TestplanRunRequest request) {
|
||||
@MsAuditLog(module = OperLogModule.TRACK_TEST_PLAN, type = OperLogConstants.EXECUTE, content = "#msClass.getLogDetails(#request.testPlanIds)", msClass = TestPlanService.class)
|
||||
public void runBatch(@RequestBody TestPlanRunRequest request) {
|
||||
request.setTriggerMode(TriggerMode.BATCH.name());
|
||||
testPlanService.runBatch(request);
|
||||
}
|
||||
|
|
|
@ -9,15 +9,15 @@ import java.util.Map;
|
|||
|
||||
@Getter
|
||||
@Setter
|
||||
public class TestplanRunRequest {
|
||||
public class TestPlanRunRequest {
|
||||
private String testPlanId;
|
||||
private String projectId;
|
||||
private String userId;
|
||||
private String triggerMode;//触发方式
|
||||
private String mode;//运行模式
|
||||
private String reportType;//报告展示方式
|
||||
private String onSampleError;//是否失败停止
|
||||
private String runWithinResourcePool;//是否选择资源池
|
||||
private boolean onSampleError;//是否失败停止
|
||||
private boolean runWithinResourcePool;//是否选择资源池
|
||||
private String resourcePoolId;//资源池Id
|
||||
private Map<String, String> envMap;
|
||||
private String environmentType;
|
|
@ -30,7 +30,8 @@ import io.metersphere.track.request.report.QueryTestPlanReportRequest;
|
|||
import io.metersphere.track.request.report.TestPlanReportSaveRequest;
|
||||
import io.metersphere.track.request.testcase.QueryTestPlanRequest;
|
||||
import io.metersphere.track.request.testplan.LoadCaseRequest;
|
||||
import io.metersphere.track.request.testplan.TestplanRunRequest;
|
||||
import io.metersphere.track.request.testplan.TestPlanRunRequest;
|
||||
import io.metersphere.track.service.utils.TestPlanRequestUtil;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
@ -584,7 +585,8 @@ public class TestPlanReportService {
|
|||
TestPlanExecutionQueue testPlanExecutionQueue = planExecutionQueueList.get(0);
|
||||
TestPlanWithBLOBs testPlan = testPlanMapper.selectByPrimaryKey(testPlanExecutionQueue.getTestPlanId());
|
||||
JSONObject jsonObject = JSONObject.parseObject(testPlan.getRunModeConfig());
|
||||
TestplanRunRequest runRequest = JSON.toJavaObject(jsonObject, TestplanRunRequest.class);
|
||||
TestPlanRequestUtil.changeStringToBoolean(jsonObject);
|
||||
TestPlanRunRequest runRequest = JSON.toJavaObject(jsonObject, TestPlanRunRequest.class);
|
||||
runRequest.setReportId(testPlanExecutionQueue.getReportId());
|
||||
testPlanService.runPlan(runRequest);
|
||||
}
|
||||
|
|
|
@ -44,8 +44,9 @@ import io.metersphere.track.request.testcase.QueryTestPlanRequest;
|
|||
import io.metersphere.track.request.testplan.AddTestPlanRequest;
|
||||
import io.metersphere.track.request.testplan.LoadCaseReportRequest;
|
||||
import io.metersphere.track.request.testplan.LoadCaseRequest;
|
||||
import io.metersphere.track.request.testplan.TestplanRunRequest;
|
||||
import io.metersphere.track.request.testplan.TestPlanRunRequest;
|
||||
import io.metersphere.track.request.testplancase.QueryTestPlanCaseRequest;
|
||||
import io.metersphere.track.service.utils.TestPlanRequestUtil;
|
||||
import io.metersphere.utils.LoggerUtil;
|
||||
import org.apache.commons.beanutils.BeanMap;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
|
@ -974,11 +975,27 @@ public class TestPlanService {
|
|||
LogUtil.error(e);
|
||||
}
|
||||
if (runModeConfig == null) {
|
||||
TestPlanWithBLOBs testPlanWithBLOBs = testPlanMapper.selectByPrimaryKey(testPlanID);
|
||||
if (StringUtils.isNotEmpty(testPlanWithBLOBs.getRunModeConfig())) {
|
||||
JSONObject json = JSONObject.parseObject(testPlanWithBLOBs.getRunModeConfig());
|
||||
TestPlanRequestUtil.changeStringToBoolean(json);
|
||||
TestPlanRunRequest testPlanRunRequest = JSON.toJavaObject(json, TestPlanRunRequest.class);
|
||||
if (StringUtils.equals("GROUP", testPlanRunRequest.getEnvironmentType()) && StringUtils.isBlank(testPlanRunRequest.getEnvironmentGroupId())) {
|
||||
runModeConfig = buildRunModeConfigDTO();
|
||||
} else {
|
||||
runModeConfig = new RunModeConfigDTO();
|
||||
runModeConfig.setMode(RunModeConstants.SERIAL.name());
|
||||
runModeConfig.setReportType("iddReport");
|
||||
runModeConfig.setMode(testPlanRunRequest.getMode());
|
||||
runModeConfig.setReportType(testPlanRunRequest.getReportType());
|
||||
if (testPlanRunRequest.getEnvMap() == null) {
|
||||
runModeConfig.setEnvMap(new HashMap<>());
|
||||
runModeConfig.setOnSampleError(false);
|
||||
} else {
|
||||
runModeConfig.setEnvMap(testPlanRunRequest.getEnvMap());
|
||||
}
|
||||
runModeConfig.setOnSampleError(testPlanRunRequest.isOnSampleError());
|
||||
}
|
||||
} else {
|
||||
runModeConfig = buildRunModeConfigDTO();
|
||||
}
|
||||
} else {
|
||||
if (runModeConfig.getEnvMap() == null) {
|
||||
runModeConfig.setEnvMap(new HashMap<>());
|
||||
|
@ -1029,6 +1046,15 @@ public class TestPlanService {
|
|||
return planReportId;
|
||||
}
|
||||
|
||||
private RunModeConfigDTO buildRunModeConfigDTO() {
|
||||
RunModeConfigDTO runModeConfig = new RunModeConfigDTO();
|
||||
runModeConfig.setMode(RunModeConstants.SERIAL.name());
|
||||
runModeConfig.setReportType("iddReport");
|
||||
runModeConfig.setEnvMap(new HashMap<>());
|
||||
runModeConfig.setOnSampleError(false);
|
||||
return runModeConfig;
|
||||
}
|
||||
|
||||
private Map<String, String> executeApiTestCase(String triggerMode, String planReportId, String userId, List<String> planCaseIds, RunModeConfigDTO runModeConfig) {
|
||||
BatchRunDefinitionRequest request = new BatchRunDefinitionRequest();
|
||||
request.setTriggerMode(triggerMode);
|
||||
|
@ -1118,6 +1144,24 @@ public class TestPlanService {
|
|||
return returnMap;
|
||||
}
|
||||
|
||||
public String getLogDetails(List<String> ids) {
|
||||
if (CollectionUtils.isNotEmpty(ids)) {
|
||||
TestPlanExample testPlanExample = new TestPlanExample();
|
||||
testPlanExample.createCriteria().andIdIn(ids);
|
||||
List<TestPlan> planList = testPlanMapper.selectByExample(testPlanExample);
|
||||
if (CollectionUtils.isNotEmpty(planList)) {
|
||||
List<OperatingLogDetails> detailsList = new ArrayList<>();
|
||||
for (TestPlan plan : planList) {
|
||||
List<DetailColumn> columns = ReflexObjectUtil.getColumns(planList.get(0), TestPlanReference.testPlanColumns);
|
||||
OperatingLogDetails details = new OperatingLogDetails(JSON.toJSONString(plan.getId()), plan.getProjectId(), plan.getName(), plan.getCreator(), columns);
|
||||
detailsList.add(details);
|
||||
}
|
||||
return JSON.toJSONString(detailsList);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getLogDetails(String id) {
|
||||
TestPlan plan = testPlanMapper.selectByPrimaryKey(id);
|
||||
if (plan != null) {
|
||||
|
@ -2074,7 +2118,7 @@ public class TestPlanService {
|
|||
return envMap;
|
||||
}
|
||||
|
||||
public String runPlan(TestplanRunRequest testplanRunRequest) {
|
||||
public String runPlan(TestPlanRunRequest testplanRunRequest) {
|
||||
//检查测试计划下有没有可以执行的用例;
|
||||
if (!haveExecCase(testplanRunRequest.getTestPlanId()) && !haveUiCase(testplanRunRequest.getTestPlanId())) {
|
||||
MSException.throwException(Translator.get("plan_warning"));
|
||||
|
@ -2091,7 +2135,7 @@ public class TestPlanService {
|
|||
|
||||
}
|
||||
|
||||
private RunModeConfigDTO getRunModeConfigDTO(TestplanRunRequest testplanRunRequest, String envType, Map<String, String> envMap, String environmentGroupId, String testPlanId) {
|
||||
private RunModeConfigDTO getRunModeConfigDTO(TestPlanRunRequest testplanRunRequest, String envType, Map<String, String> envMap, String environmentGroupId, String testPlanId) {
|
||||
RunModeConfigDTO runModeConfig = new RunModeConfigDTO();
|
||||
runModeConfig.setEnvironmentType(testplanRunRequest.getEnvironmentType());
|
||||
if (StringUtils.equals(envType, EnvironmentType.JSON.name()) && !envMap.isEmpty()) {
|
||||
|
@ -2103,7 +2147,7 @@ public class TestPlanService {
|
|||
}
|
||||
runModeConfig.setMode(testplanRunRequest.getMode());
|
||||
runModeConfig.setResourcePoolId(testplanRunRequest.getResourcePoolId());
|
||||
runModeConfig.setOnSampleError(Boolean.parseBoolean(testplanRunRequest.getOnSampleError()));
|
||||
runModeConfig.setOnSampleError(testplanRunRequest.isOnSampleError());
|
||||
if (StringUtils.isBlank(testplanRunRequest.getReportType())) {
|
||||
runModeConfig.setReportType("iddReport");
|
||||
} else {
|
||||
|
@ -2116,7 +2160,7 @@ public class TestPlanService {
|
|||
return runModeConfig;
|
||||
}
|
||||
|
||||
private void updatePlan(TestplanRunRequest testplanRunRequest, String testPlanId) {
|
||||
private void updatePlan(TestPlanRunRequest testplanRunRequest, String testPlanId) {
|
||||
String request = JSON.toJSONString(testplanRunRequest);
|
||||
TestPlanWithBLOBs testPlanWithBLOBs = testPlanMapper.selectByPrimaryKey(testPlanId);
|
||||
if (testPlanWithBLOBs.getRunModeConfig() == null || !(StringUtils.equals(request, testPlanWithBLOBs.getRunModeConfig()))) {
|
||||
|
@ -2293,7 +2337,7 @@ public class TestPlanService {
|
|||
return extTestPlanMapper.list(request);
|
||||
}
|
||||
|
||||
public void runBatch(TestplanRunRequest request) {
|
||||
public void runBatch(TestPlanRunRequest request) {
|
||||
List<String> ids = request.getTestPlanIds();
|
||||
if (CollectionUtils.isEmpty(ids) && !request.getIsAll()) {
|
||||
return;
|
||||
|
@ -2360,7 +2404,7 @@ public class TestPlanService {
|
|||
}
|
||||
|
||||
|
||||
private List<TestPlanExecutionQueue> getTestPlanExecutionQueues(TestplanRunRequest request, Map<String, String> executeQueue) {
|
||||
private List<TestPlanExecutionQueue> getTestPlanExecutionQueues(TestPlanRunRequest request, Map<String, String> executeQueue) {
|
||||
List<TestPlanExecutionQueue> planExecutionQueues = new ArrayList<>();
|
||||
String resourceId = UUID.randomUUID().toString();
|
||||
final int[] nextNum = {testPlanExecutionQueueService.getNextNum(resourceId)};
|
||||
|
@ -2379,7 +2423,7 @@ public class TestPlanService {
|
|||
return planExecutionQueues;
|
||||
}
|
||||
|
||||
private void runByMode(TestplanRunRequest request, Map<String, TestPlanWithBLOBs> testPlanMap, List<TestPlanExecutionQueue> planExecutionQueues) {
|
||||
private void runByMode(TestPlanRunRequest request, Map<String, TestPlanWithBLOBs> testPlanMap, List<TestPlanExecutionQueue> planExecutionQueues) {
|
||||
if (CollectionUtils.isNotEmpty(planExecutionQueues)) {
|
||||
Thread thread = new Thread(new Runnable() {
|
||||
@Override
|
||||
|
@ -2389,14 +2433,16 @@ public class TestPlanService {
|
|||
TestPlanExecutionQueue planExecutionQueue = planExecutionQueues.get(0);
|
||||
TestPlanWithBLOBs testPlan = testPlanMap.get(planExecutionQueue.getTestPlanId());
|
||||
JSONObject jsonObject = JSONObject.parseObject(testPlan.getRunModeConfig());
|
||||
TestplanRunRequest runRequest = JSON.toJavaObject(jsonObject, TestplanRunRequest.class);
|
||||
TestPlanRequestUtil.changeStringToBoolean(jsonObject);
|
||||
TestPlanRunRequest runRequest = JSON.toJavaObject(jsonObject, TestPlanRunRequest.class);
|
||||
runRequest.setReportId(planExecutionQueue.getReportId());
|
||||
runPlan(runRequest);
|
||||
} else {
|
||||
for (TestPlanExecutionQueue planExecutionQueue : planExecutionQueues) {
|
||||
TestPlanWithBLOBs testPlan = testPlanMap.get(planExecutionQueue.getTestPlanId());
|
||||
JSONObject jsonObject = JSONObject.parseObject(testPlan.getRunModeConfig());
|
||||
TestplanRunRequest runRequest = JSON.toJavaObject(jsonObject, TestplanRunRequest.class);
|
||||
TestPlanRequestUtil.changeStringToBoolean(jsonObject);
|
||||
TestPlanRunRequest runRequest = JSON.toJavaObject(jsonObject, TestPlanRunRequest.class);
|
||||
runRequest.setReportId(planExecutionQueue.getReportId());
|
||||
runPlan(runRequest);
|
||||
}
|
||||
|
@ -2407,7 +2453,7 @@ public class TestPlanService {
|
|||
}
|
||||
}
|
||||
|
||||
public void updateRunModeConfig(TestplanRunRequest testplanRunRequest) {
|
||||
public void updateRunModeConfig(TestPlanRunRequest testplanRunRequest) {
|
||||
String testPlanId = testplanRunRequest.getTestPlanId();
|
||||
updatePlan(testplanRunRequest, testPlanId);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
package io.metersphere.track.service.utils;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
public class TestPlanRequestUtil {
|
||||
|
||||
private static final String ON_SAMPLE_ERROR = "onSampleError";
|
||||
private static final String RUN_WITHIN_RESOURCE_POOL = "runWithinResourcePool";
|
||||
|
||||
public static void changeStringToBoolean(JSONObject runModeConfig) {
|
||||
if (runModeConfig != null) {
|
||||
if (runModeConfig.get(ON_SAMPLE_ERROR).equals("true") || runModeConfig.get(ON_SAMPLE_ERROR).equals(true)) {
|
||||
runModeConfig.put(ON_SAMPLE_ERROR, true);
|
||||
} else {
|
||||
runModeConfig.put(ON_SAMPLE_ERROR, false);
|
||||
}
|
||||
if (runModeConfig.get(RUN_WITHIN_RESOURCE_POOL).equals("true") || runModeConfig.get(RUN_WITHIN_RESOURCE_POOL).equals(true)) {
|
||||
runModeConfig.put(RUN_WITHIN_RESOURCE_POOL, true);
|
||||
} else {
|
||||
runModeConfig.put(RUN_WITHIN_RESOURCE_POOL, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -146,7 +146,8 @@
|
|||
<div class="mode-row" v-if="runConfig.mode === 'serial'">
|
||||
<el-checkbox v-model="runConfig.onSampleError">{{
|
||||
$t("api_test.fail_to_stop")
|
||||
}}</el-checkbox>
|
||||
}}
|
||||
</el-checkbox>
|
||||
</div>
|
||||
|
||||
<div class="mode-row" v-if="haveUICase">
|
||||
|
@ -163,16 +164,19 @@
|
|||
<el-button @click="close">{{ $t("commons.cancel") }}</el-button>
|
||||
<el-dropdown @command="handleCommand" style="margin-left: 5px">
|
||||
<el-button type="primary">
|
||||
{{ $t("load_test.save_and_run")
|
||||
{{
|
||||
$t("load_test.save_and_run")
|
||||
}}<i class="el-icon-arrow-down el-icon--right"></i>
|
||||
</el-button>
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item command="run">{{
|
||||
$t("load_test.save_and_run")
|
||||
}}</el-dropdown-item>
|
||||
}}
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item command="save">{{
|
||||
$t("commons.save")
|
||||
}}</el-dropdown-item>
|
||||
}}
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
</div>
|
||||
|
@ -184,9 +188,8 @@
|
|||
<script>
|
||||
import MsDialogFooter from "@/business/components/common/components/MsDialogFooter";
|
||||
import EnvPopover from "@/business/components/api/automation/scenario/EnvPopover";
|
||||
import { strMapToObj } from "@/common/js/utils";
|
||||
import {hasLicense, strMapToObj} from "@/common/js/utils";
|
||||
import {ENV_TYPE} from "@/common/js/constants";
|
||||
import { hasLicense } from "@/common/js/utils";
|
||||
|
||||
export default {
|
||||
name: "MsPlanRunModeWithEnv",
|
||||
|
@ -256,7 +259,12 @@ export default {
|
|||
},
|
||||
},
|
||||
methods: {
|
||||
open(testType) {
|
||||
open(testType, runModeConfig) {
|
||||
if (runModeConfig) {
|
||||
this.runConfig = JSON.parse(runModeConfig);
|
||||
this.runConfig.onSampleError = this.runConfig.onSampleError === 'true' || this.runConfig.onSampleError === true;
|
||||
this.runConfig.runWithinResourcePool = this.runConfig.runWithinResourcePool === 'true' || this.runConfig.runWithinResourcePool === true;
|
||||
}
|
||||
this.runModeVisible = true;
|
||||
this.testType = testType;
|
||||
this.getResourcePools();
|
||||
|
@ -359,6 +367,7 @@ export default {
|
|||
text-align: right;
|
||||
padding-right: 10px;
|
||||
}
|
||||
|
||||
.env-container .content {
|
||||
width: 163px;
|
||||
}
|
||||
|
@ -382,6 +391,7 @@ export default {
|
|||
margin-top: 25px;
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.other-content {
|
||||
height: 100%;
|
||||
}
|
||||
|
|
|
@ -267,11 +267,14 @@
|
|||
</ms-table-column>
|
||||
</span>
|
||||
<template v-slot:opt-before="scope">
|
||||
<ms-table-operator-button :tip="$t('api_test.run')" icon="el-icon-video-play" :class="[scope.row.status==='Archived'?'disable-run':'run-button']" :disabled="scope.row.status === 'Archived'"
|
||||
<ms-table-operator-button :tip="$t('api_test.run')" icon="el-icon-video-play"
|
||||
:class="[scope.row.status==='Archived'?'disable-run':'run-button']"
|
||||
:disabled="scope.row.status === 'Archived'"
|
||||
@exec="handleRun(scope.row)" v-permission="['PROJECT_TRACK_PLAN:READ+RUN']"
|
||||
/>
|
||||
<ms-table-operator-button :tip="$t('commons.edit')" icon="el-icon-edit"
|
||||
@exec="handleEdit(scope.row)" v-permission="['PROJECT_TRACK_PLAN:READ+EDIT']" :disabled="scope.row.status === 'Archived'"
|
||||
@exec="handleEdit(scope.row)" v-permission="['PROJECT_TRACK_PLAN:READ+EDIT']"
|
||||
:disabled="scope.row.status === 'Archived'"
|
||||
style="margin-right: 10px"/>
|
||||
</template>
|
||||
<template v-slot:opt-behind="scope">
|
||||
|
@ -294,7 +297,8 @@
|
|||
<el-dropdown-item command="delete" v-permission="['PROJECT_TRACK_PLAN:READ+DELETE']">
|
||||
{{ $t('commons.delete') }}
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item command="schedule_task" v-permission="['PROJECT_TRACK_PLAN:READ+SCHEDULE']" :disabled="scope.row.status === 'Archived'" >
|
||||
<el-dropdown-item command="schedule_task" v-permission="['PROJECT_TRACK_PLAN:READ+SCHEDULE']"
|
||||
:disabled="scope.row.status === 'Archived'">
|
||||
{{ $t('commons.trigger_mode.schedule') }}
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
|
@ -326,7 +330,8 @@
|
|||
<el-radio label="serial">{{ $t("run_mode.serial") }}</el-radio>
|
||||
<el-radio label="parallel">{{ $t("run_mode.parallel") }}</el-radio>
|
||||
</el-radio-group>
|
||||
</div><br/>
|
||||
</div>
|
||||
<br/>
|
||||
<span>注:运行模式仅对测试计划间有效</span>
|
||||
<template v-slot:footer>
|
||||
<ms-dialog-footer @cancel="closeExecute" @confirm="handleRunBatch"/>
|
||||
|
@ -348,7 +353,9 @@ import {TEST_PLAN_CONFIGS} from "../../../common/components/search/search-compon
|
|||
import {
|
||||
_filter,
|
||||
_sort,
|
||||
deepClone, getCustomTableHeader, getCustomTableWidth,
|
||||
deepClone,
|
||||
getCustomTableHeader,
|
||||
getCustomTableWidth,
|
||||
getLastTableSortField,
|
||||
saveLastTableSortField
|
||||
} from "@/common/js/tableUtils";
|
||||
|
@ -361,7 +368,8 @@ import {
|
|||
getCurrentProjectID,
|
||||
getCurrentUser,
|
||||
getCurrentUserId,
|
||||
hasPermission, operationConfirm
|
||||
hasPermission,
|
||||
operationConfirm
|
||||
} from "@/common/js/utils";
|
||||
import PlanRunModeWithEnv from "@/business/components/track/plan/common/PlanRunModeWithEnv";
|
||||
import TestPlanReportReview from "@/business/components/track/report/components/TestPlanReportReview";
|
||||
|
@ -633,8 +641,7 @@ export default {
|
|||
if (this.condition.selectAll) {
|
||||
param.isAll = true;
|
||||
param.queryTestPlanRequest = this.condition
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
this.$refs.testPlanLitTable.selectRows.forEach((item) => {
|
||||
ids.push(item.id)
|
||||
});
|
||||
|
@ -771,7 +778,7 @@ export default {
|
|||
let r = await this.haveUIScenario();
|
||||
this.haveUICase = r.data.data;
|
||||
if (haveExecCase || this.haveUICase) {
|
||||
this.$refs.runMode.open('API');
|
||||
this.$refs.runMode.open('API', row.runModeConfig);
|
||||
} else {
|
||||
this.$router.push('/track/plan/view/' + row.id);
|
||||
}
|
||||
|
@ -788,7 +795,10 @@ export default {
|
|||
environmentType,
|
||||
environmentGroupId,
|
||||
browser,
|
||||
headlessEnabled
|
||||
headlessEnabled,
|
||||
retryEnable,
|
||||
retryNum,
|
||||
triggerMode
|
||||
} = config;
|
||||
let param = {mode, reportType, onSampleError, runWithinResourcePool, resourcePoolId, envMap};
|
||||
param.testPlanId = this.currentPlanId;
|
||||
|
@ -812,7 +822,7 @@ export default {
|
|||
this.$success(this.$t('commons.save_success'));
|
||||
});
|
||||
}
|
||||
|
||||
this.initTableData();
|
||||
},
|
||||
saveFollow(row) {
|
||||
if (row.showFollow) {
|
||||
|
|
|
@ -2,11 +2,13 @@
|
|||
<div>
|
||||
<el-row>
|
||||
<el-col :span="12" v-if="caseCharData && caseCharData.length > 0">
|
||||
<ms-doughnut-pie-chart style="margin-right: 200px" :name="$t('api_test.home_page.detail_card.single_case')" :data="caseCharData" ref="functionChar"/>
|
||||
<ms-doughnut-pie-chart style="margin-right: 200px" :name="$t('api_test.home_page.detail_card.single_case')"
|
||||
:data="caseCharData" ref="functionChar"/>
|
||||
</el-col>
|
||||
<el-col :span="12" v-if="scenarioCharData && scenarioCharData.length > 0">
|
||||
<api-scenario-char-result :name="$t('test_track.plan.test_plan_api_scenario_count')" :data="scenarioCharData"/>
|
||||
<api-scenario-char-result style="margin-top: -50px;" :name="$t('test_track.plan.test_plan_component_case_count')" :data="stepCharData"/>
|
||||
<api-scenario-char-result style="margin-top: -50px;"
|
||||
:name="$t('test_track.plan.test_plan_component_case_count')" :data="stepCharData"/>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
|
@ -18,6 +20,7 @@ import MsPieChart from "@/business/components/common/components/MsPieChart";
|
|||
import MsDoughnutPieChart from "@/business/components/common/components/MsDoughnutPieChart";
|
||||
import ApiScenarioCharResult
|
||||
from "@/business/components/track/plan/view/comonents/report/detail/component/ApiScenarioCharResult";
|
||||
|
||||
export default {
|
||||
name: "ApiResult",
|
||||
components: {ApiScenarioCharResult, MsDoughnutPieChart, MsPieChart},
|
||||
|
@ -82,12 +85,14 @@ export default {
|
|||
}
|
||||
|
||||
let stepCharData = [];
|
||||
if (this.apiResult.apiScenarioStepData && this.apiResult.apiScenarioStepData.length > 0) {
|
||||
for (let i = 0; i < this.apiResult.apiScenarioStepData.length; i++) {
|
||||
let stepItem = this.apiResult.apiScenarioStepData[i];
|
||||
let data = this.getDataByStatus(stepItem.status);
|
||||
data.value = stepItem.count;
|
||||
stepCharData.push(data);
|
||||
}
|
||||
}
|
||||
|
||||
this.scenarioCharData = apiScenarioData;
|
||||
this.stepCharData = stepCharData;
|
||||
|
|
Loading…
Reference in New Issue