From e7d489a469f38da562b5dbb4da04eb07add735db Mon Sep 17 00:00:00 2001 From: chenjianxing Date: Mon, 4 Jan 2021 19:15:16 +0800 Subject: [PATCH 01/12] =?UTF-8?q?fix:=20python=E8=84=9A=E6=9C=AC=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E4=BD=BF=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/api/automation/scenario/Jsr233Processor.vue | 6 +++--- .../post-processors/jsr223-post-processor/index.js | 2 +- .../components/pre-processors/jsr223-pre-processor/index.js | 2 +- .../api/definition/components/processor/Jsr233Processor.vue | 6 +++--- .../components/api/definition/model/ApiTestModel.js | 3 +-- 5 files changed, 9 insertions(+), 10 deletions(-) diff --git a/frontend/src/business/components/api/automation/scenario/Jsr233Processor.vue b/frontend/src/business/components/api/automation/scenario/Jsr233Processor.vue index 2bd2ca58a6..4f29002650 100644 --- a/frontend/src/business/components/api/automation/scenario/Jsr233Processor.vue +++ b/frontend/src/business/components/api/automation/scenario/Jsr233Processor.vue @@ -35,7 +35,7 @@ ref="codeEdit"/> - +
{{$t('api_test.request.processor.code_template')}}
{{template.title}} @@ -135,7 +135,7 @@ this.jsr223ProcessorData.script = ""; } this.jsr223ProcessorData.script += template.value; - if (this.jsr223ProcessorData.language === 'beanshell') { + if (this.jsr223ProcessorData.scriptLanguage === 'beanshell') { this.jsr223ProcessorData.script += ';'; } this.reload(); @@ -151,7 +151,7 @@ this.$nextTick(() => (this.isCodeEditAlive = true)); }, languageChange(language) { - this.jsr223ProcessorData.language = language; + this.jsr223ProcessorData.scriptLanguage = language; }, changeActive() { this.jsr223ProcessorData.active = !this.jsr223ProcessorData.active; diff --git a/frontend/src/business/components/api/definition/components/jmeter/components/post-processors/jsr223-post-processor/index.js b/frontend/src/business/components/api/definition/components/jmeter/components/post-processors/jsr223-post-processor/index.js index 4513b66d0a..501c9e0592 100644 --- a/frontend/src/business/components/api/definition/components/jmeter/components/post-processors/jsr223-post-processor/index.js +++ b/frontend/src/business/components/api/definition/components/jmeter/components/post-processors/jsr223-post-processor/index.js @@ -15,7 +15,7 @@ export default class JSR223PostProcessor extends PostProcessor { constructor(options = DEFAULT_OPTIONS) { super(options); this.type = "JSR223PostProcessor"; - this.scriptLanguage = "java"; + this.scriptLanguage = "beanshell"; this.parameters = []; this.filename = undefined; this.cacheKey = true; diff --git a/frontend/src/business/components/api/definition/components/jmeter/components/pre-processors/jsr223-pre-processor/index.js b/frontend/src/business/components/api/definition/components/jmeter/components/pre-processors/jsr223-pre-processor/index.js index 7ea5082497..ef93344bb2 100644 --- a/frontend/src/business/components/api/definition/components/jmeter/components/pre-processors/jsr223-pre-processor/index.js +++ b/frontend/src/business/components/api/definition/components/jmeter/components/pre-processors/jsr223-pre-processor/index.js @@ -15,7 +15,7 @@ export default class JSR223PreProcessor extends PostProcessor { constructor(options = DEFAULT_OPTIONS) { super(options); this.type = "JSR223PreProcessor"; - this.scriptLanguage = "java"; + this.scriptLanguage = "beanshell"; this.parameters = []; this.filename = undefined; this.cacheKey = undefined; diff --git a/frontend/src/business/components/api/definition/components/processor/Jsr233Processor.vue b/frontend/src/business/components/api/definition/components/processor/Jsr233Processor.vue index e4abb8533c..ebd7b5aa18 100644 --- a/frontend/src/business/components/api/definition/components/processor/Jsr233Processor.vue +++ b/frontend/src/business/components/api/definition/components/processor/Jsr233Processor.vue @@ -34,7 +34,7 @@ ref="codeEdit"/> - +
{{$t('api_test.request.processor.code_template')}}
{{template.title}} @@ -140,7 +140,7 @@ this.jsr223ProcessorData.script = ""; } this.jsr223ProcessorData.script += template.value; - if (this.jsr223ProcessorData.language === 'beanshell') { + if (this.jsr223ProcessorData.scriptLanguage === 'beanshell') { this.jsr223ProcessorData.script += ';'; } this.reload(); @@ -156,7 +156,7 @@ this.$nextTick(() => (this.isCodeEditAlive = true)); }, languageChange(language) { - this.jsr223ProcessorData.language = language; + this.jsr223ProcessorData.scriptLanguage = language; }, changeActive() { this.active = !this.active; diff --git a/frontend/src/business/components/api/definition/model/ApiTestModel.js b/frontend/src/business/components/api/definition/model/ApiTestModel.js index 4e8d5ff8fb..1be3b0c169 100644 --- a/frontend/src/business/components/api/definition/model/ApiTestModel.js +++ b/frontend/src/business/components/api/definition/model/ApiTestModel.js @@ -842,8 +842,7 @@ export class JSR223Processor extends BaseConfig { this.active = false; this.type = "JSR223Processor"; this.script = undefined; - this.language = "beanshell"; - this.scriptLanguage = "java"; + this.scriptLanguage = "beanshell"; this.enable = true; this.hashTree = []; this.set(options); From 24e89b5b3cd864fbc678501db8123106e1626cb9 Mon Sep 17 00:00:00 2001 From: chenjianxing Date: Mon, 4 Jan 2021 19:46:48 +0800 Subject: [PATCH 02/12] =?UTF-8?q?refactor:=20=E6=B5=8B=E8=AF=95=E8=AE=A1?= =?UTF-8?q?=E5=88=92=E5=85=B3=E8=81=94=E9=A1=B5=E9=9D=A2=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/definition/components/module/ApiModuleHeader.vue | 2 +- .../track/plan/view/comonents/base/RelevanceDialog.vue | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/frontend/src/business/components/api/definition/components/module/ApiModuleHeader.vue b/frontend/src/business/components/api/definition/components/module/ApiModuleHeader.vue index 510f7cad75..b6c49762be 100644 --- a/frontend/src/business/components/api/definition/components/module/ApiModuleHeader.vue +++ b/frontend/src/business/components/api/definition/components/module/ApiModuleHeader.vue @@ -122,7 +122,7 @@ export default { From 1e6b252d122f09647e3061a185c1bad06cd2b5b1 Mon Sep 17 00:00:00 2001 From: fit2-zhao Date: Tue, 5 Jan 2021 14:23:13 +0800 Subject: [PATCH 06/12] =?UTF-8?q?feat(=E6=8E=A5=E5=8F=A3=E5=AE=9A=E4=B9=89?= =?UTF-8?q?):=20=E5=A2=9E=E5=8A=A0=E6=89=B9=E9=87=8F=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E7=94=A8=E4=BE=8B=E4=BF=A1=E6=81=AF=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/definition/ApiTestBatchRequest.java | 16 +--- .../api/service/ApiTestCaseService.java | 33 ++++++-- .../definition/components/basis/BatchEdit.vue | 5 +- .../components/list/ApiCaseSimpleList.vue | 76 +++++++++---------- 4 files changed, 74 insertions(+), 56 deletions(-) diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/ApiTestBatchRequest.java b/backend/src/main/java/io/metersphere/api/dto/definition/ApiTestBatchRequest.java index fae3495019..ab2788aae6 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/ApiTestBatchRequest.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/ApiTestBatchRequest.java @@ -1,13 +1,10 @@ package io.metersphere.api.dto.definition; -import io.metersphere.base.domain.ApiDefinitionWithBLOBs; import io.metersphere.base.domain.ApiTestCaseWithBLOBs; import io.metersphere.controller.request.OrderRequest; import lombok.Getter; import lombok.Setter; -import java.util.ArrayList; -import java.util.HashMap; import java.util.List; import java.util.Map; @@ -32,6 +29,10 @@ public class ApiTestBatchRequest extends ApiTestCaseWithBLOBs { private String name; + private String method; + + private String path; + private List moduleIds; private List unSelectIds; @@ -39,13 +40,4 @@ public class ApiTestBatchRequest extends ApiTestCaseWithBLOBs { private String protocol; private String status; - - public void cleanSelectParam() { - filters = new HashMap<>(); - name = null; - moduleIds = new ArrayList<>(); - protocol = null; - status = null; - } - } diff --git a/backend/src/main/java/io/metersphere/api/service/ApiTestCaseService.java b/backend/src/main/java/io/metersphere/api/service/ApiTestCaseService.java index 03f5b37b56..02b350949f 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiTestCaseService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiTestCaseService.java @@ -1,5 +1,6 @@ package io.metersphere.api.service; +import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.DeserializationFeature; @@ -11,6 +12,8 @@ import io.metersphere.api.dto.definition.request.MsTestElement; import io.metersphere.api.dto.definition.request.MsTestPlan; import io.metersphere.api.dto.definition.request.MsThreadGroup; import io.metersphere.api.dto.definition.request.ParameterConfig; +import io.metersphere.api.dto.definition.request.sampler.MsHTTPSamplerProxy; +import io.metersphere.api.dto.scenario.request.RequestType; import io.metersphere.api.jmeter.JMeterService; import io.metersphere.base.domain.*; import io.metersphere.base.mapper.ApiDefinitionMapper; @@ -373,13 +376,33 @@ public class ApiTestCaseService { if (request.isSelectAllDate()) { ids = this.getAllApiCaseIdsByFontedSelect(request.getFilters(), request.getModuleIds(), request.getName(), request.getProjectId(), request.getProtocol(), request.getUnSelectIds(), request.getStatus()); } - request.cleanSelectParam(); ApiTestCaseExample apiDefinitionExample = new ApiTestCaseExample(); apiDefinitionExample.createCriteria().andIdIn(ids); - ApiTestCaseWithBLOBs apiDefinitionWithBLOBs = new ApiTestCaseWithBLOBs(); - BeanUtils.copyBean(apiDefinitionWithBLOBs, request); - apiDefinitionWithBLOBs.setUpdateTime(System.currentTimeMillis()); - apiTestCaseMapper.updateByExampleSelective(apiDefinitionWithBLOBs, apiDefinitionExample); + if (StringUtils.isNotEmpty(request.getPriority())) { + ApiTestCaseWithBLOBs apiDefinitionWithBLOBs = new ApiTestCaseWithBLOBs(); + apiDefinitionWithBLOBs.setPriority(request.getPriority()); + apiDefinitionWithBLOBs.setUpdateTime(System.currentTimeMillis()); + apiTestCaseMapper.updateByExampleSelective(apiDefinitionWithBLOBs, apiDefinitionExample); + } + if ((StringUtils.isNotEmpty(request.getMethod()) || StringUtils.isNotEmpty(request.getPath())) && request.getProtocol().equals(RequestType.HTTP)) { + List bloBs = apiTestCaseMapper.selectByExampleWithBLOBs(apiDefinitionExample); + SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH); + ApiTestCaseMapper batchMapper = sqlSession.getMapper(ApiTestCaseMapper.class); + bloBs.forEach(apiTestCase -> { + MsHTTPSamplerProxy req = JSON.parseObject(apiTestCase.getRequest(), MsHTTPSamplerProxy.class); + if (StringUtils.isNotEmpty(request.getMethod())) { + req.setMethod(request.getMethod()); + } + if (StringUtils.isNotEmpty(request.getPath())) { + req.setPath(request.getPath()); + } + String requestStr = JSON.toJSONString(req); + apiTestCase.setRequest(requestStr); + batchMapper.updateByPrimaryKeySelective(apiTestCase); + }); + sqlSession.flushStatements(); + } + } private List getAllApiCaseIdsByFontedSelect(Map> filters, List moduleIds, String name, String projectId, String protocol, List unSelectIds, String status) { diff --git a/frontend/src/business/components/api/definition/components/basis/BatchEdit.vue b/frontend/src/business/components/api/definition/components/basis/BatchEdit.vue index 75f7d70de9..681313215b 100644 --- a/frontend/src/business/components/api/definition/components/basis/BatchEdit.vue +++ b/frontend/src/business/components/api/definition/components/basis/BatchEdit.vue @@ -14,7 +14,10 @@ - + + + +
diff --git a/frontend/src/business/components/api/definition/components/list/ApiCaseSimpleList.vue b/frontend/src/business/components/api/definition/components/list/ApiCaseSimpleList.vue index dad5520ea2..125cce4b77 100644 --- a/frontend/src/business/components/api/definition/components/list/ApiCaseSimpleList.vue +++ b/frontend/src/business/components/api/definition/components/list/ApiCaseSimpleList.vue @@ -101,14 +101,12 @@ import MsBottomContainer from "../BottomContainer"; import ShowMoreBtn from "../../../../track/case/components/ShowMoreBtn"; import MsBatchEdit from "../basis/BatchEdit"; - import {API_METHOD_COLOUR, CASE_PRIORITY} from "../../model/JsonData"; + import {API_METHOD_COLOUR, CASE_PRIORITY, REQ_METHOD} from "../../model/JsonData"; import {getCurrentProjectID} from "@/common/js/utils"; import ApiListContainer from "./ApiListContainer"; import PriorityTableItem from "../../../../track/common/tableItems/planview/PriorityTableItem"; import ApiCaseList from "../case/ApiCaseList"; import {_filter, _sort} from "../../../../../../common/js/utils"; - import TestPlanCaseListHeader from "../../../../track/plan/view/comonents/api/TestPlanCaseListHeader"; - import MsEnvironmentSelect from "../case/MsEnvironmentSelect"; import {_handleSelect, _handleSelectAll} from "../../../../../../common/js/tableUtils"; export default { @@ -141,6 +139,8 @@ ], typeArr: [ {id: 'priority', name: this.$t('test_track.case.priority')}, + {id: 'method', name: this.$t('api_test.definition.api_type')}, + {id: 'path', name: this.$t('api_test.request.path')}, ], priorityFilters: [ {text: 'P0', value: 'P0'}, @@ -150,6 +150,7 @@ ], valueArr: { priority: CASE_PRIORITY, + method: REQ_METHOD, }, methodColorMap: new Map(API_METHOD_COLOUR), tableData: [], @@ -159,8 +160,8 @@ screenHeight: document.documentElement.clientHeight - 330,//屏幕高度 environmentId: undefined, selectAll: false, - unSelection:[], - selectDataCounts:0, + unSelection: [], + selectDataCounts: 0, } }, props: { @@ -233,7 +234,7 @@ this.condition.status = "Trash"; this.condition.moduleIds = []; } - this.selectAll = false; + this.selectAll = false; this.unSelection = []; this.selectDataCounts = 0; this.condition.projectId = getCurrentProjectID(); @@ -245,7 +246,7 @@ this.result = this.$post('/api/testcase/list/' + this.currentPage + "/" + this.pageSize, this.condition, response => { this.total = response.data.itemCount; this.tableData = response.data.listObject; - this.unSelection = response.data.listObject.map(s=>s.id); + this.unSelection = response.data.listObject.map(s => s.id); }); } }, @@ -312,24 +313,24 @@ }, handleDeleteBatch() { // if (this.trashEnable) { - this.$alert(this.$t('api_test.definition.request.delete_confirm') + "?", '', { - confirmButtonText: this.$t('commons.confirm'), - callback: (action) => { - if (action === 'confirm') { - let obj = {}; - obj.projectId = getCurrentProjectID(); - obj.selectAllDate = this.isSelectAllDate; - obj.unSelectIds = this.unSelection; - obj.ids = Array.from(this.selectRows).map(row => row.id); - obj = Object.assign(obj, this.condition); - this.$post('/api/testcase/deleteBatchByParam/', obj , () => { - this.selectRows.clear(); - this.initTable(); - this.$success(this.$t('commons.delete_success')); - }); - } + this.$alert(this.$t('api_test.definition.request.delete_confirm') + "?", '', { + confirmButtonText: this.$t('commons.confirm'), + callback: (action) => { + if (action === 'confirm') { + let obj = {}; + obj.projectId = getCurrentProjectID(); + obj.selectAllDate = this.isSelectAllDate; + obj.unSelectIds = this.unSelection; + obj.ids = Array.from(this.selectRows).map(row => row.id); + obj = Object.assign(obj, this.condition); + this.$post('/api/testcase/deleteBatchByParam/', obj, () => { + this.selectRows.clear(); + this.initTable(); + this.$success(this.$t('commons.delete_success')); + }); } - }); + } + }); // } else { // this.$alert(this.$t('api_test.definition.request.delete_confirm') + "?", '', { // confirmButtonText: this.$t('commons.confirm'), @@ -355,7 +356,6 @@ let param = {}; param[form.type] = form.value; param.ids = ids; - param.projectId = getCurrentProjectID(); param.selectAllDate = this.isSelectAllDate; param.unSelectIds = this.unSelection; @@ -367,11 +367,11 @@ }, handleDelete(apiCase) { // if (this.trashEnable) { - this.$get('/api/testcase/delete/' + apiCase.id, () => { - this.$success(this.$t('commons.delete_success')); - this.initTable(); - }); - return; + this.$get('/api/testcase/delete/' + apiCase.id, () => { + this.$success(this.$t('commons.delete_success')); + this.initTable(); + }); + return; // } // this.$alert(this.$t('api_test.definition.request.delete_confirm') + ' ' + apiCase.name + " ?", '', { // confirmButtonText: this.$t('commons.confirm'), @@ -389,16 +389,16 @@ setEnvironment(data) { this.environmentId = data.id; }, - selectRowsCount(selection){ + selectRowsCount(selection) { let selectedIDs = this.getIds(selection); - let allIDs = this.tableData.map(s=>s.id); + let allIDs = this.tableData.map(s => s.id); this.unSelection = allIDs.filter(function (val) { return selectedIDs.indexOf(val) === -1 }); - if(this.isSelectAllDate){ - this.selectDataCounts =this.total - this.unSelection.length; - }else { - this.selectDataCounts =selection.size; + if (this.isSelectAllDate) { + this.selectDataCounts = this.total - this.unSelection.length; + } else { + this.selectDataCounts = selection.size; } }, isSelectDataAll(dataType) { @@ -409,9 +409,9 @@ this.$refs.caseTable.toggleAllSelection(true); } }, - getIds(rowSets){ + getIds(rowSets) { let rowArray = Array.from(rowSets) - let ids = rowArray.map(s=>s.id); + let ids = rowArray.map(s => s.id); return ids; } }, From 25caf3c48eb0e893ef914f1e665f8ce1aeee9ddb Mon Sep 17 00:00:00 2001 From: fit2-zhao Date: Tue, 5 Jan 2021 14:43:02 +0800 Subject: [PATCH 07/12] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E5=AE=9A=E4=B9=89)?= =?UTF-8?q?:=20url=20=E8=A7=84=E8=8C=83=E9=97=AE=E9=A2=98=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/complete/EditCompleteHTTPApi.vue | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/frontend/src/business/components/api/definition/components/complete/EditCompleteHTTPApi.vue b/frontend/src/business/components/api/definition/components/complete/EditCompleteHTTPApi.vue index 1561e5484b..c2eb2dbeec 100644 --- a/frontend/src/business/components/api/definition/components/complete/EditCompleteHTTPApi.vue +++ b/frontend/src/business/components/api/definition/components/complete/EditCompleteHTTPApi.vue @@ -43,7 +43,8 @@
{{$t('api_test.definition.select_comp.no_data')}}, - {{$t('api_test.definition.select_comp.add_data')}} + + {{$t('api_test.definition.select_comp.add_data')}}
@@ -106,7 +107,6 @@ import {REQ_METHOD, API_STATUS} from "../../model/JsonData"; import MsJsr233Processor from "../processor/Jsr233Processor"; import {KeyValue} from "../../model/ApiTestModel"; - // import {append} from "./../../../../track/common/NodeTree"; export default { name: "MsAddCompleteHttpApi", @@ -172,7 +172,7 @@ } }) }, - createModules(){ + createModules() { this.$emit("createRootModelInTree"); }, getPath(id) { @@ -185,7 +185,7 @@ return path[0].path; }, urlChange() { - if (!this.httpForm.path) return; + if (!this.httpForm.path || this.httpForm.path.indexOf('?') === -1) return; let url = this.getURL(this.addProtocol(this.httpForm.path)); if (url) { this.httpForm.path = decodeURIComponent("/" + url.hostname + url.pathname); @@ -202,7 +202,6 @@ getURL(urlStr) { try { let url = new URL(urlStr); - console.log(urlStr) url.searchParams.forEach((value, key) => { if (key && value) { this.request.arguments.splice(0, 0, new KeyValue({name: key, required: false, value: value})); From 62a82dbf04b18e556e868132979125a094a254f1 Mon Sep 17 00:00:00 2001 From: ronghuaxiang Date: Tue, 5 Jan 2021 14:50:55 +0800 Subject: [PATCH 08/12] Update JMeterVars.java (#981) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 解决使用JSONPath的$..xx的语法匹配多个值时,提取出来的值不应该只有一个, 解决多值匹配时候变量无法传递问题 Co-authored-by: xiangronghua --- .../io/metersphere/api/jmeter/JMeterVars.java | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/backend/src/main/java/io/metersphere/api/jmeter/JMeterVars.java b/backend/src/main/java/io/metersphere/api/jmeter/JMeterVars.java index 84b1c089fd..5398e7e4cf 100644 --- a/backend/src/main/java/io/metersphere/api/jmeter/JMeterVars.java +++ b/backend/src/main/java/io/metersphere/api/jmeter/JMeterVars.java @@ -1,5 +1,6 @@ package io.metersphere.api.jmeter; +import com.alibaba.fastjson.JSON; import io.github.ningyu.jmeter.plugin.dubbo.sample.DubboSample; import org.apache.jmeter.extractor.JSR223PostProcessor; import org.apache.jmeter.extractor.RegexExtractor; @@ -30,12 +31,29 @@ public class JMeterVars { * @param vars * @param extract */ - public static void addVars(Integer testId, JMeterVariables vars, String extract) { + public static void addVars(Integer testId, JMeterVariables vars, String extract) { JMeterVariables vs = new JMeterVariables(); - if (!StringUtils.isEmpty(extract) && vars != null) { List extracts = Arrays.asList(extract.split(";")); Optional.ofNullable(extracts).orElse(new ArrayList<>()).forEach(item -> { + + String nrKey = item + "_matchNr"; + Object nr = vars.get(nrKey); + if (nr != null) { + int nrv = 0; + try { + nrv = Integer.valueOf(String.valueOf(nr)); + } catch (Exception e) { + } + if (nrv > 0) { + List data = new ArrayList<>(); + for (int i = 1; i < nrv + 1; i++) { + data.add(vars.get(item + "_" + i)); + } + String array = JSON.toJSONString(data); + vars.put(item, array); + } + } vs.put(item, vars.get(item) == null ? "" : vars.get(item)); }); vs.remove("TESTSTART.MS"); // 标示变量移除 From c39e71b626774b1201b0c3a16d792529dfd4bf9f Mon Sep 17 00:00:00 2001 From: chenjianxing Date: Tue, 5 Jan 2021 15:22:21 +0800 Subject: [PATCH 09/12] =?UTF-8?q?fix:=20=E5=85=B3=E8=81=94=E7=94=A8?= =?UTF-8?q?=E4=BE=8B=E5=B0=8F=E5=B1=8F=E9=80=82=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/automation/scenario/api/RelevanceApiList.vue | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/frontend/src/business/components/api/automation/scenario/api/RelevanceApiList.vue b/frontend/src/business/components/api/automation/scenario/api/RelevanceApiList.vue index 70a5b457a4..43c32c3250 100644 --- a/frontend/src/business/components/api/automation/scenario/api/RelevanceApiList.vue +++ b/frontend/src/business/components/api/automation/scenario/api/RelevanceApiList.vue @@ -3,9 +3,10 @@ :is-api-list-enable="isApiListEnable" @isApiListEnableChange="isApiListEnableChange"> - + + + - Date: Tue, 5 Jan 2021 15:33:47 +0800 Subject: [PATCH 10/12] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=8C=96):=20=E5=9C=BA=E6=99=AF=E6=89=B9=E9=87=8F=E6=89=A7?= =?UTF-8?q?=E8=A1=8C=EF=BC=8C=E6=97=A0=E6=AD=A5=E9=AA=A4=E7=9A=84=E5=9C=BA?= =?UTF-8?q?=E6=99=AF=E8=B7=B3=E8=BF=87=EF=BC=8C=E6=AD=A3=E5=B8=B8=E7=9A=84?= =?UTF-8?q?=E7=BB=A7=E7=BB=AD=E6=89=A7=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/service/ApiAutomationService.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java b/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java index 9465a3caea..de677f4a50 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java @@ -24,6 +24,7 @@ import io.metersphere.base.mapper.ext.ExtTestPlanScenarioCaseMapper; import io.metersphere.commons.constants.*; import io.metersphere.commons.exception.MSException; import io.metersphere.commons.utils.DateUtils; +import io.metersphere.commons.utils.LogUtil; import io.metersphere.commons.utils.ServiceUtils; import io.metersphere.commons.utils.SessionUtils; import io.metersphere.i18n.Translator; @@ -316,8 +317,12 @@ public class ApiAutomationService { boolean isFirst = true; for (ApiScenarioWithBLOBs item : apiScenarios) { if (item.getStepTotal() == 0) { - MSException.throwException(item.getName() + "," + Translator.get("automation_exec_info")); - break; + // 只有一个场景且没有测试步骤,则提示 + if (apiScenarios.size() == 1) { + MSException.throwException((item.getName() + "," + Translator.get("automation_exec_info"))); + } + LogUtil.warn(item.getName() + "," + Translator.get("automation_exec_info")); + continue; } MsThreadGroup group = new MsThreadGroup(); group.setLabel(item.getName()); @@ -335,14 +340,12 @@ public class ApiAutomationService { // 多态JSON普通转换会丢失内容,需要通过 ObjectMapper 获取 if (element != null && StringUtils.isNotEmpty(element.getString("hashTree"))) { LinkedList elements = mapper.readValue(element.getString("hashTree"), - new TypeReference>() { - }); + new TypeReference>() {}); scenario.setHashTree(elements); } if (StringUtils.isNotEmpty(element.getString("variables"))) { LinkedList variables = mapper.readValue(element.getString("variables"), - new TypeReference>() { - }); + new TypeReference>() {}); scenario.setVariables(variables); } group.setEnableCookieShare(scenario.isEnableCookieShare()); From 37acc581f205d340df51e2a6129b1e3776d19bea Mon Sep 17 00:00:00 2001 From: chenjianxing Date: Tue, 5 Jan 2021 15:40:02 +0800 Subject: [PATCH 11/12] =?UTF-8?q?refactor:=20=E5=85=A8=E9=80=89=E6=A1=86?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/api/definition/components/list/ApiList.vue | 1 + .../track/plan/view/comonents/base/RelevanceDialog.vue | 4 ++-- frontend/src/common/css/main.css | 8 ++++---- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/frontend/src/business/components/api/definition/components/list/ApiList.vue b/frontend/src/business/components/api/definition/components/list/ApiList.vue index a4fe6c3e9a..d7afbd7483 100644 --- a/frontend/src/business/components/api/definition/components/list/ApiList.vue +++ b/frontend/src/business/components/api/definition/components/list/ApiList.vue @@ -80,6 +80,7 @@ diff --git a/frontend/src/business/components/track/plan/view/comonents/base/RelevanceDialog.vue b/frontend/src/business/components/track/plan/view/comonents/base/RelevanceDialog.vue index 26c80bfb53..de83468865 100644 --- a/frontend/src/business/components/track/plan/view/comonents/base/RelevanceDialog.vue +++ b/frontend/src/business/components/track/plan/view/comonents/base/RelevanceDialog.vue @@ -59,11 +59,11 @@