Merge remote-tracking branch 'origin/v1.8' into v1.8
This commit is contained in:
commit
c4cf9b2848
|
@ -160,14 +160,16 @@ public class MsHTTPSamplerProxy extends MsTestElement {
|
||||||
sampler.setProtocol(urlObject.getProtocol());
|
sampler.setProtocol(urlObject.getProtocol());
|
||||||
sampler.setPath(urlObject.getPath());
|
sampler.setPath(urlObject.getPath());
|
||||||
} else {
|
} else {
|
||||||
String configStr = config.getConfig().get(this.getProjectId()).getHttpConfig().getSocket();
|
sampler.setDomain(config.getConfig().get(this.getProjectId()).getHttpConfig().getDomain());
|
||||||
sampler.setDomain(configStr);
|
url = config.getConfig().get(this.getProjectId()).getHttpConfig().getProtocol() + "://" + config.getConfig().get(this.getProjectId()).getHttpConfig().getSocket();
|
||||||
if (config.getConfig().get(this.getProjectId()).getHttpConfig().getPort() > 0) {
|
URL urlObject = new URL(url);
|
||||||
sampler.setDomain(config.getConfig().get(this.getProjectId()).getHttpConfig().getDomain());
|
String envPath = StringUtils.equals(urlObject.getPath(), "/") ? "" : urlObject.getPath();
|
||||||
|
if (StringUtils.isNotBlank(this.getPath())) {
|
||||||
|
envPath += this.getPath();
|
||||||
}
|
}
|
||||||
sampler.setPort(config.getConfig().get(this.getProjectId()).getHttpConfig().getPort());
|
sampler.setPort(config.getConfig().get(this.getProjectId()).getHttpConfig().getPort());
|
||||||
sampler.setProtocol(config.getConfig().get(this.getProjectId()).getHttpConfig().getProtocol());
|
sampler.setProtocol(config.getConfig().get(this.getProjectId()).getHttpConfig().getProtocol());
|
||||||
sampler.setPath(this.getPath());
|
sampler.setPath(envPath);
|
||||||
}
|
}
|
||||||
String envPath = sampler.getPath();
|
String envPath = sampler.getPath();
|
||||||
if (CollectionUtils.isNotEmpty(this.getRest()) && this.isRest()) {
|
if (CollectionUtils.isNotEmpty(this.getRest()) && this.isRest()) {
|
||||||
|
@ -187,7 +189,7 @@ public class MsHTTPSamplerProxy extends MsTestElement {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
String url = this.getUrl();
|
String url = this.getUrl();
|
||||||
if (!url.startsWith("http://") && !url.startsWith("https://")) {
|
if (StringUtils.isNotEmpty(url) && !url.startsWith("http://") && !url.startsWith("https://")) {
|
||||||
url = "http://" + url;
|
url = "http://" + url;
|
||||||
}
|
}
|
||||||
if (StringUtils.isNotEmpty(this.getPort()) && this.getPort().startsWith("${")) {
|
if (StringUtils.isNotEmpty(this.getPort()) && this.getPort().startsWith("${")) {
|
||||||
|
|
|
@ -30,6 +30,7 @@ import io.metersphere.commons.utils.*;
|
||||||
import io.metersphere.controller.request.ScheduleRequest;
|
import io.metersphere.controller.request.ScheduleRequest;
|
||||||
import io.metersphere.i18n.Translator;
|
import io.metersphere.i18n.Translator;
|
||||||
import io.metersphere.job.sechedule.ApiScenarioTestJob;
|
import io.metersphere.job.sechedule.ApiScenarioTestJob;
|
||||||
|
import io.metersphere.job.sechedule.SwaggerUrlImportJob;
|
||||||
import io.metersphere.job.sechedule.TestPlanTestJob;
|
import io.metersphere.job.sechedule.TestPlanTestJob;
|
||||||
import io.metersphere.service.ScheduleService;
|
import io.metersphere.service.ScheduleService;
|
||||||
import io.metersphere.track.dto.TestPlanDTO;
|
import io.metersphere.track.dto.TestPlanDTO;
|
||||||
|
@ -231,6 +232,7 @@ public class ApiAutomationService {
|
||||||
scenario.setPrincipal(request.getPrincipal());
|
scenario.setPrincipal(request.getPrincipal());
|
||||||
scenario.setStepTotal(request.getStepTotal());
|
scenario.setStepTotal(request.getStepTotal());
|
||||||
scenario.setUpdateTime(System.currentTimeMillis());
|
scenario.setUpdateTime(System.currentTimeMillis());
|
||||||
|
scenario.setDescription(request.getDescription());
|
||||||
scenario.setScenarioDefinition(JSON.toJSONString(request.getScenarioDefinition()));
|
scenario.setScenarioDefinition(JSON.toJSONString(request.getScenarioDefinition()));
|
||||||
if (StringUtils.isNotEmpty(request.getStatus())) {
|
if (StringUtils.isNotEmpty(request.getStatus())) {
|
||||||
scenario.setStatus(request.getStatus());
|
scenario.setStatus(request.getStatus());
|
||||||
|
@ -816,7 +818,9 @@ public class ApiAutomationService {
|
||||||
if (StringUtils.equals(request.getGroup(), ScheduleGroup.TEST_PLAN_TEST.name())) {
|
if (StringUtils.equals(request.getGroup(), ScheduleGroup.TEST_PLAN_TEST.name())) {
|
||||||
scheduleService.addOrUpdateCronJob(
|
scheduleService.addOrUpdateCronJob(
|
||||||
request, TestPlanTestJob.getJobKey(request.getResourceId()), TestPlanTestJob.getTriggerKey(request.getResourceId()), TestPlanTestJob.class);
|
request, TestPlanTestJob.getJobKey(request.getResourceId()), TestPlanTestJob.getTriggerKey(request.getResourceId()), TestPlanTestJob.class);
|
||||||
} else {
|
}else if(StringUtils.equals(request.getGroup(), ScheduleGroup.SWAGGER_IMPORT.name())){
|
||||||
|
scheduleService.addOrUpdateCronJob(request, SwaggerUrlImportJob.getJobKey(request.getResourceId()), SwaggerUrlImportJob.getTriggerKey(request.getResourceId()), SwaggerUrlImportJob.class);
|
||||||
|
} else{
|
||||||
scheduleService.addOrUpdateCronJob(
|
scheduleService.addOrUpdateCronJob(
|
||||||
request, ApiScenarioTestJob.getJobKey(request.getResourceId()), ApiScenarioTestJob.getTriggerKey(request.getResourceId()), ApiScenarioTestJob.class);
|
request, ApiScenarioTestJob.getJobKey(request.getResourceId()), ApiScenarioTestJob.getTriggerKey(request.getResourceId()), ApiScenarioTestJob.class);
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,6 +67,16 @@ public class TestCaseDataListener extends EasyExcelListener<TestCaseExcelData> {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//增加字数校验,每一层不能超过100字
|
||||||
|
for (int i = 0; i < nodes.length; i++) {
|
||||||
|
String nodeStr = nodes[i];
|
||||||
|
if(StringUtils.isNotEmpty(nodeStr)){
|
||||||
|
if(nodeStr.trim().length()>100){
|
||||||
|
stringBuilder.append(Translator.get("module") + Translator.get("test_track.length_less_than") + "100:"+nodeStr);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (StringUtils.equals(data.getType(), TestCaseConstants.Type.Functional.getValue()) && StringUtils.equals(data.getMethod(), TestCaseConstants.Method.Auto.getValue())) {
|
// if (StringUtils.equals(data.getType(), TestCaseConstants.Type.Functional.getValue()) && StringUtils.equals(data.getMethod(), TestCaseConstants.Method.Auto.getValue())) {
|
||||||
|
|
|
@ -91,8 +91,8 @@ public class TestPlanController {
|
||||||
|
|
||||||
@PostMapping("/edit")
|
@PostMapping("/edit")
|
||||||
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
|
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
|
||||||
public void editTestPlan(@RequestBody TestPlanDTO testPlanDTO) {
|
public String editTestPlan(@RequestBody TestPlanDTO testPlanDTO) {
|
||||||
testPlanService.editTestPlan(testPlanDTO, true);
|
return testPlanService.editTestPlan(testPlanDTO, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/edit/status/{planId}")
|
@PostMapping("/edit/status/{planId}")
|
||||||
|
|
|
@ -176,7 +176,7 @@ public class TestPlanService {
|
||||||
return Optional.ofNullable(testPlanMapper.selectByPrimaryKey(testPlanId)).orElse(new TestPlan());
|
return Optional.ofNullable(testPlanMapper.selectByPrimaryKey(testPlanId)).orElse(new TestPlan());
|
||||||
}
|
}
|
||||||
|
|
||||||
public int editTestPlan(TestPlanDTO testPlan, Boolean isSendMessage) {
|
public String editTestPlan(TestPlanDTO testPlan, Boolean isSendMessage) {
|
||||||
checkTestPlanExist(testPlan);
|
checkTestPlanExist(testPlan);
|
||||||
TestPlan res = testPlanMapper.selectByPrimaryKey(testPlan.getId()); // 先查一次库
|
TestPlan res = testPlanMapper.selectByPrimaryKey(testPlan.getId()); // 先查一次库
|
||||||
testPlan.setUpdateTime(System.currentTimeMillis());
|
testPlan.setUpdateTime(System.currentTimeMillis());
|
||||||
|
@ -230,7 +230,7 @@ public class TestPlanService {
|
||||||
.build();
|
.build();
|
||||||
noticeSendService.send(NoticeConstants.TaskType.TEST_PLAN_TASK, noticeModel);
|
noticeSendService.send(NoticeConstants.TaskType.TEST_PLAN_TASK, noticeModel);
|
||||||
}
|
}
|
||||||
return i;
|
return testPlan.getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
//计划内容
|
//计划内容
|
||||||
|
|
|
@ -392,8 +392,8 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
runTest(data) {
|
runTest(data) {
|
||||||
this.setTabTitle(data);
|
|
||||||
this.handleTabsEdit(this.$t("commons.api"), "TEST", data);
|
this.handleTabsEdit(this.$t("commons.api"), "TEST", data);
|
||||||
|
this.setTabTitle(data);
|
||||||
},
|
},
|
||||||
saveApi(data) {
|
saveApi(data) {
|
||||||
this.setTabTitle(data);
|
this.setTabTitle(data);
|
||||||
|
|
|
@ -58,22 +58,26 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
run() {
|
run() {
|
||||||
let testPlan = new TestPlan();
|
let projectId = this.$store.state.projectId;
|
||||||
let threadGroup = new ThreadGroup();
|
|
||||||
threadGroup.hashTree = [];
|
|
||||||
testPlan.hashTree = [threadGroup];
|
|
||||||
this.runData.forEach(item => {
|
|
||||||
threadGroup.hashTree.push(item);
|
|
||||||
})
|
|
||||||
|
|
||||||
let projectId = "";
|
|
||||||
// 如果envMap不存在,是单接口调用
|
// 如果envMap不存在,是单接口调用
|
||||||
if (!this.envMap || this.envMap.size === 0) {
|
if (!this.envMap || this.envMap.size === 0) {
|
||||||
projectId = this.$store.state.projectId;
|
projectId = this.$store.state.projectId;
|
||||||
} else {
|
} else {
|
||||||
// 场景步骤下接口调用
|
// 场景步骤下接口调用
|
||||||
projectId = this.runData.projectId;
|
if(this.runData.projectId){
|
||||||
|
projectId = this.runData.projectId;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let testPlan = new TestPlan();
|
||||||
|
let threadGroup = new ThreadGroup();
|
||||||
|
threadGroup.hashTree = [];
|
||||||
|
testPlan.hashTree = [threadGroup];
|
||||||
|
this.runData.forEach(item => {
|
||||||
|
item.projectId = projectId;
|
||||||
|
threadGroup.hashTree.push(item);
|
||||||
|
})
|
||||||
|
|
||||||
let reqObj = {id: this.reportId, testElement: testPlan, type: this.type,projectId: projectId, environmentMap: strMapToObj(this.envMap)};
|
let reqObj = {id: this.reportId, testElement: testPlan, type: this.type,projectId: projectId, environmentMap: strMapToObj(this.envMap)};
|
||||||
let bodyFiles = getBodyUploadFiles(reqObj, this.runData);
|
let bodyFiles = getBodyUploadFiles(reqObj, this.runData);
|
||||||
let url = "";
|
let url = "";
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
<i class="icon el-icon-arrow-right" :class="{'is-active': apiCase.active}" @click="active(apiCase)"/>
|
<i class="icon el-icon-arrow-right" :class="{'is-active': apiCase.active}" @click="active(apiCase)"/>
|
||||||
<el-input v-if="!apiCase.id || isShowInput" size="small" v-model="apiCase.name" :name="index" :key="index"
|
<el-input v-if="!apiCase.id || isShowInput" size="small" v-model="apiCase.name" :name="index" :key="index"
|
||||||
class="ms-api-header-select" style="width: 180px"
|
class="ms-api-header-select" style="width: 180px"
|
||||||
@blur="saveTestCase(apiCase)" :placeholder="$t('commons.input_name')" ref="nameEdit"/>
|
@blur="saveTestCase(apiCase,true)" :placeholder="$t('commons.input_name')" ref="nameEdit"/>
|
||||||
<span v-else>
|
<span v-else>
|
||||||
{{ apiCase.id ? apiCase.name : '' }}
|
{{ apiCase.id ? apiCase.name : '' }}
|
||||||
<i class="el-icon-edit" style="cursor:pointer" @click="showInput(apiCase)" v-tester/>
|
<i class="el-icon-edit" style="cursor:pointer" @click="showInput(apiCase)" v-tester/>
|
||||||
|
@ -48,7 +48,7 @@
|
||||||
|
|
||||||
<el-col :span="4">
|
<el-col :span="4">
|
||||||
<div class="tag-item" @click.stop>
|
<div class="tag-item" @click.stop>
|
||||||
<ms-input-tag :currentScenario="apiCase" ref="tag" @keyup.enter.native="saveTestCase(apiCase)"/>
|
<ms-input-tag :currentScenario="apiCase" ref="tag" @keyup.enter.native="saveTestCase(apiCase,true)"/>
|
||||||
</div>
|
</div>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
|
||||||
|
@ -291,7 +291,7 @@
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
saveCase(row) {
|
saveCase(row,hideAlert) {
|
||||||
let tmp = JSON.parse(JSON.stringify(row));
|
let tmp = JSON.parse(JSON.stringify(row));
|
||||||
this.isShowInput = false;
|
this.isShowInput = false;
|
||||||
if (this.validate(tmp)) {
|
if (this.validate(tmp)) {
|
||||||
|
@ -328,16 +328,18 @@
|
||||||
row.createTime = data.createTime;
|
row.createTime = data.createTime;
|
||||||
row.updateTime = data.updateTime;
|
row.updateTime = data.updateTime;
|
||||||
if (!row.message) {
|
if (!row.message) {
|
||||||
this.$success(this.$t('commons.save_success'));
|
if(!hideAlert){
|
||||||
this.$emit('refresh');
|
this.$success(this.$t('commons.save_success'));
|
||||||
|
this.$emit('refresh');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
saveTestCase(row) {
|
saveTestCase(row,hideAlert) {
|
||||||
if (this.api.saved) {
|
if (this.api.saved) {
|
||||||
this.addModule(row);
|
this.addModule(row);
|
||||||
} else {
|
} else {
|
||||||
this.saveCase(row);
|
this.saveCase(row,hideAlert);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
showInput(row) {
|
showInput(row) {
|
||||||
|
|
|
@ -306,6 +306,8 @@
|
||||||
this.$warning(this.$t('api_test.environment.select_environment'));
|
this.$warning(this.$t('api_test.environment.select_environment'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
this.envMap = new Map();
|
||||||
|
this.envMap.set(this.$store.state.projectId,this.environment);
|
||||||
this.runData = [];
|
this.runData = [];
|
||||||
this.batchLoadingIds = [];
|
this.batchLoadingIds = [];
|
||||||
this.selectdCases = [];
|
this.selectdCases = [];
|
||||||
|
|
|
@ -248,6 +248,7 @@ import {Api_List} from "@/business/components/common/model/JsonData";
|
||||||
import HeaderCustom from "@/business/components/common/head/HeaderCustom";
|
import HeaderCustom from "@/business/components/common/head/HeaderCustom";
|
||||||
import HeaderLabelOperate from "@/business/components/common/head/HeaderLabelOperate";
|
import HeaderLabelOperate from "@/business/components/common/head/HeaderLabelOperate";
|
||||||
import {Body} from "@/business/components/api/definition/model/ApiTestModel";
|
import {Body} from "@/business/components/api/definition/model/ApiTestModel";
|
||||||
|
import {buildNodePath} from "@/business/components/api/definition/model/NodeTree";
|
||||||
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
@ -768,13 +769,21 @@ export default {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
buildApiPath(apis) {
|
buildApiPath(apis) {
|
||||||
apis.forEach((api) => {
|
try {
|
||||||
|
let options = [];
|
||||||
this.moduleOptions.forEach(item => {
|
this.moduleOptions.forEach(item => {
|
||||||
if (api.moduleId === item.id) {
|
buildNodePath(item, {path: ''}, options);
|
||||||
api.modulePath = item.path;
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
});
|
apis.forEach((api) => {
|
||||||
|
options.forEach((item) => {
|
||||||
|
if (api.moduleId === item.id) {
|
||||||
|
api.modulePath = item.path;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
console.log(e);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
sort(column) {
|
sort(column) {
|
||||||
// 每次只对一个字段排序
|
// 每次只对一个字段排序
|
||||||
|
|
|
@ -133,16 +133,11 @@
|
||||||
this.data.forEach(node => {
|
this.data.forEach(node => {
|
||||||
buildTree(node, {path: ''});
|
buildTree(node, {path: ''});
|
||||||
});
|
});
|
||||||
|
this.$emit('setModuleOptions', this.data);
|
||||||
this.$emit('setNodeTree', this.data);
|
this.$emit('setNodeTree', this.data);
|
||||||
if (this.$refs.nodeTree) {
|
if (this.$refs.nodeTree) {
|
||||||
this.$refs.nodeTree.filter(this.condition.filterText);
|
this.$refs.nodeTree.filter(this.condition.filterText);
|
||||||
}
|
}
|
||||||
let moduleOptions = [];
|
|
||||||
this.data.forEach(node => {
|
|
||||||
buildNodePath(node, {path: ''}, moduleOptions);
|
|
||||||
});
|
|
||||||
this.moduleOptions = moduleOptions;
|
|
||||||
this.$emit('setModuleOptions', moduleOptions);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
@ -68,7 +68,7 @@
|
||||||
</el-aside>
|
</el-aside>
|
||||||
<el-main style="padding: 0px 0px 0px 0px; line-height: 40px; text-align: center;">
|
<el-main style="padding: 0px 0px 0px 0px; line-height: 40px; text-align: center;">
|
||||||
<span v-if="interfaceCoverage === 'waitting...'">
|
<span v-if="interfaceCoverage === 'waitting...'">
|
||||||
{{interfaceCoverage}}
|
<i class="el-icon-loading lading-icon"></i>
|
||||||
</span>
|
</span>
|
||||||
<span v-else class="rows-count-number">
|
<span v-else class="rows-count-number">
|
||||||
{{interfaceCoverage}}
|
{{interfaceCoverage}}
|
||||||
|
@ -161,7 +161,11 @@ export default {
|
||||||
color: var(--count_number);
|
color: var(--count_number);
|
||||||
margin:20px auto;
|
margin:20px auto;
|
||||||
}
|
}
|
||||||
|
.lading-icon{
|
||||||
|
font-size: 25px;
|
||||||
|
color: var(--count_number);
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
.main-number-show {
|
.main-number-show {
|
||||||
width: 100px;
|
width: 100px;
|
||||||
height: 100px;
|
height: 100px;
|
||||||
|
|
|
@ -379,14 +379,17 @@
|
||||||
|
|
||||||
.common-tree {
|
.common-tree {
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
height: 200px;
|
min-height: 200px;
|
||||||
|
max-height: 400px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ms-tree-select {
|
.ms-tree-select {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
z-index: 111;
|
z-index: 111;
|
||||||
}
|
}
|
||||||
|
/deep/.el-tree-node__children{
|
||||||
|
overflow: inherit;
|
||||||
|
}
|
||||||
.ok {
|
.ok {
|
||||||
float: right;
|
float: right;
|
||||||
}
|
}
|
||||||
|
|
|
@ -711,7 +711,7 @@ export default {
|
||||||
.border-hidden >>> .el-textarea__inner {
|
.border-hidden >>> .el-textarea__inner {
|
||||||
border-style: hidden;
|
border-style: hidden;
|
||||||
background-color: white;
|
background-color: white;
|
||||||
color: #606266;
|
color: #060505;
|
||||||
}
|
}
|
||||||
|
|
||||||
.cast_label {
|
.cast_label {
|
||||||
|
@ -785,4 +785,5 @@ p {
|
||||||
height: 550px;
|
height: 550px;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -549,4 +549,10 @@ export default {
|
||||||
.comment-card >>> .el-card__body {
|
.comment-card >>> .el-card__body {
|
||||||
height: calc(100vh - 120px);
|
height: calc(100vh - 120px);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.tb-edit >>> .el-textarea__inner {
|
||||||
|
border-style: hidden;
|
||||||
|
background-color: white;
|
||||||
|
color: #060505;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
Loading…
Reference in New Issue