Merge branch 'master' of github.com:metersphere/metersphere

This commit is contained in:
chenjianxing 2021-03-24 10:30:21 +08:00
commit 85320ec7ee
30 changed files with 231 additions and 88 deletions

View File

@ -68,24 +68,36 @@ public class HarParser extends HarAbstractParser {
harEntryList = har.log.entries; harEntryList = har.log.entries;
} }
List<String> savedUrl = new ArrayList<>();
for (HarEntry entry : harEntryList) { for (HarEntry entry : harEntryList) {
HarRequest harRequest = entry.request; HarRequest harRequest = entry.request;
String url = harRequest.url;
if(url == null){
continue;
}
try {
url = URLDecoder.decode(url,"UTF-8");
}catch (Exception e){
}
if(savedUrl.contains(harRequest.url)){
continue;
}else {
savedUrl.add(harRequest.url);
}
//默认取路径的最后一块 //默认取路径的最后一块
String reqName = ""; String reqName = "";
if (harRequest.url != null) { if (harRequest.url != null) {
String[] nameArr = harRequest.url.split("/"); String[] nameArr = url.split("/");
reqName = nameArr[nameArr.length - 1]; reqName = nameArr[nameArr.length - 1];
//然后进行转码解码
try {
reqName = URLDecoder.decode(reqName,"UTF-8");
}catch (Exception e){
}
} }
if (harRequest != null) { if (harRequest != null) {
MsHTTPSamplerProxy request = super.buildRequest(reqName, harRequest.url, harRequest.method); MsHTTPSamplerProxy request = super.buildRequest(reqName, url, harRequest.method);
ApiDefinitionWithBLOBs apiDefinition = super.buildApiDefinition(request.getId(), reqName, harRequest.url, harRequest.method, importRequest); ApiDefinitionWithBLOBs apiDefinition = super.buildApiDefinition(request.getId(), reqName, url, harRequest.method, importRequest);
parseParameters(harRequest, request); parseParameters(harRequest, request);
parseRequestBody(harRequest, request.getBody()); parseRequestBody(harRequest, request.getBody());
addBodyHeader(request); addBodyHeader(request);

View File

@ -5,6 +5,7 @@ import io.metersphere.api.service.*;
import io.metersphere.base.domain.ApiDefinitionExecResult; import io.metersphere.base.domain.ApiDefinitionExecResult;
import io.metersphere.base.domain.ApiScenarioReport; import io.metersphere.base.domain.ApiScenarioReport;
import io.metersphere.base.domain.ApiTestReport; import io.metersphere.base.domain.ApiTestReport;
import io.metersphere.base.domain.TestPlanReport;
import io.metersphere.commons.constants.*; import io.metersphere.commons.constants.*;
import io.metersphere.commons.utils.CommonBeanFactory; import io.metersphere.commons.utils.CommonBeanFactory;
import io.metersphere.commons.utils.LogUtil; import io.metersphere.commons.utils.LogUtil;
@ -14,6 +15,7 @@ import io.metersphere.notice.sender.NoticeModel;
import io.metersphere.notice.service.NoticeSendService; import io.metersphere.notice.service.NoticeSendService;
import io.metersphere.service.SystemParameterService; import io.metersphere.service.SystemParameterService;
import io.metersphere.track.service.TestPlanReportService; import io.metersphere.track.service.TestPlanReportService;
import io.metersphere.track.service.TestPlanService;
import io.metersphere.track.service.TestPlanTestCaseService; import io.metersphere.track.service.TestPlanTestCaseService;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
@ -197,6 +199,9 @@ public class APIBackendListenerClient extends AbstractBackendListenerClient impl
apiDefinitionExecResultService.saveApiResultByScheduleTask(testResult, ApiRunMode.SCHEDULE_API_PLAN.name()); apiDefinitionExecResultService.saveApiResultByScheduleTask(testResult, ApiRunMode.SCHEDULE_API_PLAN.name());
List<String> testPlanReportIdList = new ArrayList<>(); List<String> testPlanReportIdList = new ArrayList<>();
testPlanReportIdList.add(debugReportId); testPlanReportIdList.add(debugReportId);
for(String testPlanReportId : testPlanReportIdList) { // 更新每个测试计划的状态
testPlanReportService.checkTestPlanStatus(testPlanReportId);
}
testPlanReportService.updateReport(testPlanReportIdList, ApiRunMode.SCHEDULE_API_PLAN.name(), ReportTriggerMode.SCHEDULE.name()); testPlanReportService.updateReport(testPlanReportIdList, ApiRunMode.SCHEDULE_API_PLAN.name(), ReportTriggerMode.SCHEDULE.name());
} else { } else {
apiDefinitionExecResultService.saveApiResult(testResult, ApiRunMode.API_PLAN.name()); apiDefinitionExecResultService.saveApiResult(testResult, ApiRunMode.API_PLAN.name());

View File

@ -372,7 +372,7 @@ public class ApiDocumentService {
ApiDocumentShareDTO returnDTO = new ApiDocumentShareDTO(); ApiDocumentShareDTO returnDTO = new ApiDocumentShareDTO();
if (!StringUtils.isEmpty(apiShare.getShareApiId())) { if (!StringUtils.isEmpty(apiShare.getShareApiId())) {
BaseSystemConfigDTO baseSystemConfigDTO = systemParameterService.getBaseInfo(); BaseSystemConfigDTO baseSystemConfigDTO = systemParameterService.getBaseInfo();
String url = "/#/apiDocumentInfo?documentId=" + apiShare.getId(); String url = "?" + apiShare.getId();
returnDTO.setId(apiShare.getId()); returnDTO.setId(apiShare.getId());
returnDTO.setShareUrl(url); returnDTO.setShareUrl(url);
} }

View File

@ -1,5 +1,5 @@
package io.metersphere.commons.constants; package io.metersphere.commons.constants;
public enum TestPlanStatus { public enum TestPlanStatus {
Prepare, Underway, Completed Prepare, Underway, Completed, Finished
} }

View File

@ -2,6 +2,7 @@ package io.metersphere.notice.service;
import com.alibaba.nacos.client.utils.StringUtils; import com.alibaba.nacos.client.utils.StringUtils;
import io.metersphere.commons.constants.NoticeConstants; import io.metersphere.commons.constants.NoticeConstants;
import io.metersphere.commons.utils.LogUtil;
import io.metersphere.notice.domain.MessageDetail; import io.metersphere.notice.domain.MessageDetail;
import io.metersphere.notice.sender.NoticeModel; import io.metersphere.notice.sender.NoticeModel;
import io.metersphere.notice.sender.NoticeSender; import io.metersphere.notice.sender.NoticeSender;
@ -44,22 +45,26 @@ public class NoticeSendService {
} }
public void send(String taskType, NoticeModel noticeModel) { public void send(String taskType, NoticeModel noticeModel) {
List<MessageDetail> messageDetails; try {
switch (taskType) { List<MessageDetail> messageDetails;
case NoticeConstants.Mode.API: switch (taskType) {
messageDetails = noticeService.searchMessageByType(NoticeConstants.TaskType.JENKINS_TASK); case NoticeConstants.Mode.API:
break; messageDetails = noticeService.searchMessageByType(NoticeConstants.TaskType.JENKINS_TASK);
case NoticeConstants.Mode.SCHEDULE: break;
messageDetails = noticeService.searchMessageByTestId(noticeModel.getTestId()); case NoticeConstants.Mode.SCHEDULE:
break; messageDetails = noticeService.searchMessageByTestId(noticeModel.getTestId());
default: break;
messageDetails = noticeService.searchMessageByType(taskType); default:
break; messageDetails = noticeService.searchMessageByType(taskType);
} break;
messageDetails.forEach(messageDetail -> {
if (StringUtils.equals(messageDetail.getEvent(), noticeModel.getEvent())) {
this.getNoticeSender(messageDetail).send(messageDetail, noticeModel);
} }
}); messageDetails.forEach(messageDetail -> {
if (StringUtils.equals(messageDetail.getEvent(), noticeModel.getEvent())) {
this.getNoticeSender(messageDetail).send(messageDetail, noticeModel);
}
});
} catch (Exception e) {
LogUtil.error(e.getMessage(), e);
}
} }
} }

View File

@ -5,6 +5,7 @@ import io.metersphere.base.domain.MessageTaskExample;
import io.metersphere.base.mapper.MessageTaskMapper; import io.metersphere.base.mapper.MessageTaskMapper;
import io.metersphere.commons.exception.MSException; import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.user.SessionUser; import io.metersphere.commons.user.SessionUser;
import io.metersphere.commons.utils.LogUtil;
import io.metersphere.commons.utils.SessionUtils; import io.metersphere.commons.utils.SessionUtils;
import io.metersphere.i18n.Translator; import io.metersphere.i18n.Translator;
import io.metersphere.notice.domain.MessageDetail; import io.metersphere.notice.domain.MessageDetail;
@ -102,29 +103,34 @@ public class NoticeService {
} }
public List<MessageDetail> searchMessageByType(String type) { public List<MessageDetail> searchMessageByType(String type) {
SessionUser user = SessionUtils.getUser(); try {
String orgId = user.getLastOrganizationId(); SessionUser user = SessionUtils.getUser();
List<MessageDetail> messageDetails = new ArrayList<>(); String orgId = user.getLastOrganizationId();
List<MessageDetail> messageDetails = new ArrayList<>();
MessageTaskExample example = new MessageTaskExample(); MessageTaskExample example = new MessageTaskExample();
example.createCriteria() example.createCriteria()
.andTaskTypeEqualTo(type) .andTaskTypeEqualTo(type)
.andOrganizationIdEqualTo(orgId); .andOrganizationIdEqualTo(orgId);
List<MessageTask> messageTaskLists = messageTaskMapper.selectByExampleWithBLOBs(example); List<MessageTask> messageTaskLists = messageTaskMapper.selectByExampleWithBLOBs(example);
Map<String, List<MessageTask>> messageTaskMap = messageTaskLists.stream() Map<String, List<MessageTask>> messageTaskMap = messageTaskLists.stream()
.collect(Collectors.groupingBy(NoticeService::fetchGroupKey)); .collect(Collectors.groupingBy(NoticeService::fetchGroupKey));
messageTaskMap.forEach((k, v) -> { messageTaskMap.forEach((k, v) -> {
MessageDetail messageDetail = getMessageDetail(v); MessageDetail messageDetail = getMessageDetail(v);
messageDetails.add(messageDetail); messageDetails.add(messageDetail);
}); });
return messageDetails.stream() return messageDetails.stream()
.sorted(Comparator.comparing(MessageDetail::getCreateTime, Comparator.nullsLast(Long::compareTo)).reversed()) .sorted(Comparator.comparing(MessageDetail::getCreateTime, Comparator.nullsLast(Long::compareTo)).reversed())
.collect(Collectors.toList()) .collect(Collectors.toList())
.stream() .stream()
.distinct() .distinct()
.collect(Collectors.toList()); .collect(Collectors.toList());
} catch (Exception e) {
LogUtil.error(e.getMessage(), e);
return new ArrayList<>();
}
} }
private MessageDetail getMessageDetail(List<MessageTask> messageTasks) { private MessageDetail getMessageDetail(List<MessageTask> messageTasks) {

View File

@ -37,6 +37,11 @@ public class TestPlanController {
@Resource @Resource
CheckPermissionService checkPermissionService; CheckPermissionService checkPermissionService;
@PostMapping("/autoCheck/{testPlanId}")
public void autoCheck(@PathVariable String testPlanId){
testPlanService.checkStatus(testPlanId);
}
@PostMapping("/list/{goPage}/{pageSize}") @PostMapping("/list/{goPage}/{pageSize}")
public Pager<List<TestPlanDTOWithMetric>> list(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody QueryTestPlanRequest request) { public Pager<List<TestPlanDTOWithMetric>> list(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody QueryTestPlanRequest request) {
String currentWorkspaceId = SessionUtils.getCurrentWorkspaceId(); String currentWorkspaceId = SessionUtils.getCurrentWorkspaceId();

View File

@ -11,10 +11,7 @@ import io.metersphere.base.mapper.ext.ExtTestPlanApiCaseMapper;
import io.metersphere.base.mapper.ext.ExtTestPlanMapper; import io.metersphere.base.mapper.ext.ExtTestPlanMapper;
import io.metersphere.base.mapper.ext.ExtTestPlanReportMapper; import io.metersphere.base.mapper.ext.ExtTestPlanReportMapper;
import io.metersphere.commons.constants.*; import io.metersphere.commons.constants.*;
import io.metersphere.commons.utils.CommonBeanFactory; import io.metersphere.commons.utils.*;
import io.metersphere.commons.utils.DateUtils;
import io.metersphere.commons.utils.ServiceUtils;
import io.metersphere.commons.utils.SessionUtils;
import io.metersphere.dto.BaseSystemConfigDTO; import io.metersphere.dto.BaseSystemConfigDTO;
import io.metersphere.i18n.Translator; import io.metersphere.i18n.Translator;
import io.metersphere.notice.sender.NoticeModel; import io.metersphere.notice.sender.NoticeModel;
@ -212,6 +209,15 @@ public class TestPlanReportService {
} }
} }
public void checkTestPlanStatus(String planReportId) {
try {
TestPlanReport testPlanReport = testPlanReportMapper.selectByPrimaryKey(planReportId);
testPlanService.checkStatus(testPlanReport.getTestPlanId());
} catch (Exception e) {
LogUtil.error(e.getMessage(), e);
}
}
/** /**
* *
* @param planReportId 测试计划报告ID * @param planReportId 测试计划报告ID

View File

@ -194,7 +194,10 @@ public class TestPlanService {
!TestPlanStatus.Completed.name().equals(res.getStatus())) { !TestPlanStatus.Completed.name().equals(res.getStatus())) {
//已完成写入实际完成时间 //已完成写入实际完成时间
testPlan.setActualEndTime(System.currentTimeMillis()); testPlan.setActualEndTime(System.currentTimeMillis());
} } else if (!res.getStatus().equals(TestPlanStatus.Finished.name()) &&
TestPlanStatus.Finished.name().equals(testPlan.getStatus())) {
testPlan.setActualEndTime(System.currentTimeMillis());
} // 非已结束->已结束更新结束时间
} }
List<String> userIds = new ArrayList<>(); List<String> userIds = new ArrayList<>();
@ -367,7 +370,7 @@ public class TestPlanService {
testPlan.setTotal(apiExecResults.size() + scenarioExecResults.size() + functionalExecResults.size() + loadResults.size()); testPlan.setTotal(apiExecResults.size() + scenarioExecResults.size() + functionalExecResults.size() + loadResults.size());
testPlan.setPassRate(MathUtils.getPercentWithDecimal(testPlan.getTested() == 0 ? 0 : testPlan.getPassed() * 1.0 / testPlan.getTested())); testPlan.setPassRate(MathUtils.getPercentWithDecimal(testPlan.getTested() == 0 ? 0 : testPlan.getPassed() * 1.0 / testPlan.getTotal()));
testPlan.setTestRate(MathUtils.getPercentWithDecimal(testPlan.getTotal() == 0 ? 0 : testPlan.getTested() * 1.0 / testPlan.getTotal())); testPlan.setTestRate(MathUtils.getPercentWithDecimal(testPlan.getTotal() == 0 ? 0 : testPlan.getTested() * 1.0 / testPlan.getTotal()));
}); });
} }
@ -383,6 +386,44 @@ public class TestPlanService {
return testPlans; return testPlans;
} }
public void checkStatus(String testPlanId) { // 检查执行结果自动更新计划状态
List<String> statusList = new ArrayList<>();
statusList.addAll(extTestPlanTestCaseMapper.getExecResultByPlanId(testPlanId));
statusList.addAll(testPlanApiCaseService.getExecResultByPlanId(testPlanId));
statusList.addAll(testPlanScenarioCaseService.getExecResultByPlanId(testPlanId));
statusList.addAll(testPlanLoadCaseService.getStatus(testPlanId));
// Prepare, Pass, Failure, Blocking, Skip, Underway
TestPlanDTO testPlanDTO = new TestPlanDTO();
testPlanDTO.setId(testPlanId);
if(statusList.size() == 0) { // 原先status不是prepare, 但删除所有关联用例的情况
testPlanDTO.setStatus(TestPlanStatus.Prepare.name());
editTestPlan(testPlanDTO);
return;
}
int passNum = 0, prepareNum = 0, failNum = 0;
for(String res : statusList) {
if(StringUtils.equals(res, TestPlanTestCaseStatus.Pass.name())
|| StringUtils.equals(res, "success")
|| StringUtils.equals(res, ScenarioStatus.Success.name())) {
passNum++;
} else if (res == null) {
prepareNum++;
} else {
failNum++;
}
}
if(passNum == statusList.size()) { // 全部通过
testPlanDTO.setStatus(TestPlanStatus.Completed.name());
this.editTestPlan(testPlanDTO);
} else if(prepareNum == 0 && passNum + failNum == statusList.size()) { // 已结束
testPlanDTO.setStatus(TestPlanStatus.Finished.name());
editTestPlan(testPlanDTO);
} else if(prepareNum != 0) { // 进行中
testPlanDTO.setStatus(TestPlanStatus.Underway.name());
editTestPlan(testPlanDTO);
}
}
public List<TestPlanDTOWithMetric> listTestPlanByProject(QueryTestPlanRequest request) { public List<TestPlanDTOWithMetric> listTestPlanByProject(QueryTestPlanRequest request) {
List<TestPlanDTOWithMetric> testPlans = extTestPlanMapper.list(request); List<TestPlanDTOWithMetric> testPlans = extTestPlanMapper.list(request);
return testPlans; return testPlans;

View File

@ -574,14 +574,15 @@
this.isBtnHide = true; this.isBtnHide = true;
this.$refs.scenarioApiRelevance.open(); this.$refs.scenarioApiRelevance.open();
}, },
recursiveSorting(arr) { recursiveSorting(arr, scenarioProjectId) {
for (let i in arr) { for (let i in arr) {
arr[i].index = Number(i) + 1; arr[i].index = Number(i) + 1;
if (arr[i].type === ELEMENT_TYPE.LoopController && arr[i].hashTree && arr[i].hashTree.length > 1) { if (arr[i].type === ELEMENT_TYPE.LoopController && arr[i].hashTree && arr[i].hashTree.length > 1) {
arr[i].countController.proceed = true; arr[i].countController.proceed = true;
} }
if (!arr[i].projectId) { if (!arr[i].projectId) {
arr[i].projectId = this.projectId; // IDIDIDID
arr[i].projectId = scenarioProjectId ? scenarioProjectId : this.projectId;
} }
if (arr[i].hashTree != undefined && arr[i].hashTree.length > 0) { if (arr[i].hashTree != undefined && arr[i].hashTree.length > 0) {
this.recursiveSorting(arr[i].hashTree); this.recursiveSorting(arr[i].hashTree);
@ -606,7 +607,7 @@
this.scenarioDefinition[i].projectId = this.projectId; this.scenarioDefinition[i].projectId = this.projectId;
} }
if (this.scenarioDefinition[i].hashTree != undefined && this.scenarioDefinition[i].hashTree.length > 0) { if (this.scenarioDefinition[i].hashTree != undefined && this.scenarioDefinition[i].hashTree.length > 0) {
this.recursiveSorting(this.scenarioDefinition[i].hashTree); this.recursiveSorting(this.scenarioDefinition[i].hashTree, this.scenarioDefinition[i].projectId);
} }
// debug // debug
if (this.debugResult && this.debugResult.get(this.scenarioDefinition[i].id)) { if (this.debugResult && this.debugResult.get(this.scenarioDefinition[i].id)) {

View File

@ -84,8 +84,8 @@
import ApiResponseComponent from "./ApiResponseComponent"; import ApiResponseComponent from "./ApiResponseComponent";
import CustomizeReqInfo from "@/business/components/api/automation/scenario/common/CustomizeReqInfo"; import CustomizeReqInfo from "@/business/components/api/automation/scenario/common/CustomizeReqInfo";
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/); const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
const esbDefinition = (requireComponent!=null&&requireComponent.keys().length) > 0 ? requireComponent("./apiDefinition/EsbDefinition.vue") : {}; const esbDefinition = (requireComponent!=null&&requireComponent.keys().length) > 0 ? requireComponent("./apidefinition/EsbDefinition.vue") : {};
const esbDefinitionResponse = (requireComponent!=null&&requireComponent.keys().length) > 0 ? requireComponent("./apiDefinition/EsbDefinitionResponse.vue") : {}; const esbDefinitionResponse = (requireComponent!=null&&requireComponent.keys().length) > 0 ? requireComponent("./apidefinition/EsbDefinitionResponse.vue") : {};
export default { export default {
name: "MsApiComponent", name: "MsApiComponent",

View File

@ -490,14 +490,14 @@
apiListImport() { apiListImport() {
this.$refs.scenarioApiRelevance.open(); this.$refs.scenarioApiRelevance.open();
}, },
recursiveSorting(arr) { recursiveSorting(arr, scenarioProjectId) {
for (let i in arr) { for (let i in arr) {
arr[i].index = Number(i) + 1; arr[i].index = Number(i) + 1;
if (arr[i].type === ELEMENT_TYPE.LoopController && arr[i].hashTree && arr[i].hashTree.length > 1) { if (arr[i].type === ELEMENT_TYPE.LoopController && arr[i].hashTree && arr[i].hashTree.length > 1) {
arr[i].countController.proceed = true; arr[i].countController.proceed = true;
} }
if (!arr[i].projectId) { if (!arr[i].projectId) {
arr[i].projectId = this.projectId; arr[i].projectId = scenarioProjectId ? scenarioProjectId : this.projectId;
} }
if (arr[i].hashTree != undefined && arr[i].hashTree.length > 0) { if (arr[i].hashTree != undefined && arr[i].hashTree.length > 0) {
this.recursiveSorting(arr[i].hashTree); this.recursiveSorting(arr[i].hashTree);
@ -522,7 +522,7 @@
this.scenarioDefinition[i].projectId = this.projectId; this.scenarioDefinition[i].projectId = this.projectId;
} }
if (this.scenarioDefinition[i].hashTree != undefined && this.scenarioDefinition[i].hashTree.length > 0) { if (this.scenarioDefinition[i].hashTree != undefined && this.scenarioDefinition[i].hashTree.length > 0) {
this.recursiveSorting(this.scenarioDefinition[i].hashTree); this.recursiveSorting(this.scenarioDefinition[i].hashTree, this.scenarioDefinition[i].projectId);
} }
// debug // debug
if (this.debugResult && this.debugResult.get(this.scenarioDefinition[i].id)) { if (this.debugResult && this.debugResult.get(this.scenarioDefinition[i].id)) {

View File

@ -86,6 +86,7 @@
this.$fileUpload(url, null, bodyFiles, reqObj, response => { this.$fileUpload(url, null, bodyFiles, reqObj, response => {
this.runId = response.data; this.runId = response.data;
this.getResult(); this.getResult();
this.$emit('autoCheckStatus'); //
}, error => { }, error => {
this.$emit('runRefresh', {}); this.$emit('runRefresh', {});
}); });

View File

@ -129,9 +129,10 @@
import MsJmxStep from "../step/JmxStep"; import MsJmxStep from "../step/JmxStep";
import ApiResponseComponent from "../../../automation/scenario/component/ApiResponseComponent"; import ApiResponseComponent from "../../../automation/scenario/component/ApiResponseComponent";
import ShowMoreBtn from "../../../../track/case/components/ShowMoreBtn"; import ShowMoreBtn from "../../../../track/case/components/ShowMoreBtn";
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/); const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
const esbDefinition = (requireComponent!=null&&requireComponent.keys().length) > 0 ? requireComponent("./apiDefinition/EsbDefinition.vue") : {}; const esbDefinition = (requireComponent != null && requireComponent.keys().length) > 0 ? requireComponent("./apidefinition/EsbDefinition.vue") : {};
const esbDefinitionResponse = (requireComponent!=null&&requireComponent.keys().length) > 0 ? requireComponent("./apiDefinition/EsbDefinitionResponse.vue") : {}; const esbDefinitionResponse = (requireComponent != null && requireComponent.keys().length) > 0 ? requireComponent("./apidefinition/EsbDefinitionResponse.vue") : {};
export default { export default {
name: "ApiCaseItem", name: "ApiCaseItem",
@ -157,7 +158,7 @@
return { return {
result: {}, result: {},
grades: [], grades: [],
showXpackCompnent:false, showXpackCompnent: false,
isReadOnly: false, isReadOnly: false,
selectedEvent: Object, selectedEvent: Object,
priorities: PRIORITY, priorities: PRIORITY,
@ -198,7 +199,7 @@
isCaseEdit: Boolean, isCaseEdit: Boolean,
}, },
created() { created() {
if (requireComponent != null && JSON.stringify(esbDefinition) != '{}'&& JSON.stringify(esbDefinitionResponse) != '{}') { if (requireComponent != null && JSON.stringify(esbDefinition) != '{}' && JSON.stringify(esbDefinitionResponse) != '{}') {
this.showXpackCompnent = true; this.showXpackCompnent = true;
} }
}, },
@ -224,7 +225,7 @@
}); });
}, },
singleRun(data) { singleRun(data) {
if (!this.environment) { if (this.api.protocol != "DUBBO" && this.api.protocol != "dubbo://" && !this.environment) {
this.$warning(this.$t('api_test.environment.select_environment')); this.$warning(this.$t('api_test.environment.select_environment'));
return; return;
} }
@ -316,10 +317,10 @@
} }
} }
if(tmp.request.esbDataStruct != null){ if (tmp.request.esbDataStruct != null) {
tmp.esbDataStruct = JSON.stringify(tmp.request.esbDataStruct); tmp.esbDataStruct = JSON.stringify(tmp.request.esbDataStruct);
} }
if(tmp.request.backEsbDataStruct != null){ if (tmp.request.backEsbDataStruct != null) {
tmp.backEsbDataStruct = JSON.stringify(tmp.request.backEsbDataStruct); tmp.backEsbDataStruct = JSON.stringify(tmp.request.backEsbDataStruct);
} }

View File

@ -280,7 +280,7 @@
}, },
singleRun(row) { singleRun(row) {
if (!this.environment) { if (this.currentApi.protocol != "DUBBO" && this.currentApi.protocol != "dubbo://" && !this.environment) {
this.$warning(this.$t('api_test.environment.select_environment')); this.$warning(this.$t('api_test.environment.select_environment'));
return; return;
} }
@ -298,7 +298,7 @@
}, },
batchRun() { batchRun() {
if (!this.environment) { if (this.currentApi.protocol != "DUBBO" && this.currentApi.protocol != "dubbo://" && !this.environment) {
this.$warning(this.$t('api_test.environment.select_environment')); this.$warning(this.$t('api_test.environment.select_environment'));
return; return;
} }

View File

@ -41,8 +41,8 @@
import MsTcpBasicApi from "./TCPBasicApi"; import MsTcpBasicApi from "./TCPBasicApi";
import MsBasisParameters from "../request/tcp/TcpBasisParameters"; import MsBasisParameters from "../request/tcp/TcpBasisParameters";
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/); const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
const esbDefinition = (requireComponent!=null&&requireComponent.keys().length) > 0 ? requireComponent("./apiDefinition/EsbDefinition.vue") : {}; const esbDefinition = (requireComponent!=null&&requireComponent.keys().length) > 0 ? requireComponent("./apidefinition/EsbDefinition.vue") : {};
const esbDefinitionResponse = (requireComponent!=null&&requireComponent.keys().length) > 0 ? requireComponent("./apiDefinition/EsbDefinitionResponse.vue") : {}; const esbDefinitionResponse = (requireComponent!=null&&requireComponent.keys().length) > 0 ? requireComponent("./apidefinition/EsbDefinitionResponse.vue") : {};
export default { export default {
name: "MsAddCompleteTcpApi", name: "MsAddCompleteTcpApi",
components: {MsTcpBasicApi, MsBasisParameters, components: {MsTcpBasicApi, MsBasisParameters,

View File

@ -26,7 +26,7 @@
@keyup.enter.native="initApiDocSimpleList()" v-model="apiSearch.name"/> @keyup.enter.native="initApiDocSimpleList()" v-model="apiSearch.name"/>
<api-document-batch-share v-xpack v-if="showXpackCompnent" @shareApiDocument="shareApiDocument" :project-id="projectId" :share-url="batchShareUrl" style="float: right;margin: 6px;font-size: 17px"/> <api-document-batch-share v-xpack v-if="showXpackCompnent" @shareApiDocument="shareApiDocument" :project-id="projectId" :share-url="batchShareUrl" style="float: right;margin: 6px;font-size: 17px"/>
</el-row> </el-row>
<el-row v-else style="margin-top: 0px;position: fixed;float: right;margin-right: 0px;margin-left: 400px;top: 150px; z-index: 3456; right: 90px;"> <el-row v-else style="margin-top: 0px;position: fixed;float: right;margin-right: 0px;margin-left: 400px;top: 150px; right: 90px;">
<el-select size="small" :placeholder="$t('api_test.definition.document.order')" v-model="apiSearch.orderCondition" style="float: right;width: 180px;margin-right: 5px" <el-select size="small" :placeholder="$t('api_test.definition.document.order')" v-model="apiSearch.orderCondition" style="float: right;width: 180px;margin-right: 5px"
class="ms-api-header-select" @change="initApiDocSimpleList" clearable> class="ms-api-header-select" @change="initApiDocSimpleList" clearable>
<el-option key="createTimeDesc" :label="$t('api_test.definition.document.create_time_sort')" value="createTimeDesc" /> <el-option key="createTimeDesc" :label="$t('api_test.definition.document.create_time_sort')" value="createTimeDesc" />

View File

@ -8,7 +8,11 @@
<el-menu-item index="1" v-show="false">Placeholder</el-menu-item> <el-menu-item index="1" v-show="false">Placeholder</el-menu-item>
<el-submenu index="1" popper-class="org-ws-submenu" <el-submenu index="1" popper-class="org-ws-submenu"
v-roles="['org_admin', 'test_manager', 'test_user', 'test_viewer']"> v-roles="['org_admin', 'test_manager', 'test_user', 'test_viewer']">
<template v-slot:title>{{ $t('commons.organization') }}: {{ currentOrganizationName }}</template> <template v-slot:title>{{ $t('commons.organization') }}:
<span class="org-ws-name" :title="currentOrganizationName">
{{ currentOrganizationName }}
</span>
</template>
<el-input :placeholder="$t('project.search_by_name')" <el-input :placeholder="$t('project.search_by_name')"
prefix-icon="el-icon-search" prefix-icon="el-icon-search"
v-model="searchOrg" v-model="searchOrg"
@ -17,14 +21,20 @@
size="small"/> size="small"/>
<div class="org-ws-menu"> <div class="org-ws-menu">
<el-menu-item @click="changeOrg(item)" v-for="(item,index) in organizationList" :key="index"> <el-menu-item @click="changeOrg(item)" v-for="(item,index) in organizationList" :key="index">
{{ item.name }} <span class="title">
{{ item.name }}
</span>
<i class="el-icon-check" <i class="el-icon-check"
v-if="item.id === currentUserInfo.lastOrganizationId"></i> v-if="item.id === currentUserInfo.lastOrganizationId"></i>
</el-menu-item> </el-menu-item>
</div> </div>
</el-submenu> </el-submenu>
<el-submenu index="2" popper-class="submenu" v-roles="['test_manager', 'test_user', 'test_viewer']"> <el-submenu index="2" popper-class="submenu" v-roles="['test_manager', 'test_user', 'test_viewer']">
<template v-slot:title>{{ $t('commons.workspace') }}: {{ currentWorkspaceName }}</template> <template v-slot:title>{{ $t('commons.workspace') }}:
<span class="org-ws-name" :title="currentWorkspaceName">
{{ currentWorkspaceName }}
</span>
</template>
<el-input :placeholder="$t('project.search_by_name')" <el-input :placeholder="$t('project.search_by_name')"
prefix-icon="el-icon-search" prefix-icon="el-icon-search"
v-model="searchWs" v-model="searchWs"
@ -33,7 +43,9 @@
size="small"/> size="small"/>
<div class="org-ws-menu"> <div class="org-ws-menu">
<el-menu-item @click="changeWs(item)" v-for="(item,index) in workspaceList" :key="index"> <el-menu-item @click="changeWs(item)" v-for="(item,index) in workspaceList" :key="index">
{{ item.name }} <span class="title">
{{ item.name }}
</span>
<i class="el-icon-check" v-if="item.id === currentUserInfo.lastWorkspaceId"></i> <i class="el-icon-check" v-if="item.id === currentUserInfo.lastWorkspaceId"></i>
</el-menu-item> </el-menu-item>
</div> </div>
@ -219,4 +231,23 @@ export default {
color: #d2ced8; color: #d2ced8;
border-color: #b4aebe; border-color: #b4aebe;
} }
.title {
display: inline-block;
padding-left: 15px;
max-width: 150px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.org-ws-name {
display: inline-block;
padding-left: 15px;
max-width: 110px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
</style> </style>

View File

@ -345,13 +345,11 @@ export default {
this.$refs.basicConfig.threadGroups = threadGroups; this.$refs.basicConfig.threadGroups = threadGroups;
this.$refs.pressureConfig.threadGroups = threadGroups; this.$refs.pressureConfig.threadGroups = threadGroups;
threadGroups.forEach(tg => { handler.calculateTotalChart();
handler.calculateChart(tg);
})
}, },
tgTypeChange(threadGroup) { tgTypeChange(threadGroup) {
let handler = this.$refs.pressureConfig; let handler = this.$refs.pressureConfig;
handler.calculateChart(threadGroup); handler.calculateTotalChart();
} }
} }
} }

View File

@ -232,7 +232,7 @@ export default {
callback(); callback();
} else { } else {
this.$error(this.$t('load_test.project_file_exist')); this.$error(this.$t('load_test.project_file_exist') + ', name: ' + file.name);
} }
}); });
}, },

View File

@ -2,6 +2,7 @@
<div> <div>
<ms-tag v-if="value == 'Prepare'" type="info" :content="$t('test_track.plan.plan_status_prepare')"/> <ms-tag v-if="value == 'Prepare'" type="info" :content="$t('test_track.plan.plan_status_prepare')"/>
<ms-tag v-if="value == 'Underway'" type="primary" :content="$t('test_track.plan.plan_status_running')"/> <ms-tag v-if="value == 'Underway'" type="primary" :content="$t('test_track.plan.plan_status_running')"/>
<ms-tag v-if="value == 'Finished'" type="warning" :content="$t('test_track.plan.plan_status_finished')"/>
<ms-tag v-if="value == 'Completed'" type="success" :content="$t('test_track.plan.plan_status_completed')"/> <ms-tag v-if="value == 'Completed'" type="success" :content="$t('test_track.plan.plan_status_completed')"/>
<ms-tag v-if="value === 'Trash'" type="danger" effect="plain" :content="$t('test_track.plan.plan_status_trash')"/> <ms-tag v-if="value === 'Trash'" type="danger" effect="plain" :content="$t('test_track.plan.plan_status_trash')"/>
</div> </div>

View File

@ -53,6 +53,10 @@
:command="{item: scope.row, status: 'Underway'}"> :command="{item: scope.row, status: 'Underway'}">
{{ $t('test_track.plan.plan_status_running') }} {{ $t('test_track.plan.plan_status_running') }}
</el-dropdown-item> </el-dropdown-item>
<el-dropdown-item :disabled="!isTestManagerOrTestUser"
:command="{item: scope.row, status: 'Finished'}">
{{ $t('test_track.plan.plan_status_finished') }}
</el-dropdown-item>
<el-dropdown-item :disabled="!isTestManagerOrTestUser" <el-dropdown-item :disabled="!isTestManagerOrTestUser"
:command="{item: scope.row, status: 'Completed'}"> :command="{item: scope.row, status: 'Completed'}">
{{ $t('test_track.plan.plan_status_completed') }} {{ $t('test_track.plan.plan_status_completed') }}
@ -82,7 +86,7 @@
show-overflow-tooltip show-overflow-tooltip
:key="index"> :key="index">
<template v-slot:default="scope"> <template v-slot:default="scope">
<el-progress :percentage="scope.row.testRate"></el-progress> <el-progress :percentage="scope.row.passRate.substring(0, scope.row.passRate.length-1)"></el-progress>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
@ -263,6 +267,7 @@ export default {
statusFilters: [ statusFilters: [
{text: this.$t('test_track.plan.plan_status_prepare'), value: 'Prepare'}, {text: this.$t('test_track.plan.plan_status_prepare'), value: 'Prepare'},
{text: this.$t('test_track.plan.plan_status_running'), value: 'Underway'}, {text: this.$t('test_track.plan.plan_status_running'), value: 'Underway'},
{text: this.$t('test_track.plan.plan_status_finished'), value: 'Finished'},
{text: this.$t('test_track.plan.plan_status_completed'), value: 'Completed'} {text: this.$t('test_track.plan.plan_status_completed'), value: 'Completed'}
], ],
stageFilters: [ stageFilters: [

View File

@ -127,7 +127,7 @@
<!-- 执行组件 --> <!-- 执行组件 -->
<ms-run :debug="false" :type="'API_PLAN'" :reportId="reportId" :run-data="runData" <ms-run :debug="false" :type="'API_PLAN'" :reportId="reportId" :run-data="runData"
@runRefresh="runRefresh" ref="runTest"/> @runRefresh="runRefresh" ref="runTest" @autoCheckStatus="autoCheckStatus"/>
<!-- 批量编辑 --> <!-- 批量编辑 -->
<batch-edit :dialog-title="$t('test_track.case.batch_edit_case')" :type-arr="typeArr" :value-arr="valueArr" <batch-edit :dialog-title="$t('test_track.case.batch_edit_case')" :type-arr="typeArr" :value-arr="valueArr"
@ -319,6 +319,7 @@ export default {
this.$emit('isApiListEnableChange', data); this.$emit('isApiListEnableChange', data);
}, },
initTable() { initTable() {
this.autoCheckStatus();
this.selectRows = new Set(); this.selectRows = new Set();
this.condition.status = ""; this.condition.status = "";
this.condition.moduleIds = this.selectNodeIds; this.condition.moduleIds = this.selectNodeIds;
@ -520,6 +521,10 @@ export default {
this.$fileUpload("/api/definition/run", null, bodyFiles, reqObj, response => { this.$fileUpload("/api/definition/run", null, bodyFiles, reqObj, response => {
}); });
}, },
autoCheckStatus() { //
this.$post('/test/plan/autoCheck/' + this.planId, (response) => {
});
},
handleDelete(apiCase) { handleDelete(apiCase) {
if (this.planId) { if (this.planId) {
this.$get('/test/plan/api/case/delete/' + apiCase.id, () => { this.$get('/test/plan/api/case/delete/' + apiCase.id, () => {

View File

@ -431,6 +431,7 @@ export default {
}, },
initTableData() { initTableData() {
this.autoCheckStatus();
if (this.planId) { if (this.planId) {
// param.planId = this.planId; // param.planId = this.planId;
this.condition.planId = this.planId; this.condition.planId = this.planId;
@ -479,6 +480,10 @@ export default {
} }
getLabel(this, TEST_PLAN_FUNCTION_TEST_CASE); getLabel(this, TEST_PLAN_FUNCTION_TEST_CASE);
}, },
autoCheckStatus() {
this.$post('/test/plan/autoCheck/' + this.planId, (response) => {
});
},
showDetail(row, event, column) { showDetail(row, event, column) {
this.isReadOnly = true; this.isReadOnly = true;
this.$refs.testPlanTestCaseEdit.openTestCaseEdit(row); this.$refs.testPlanTestCaseEdit.openTestCaseEdit(row);

View File

@ -213,6 +213,7 @@ export default {
this.$refs.headerCustom.open(this.tableLabel) this.$refs.headerCustom.open(this.tableLabel)
}, },
initTable() { initTable() {
this.autoCheckStatus();
this.selectRows = new Set(); this.selectRows = new Set();
this.condition.testPlanId = this.planId; this.condition.testPlanId = this.planId;
if (this.selectProjectId && this.selectProjectId !== 'root') { if (this.selectProjectId && this.selectProjectId !== 'root') {
@ -247,6 +248,10 @@ export default {
getLabel(this, TEST_PLAN_LOAD_CASE); getLabel(this, TEST_PLAN_LOAD_CASE);
}, },
autoCheckStatus() {
this.$post('/test/plan/autoCheck/' + this.planId, (response) => {
});
},
refreshStatus() { refreshStatus() {
this.refreshScheduler = setInterval(() => { this.refreshScheduler = setInterval(() => {
// //

@ -1 +1 @@
Subproject commit bc5735a2eb796640bde400ae6cafca6229672905 Subproject commit 07951ba17aef6f29e50cfd68e40de3266f9a60cd

View File

@ -40,10 +40,17 @@ export default {
}, },
methods: { methods: {
getUrlParam(){ getUrlParam(){
let queryParams =this.$route.query; let herfUrl = window.location.href;
let documentIdParam = queryParams['documentId']; if(herfUrl.indexOf("?") > 0){
this.documentId = queryParams['documentId']; let paramArr = herfUrl.split("?");
return documentIdParam; if(paramArr.length > 1){
let documentId = paramArr[1];
if(documentId.indexOf("#") > 0){
documentId = documentId.split("#")[0];
}
this.documentId = documentId;
}
}
}, },
selectDocumentInfo(){ selectDocumentInfo(){
this.getUrlParam(); this.getUrlParam();

View File

@ -1242,6 +1242,7 @@ export default {
input_plan_stage: "Please select stage", input_plan_stage: "Please select stage",
plan_status_prepare: "Not started", plan_status_prepare: "Not started",
plan_status_running: "Starting", plan_status_running: "Starting",
plan_status_finished: "Finished",
plan_status_completed: "Completed", plan_status_completed: "Completed",
plan_status_trash: "Trashed", plan_status_trash: "Trashed",
planned_start_time: "Scheduled Start Time", planned_start_time: "Scheduled Start Time",

View File

@ -1246,6 +1246,7 @@ export default {
input_plan_stage: "请选择测试阶段", input_plan_stage: "请选择测试阶段",
plan_status_prepare: "未开始", plan_status_prepare: "未开始",
plan_status_running: "进行中", plan_status_running: "进行中",
plan_status_finished: "已结束",
plan_status_completed: "已完成", plan_status_completed: "已完成",
plan_status_trash: "废弃", plan_status_trash: "废弃",
planned_start_time: "计划开始", planned_start_time: "计划开始",

View File

@ -1244,6 +1244,7 @@ export default {
input_plan_stage: "請選擇測試階段", input_plan_stage: "請選擇測試階段",
plan_status_prepare: "未開始", plan_status_prepare: "未開始",
plan_status_running: "進行中", plan_status_running: "進行中",
plan_status_finished: "已結束",
plan_status_completed: "已完成", plan_status_completed: "已完成",
plan_status_trash: "廢棄", plan_status_trash: "廢棄",
planned_start_time: "計劃開始", planned_start_time: "計劃開始",