From 24a49c9b5a8e1dd27ec51b559f9ebc3995068b51 Mon Sep 17 00:00:00 2001 From: wxg0103 <727495428@qq.com> Date: Wed, 26 Jul 2023 14:41:39 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=B9=B6=E8=A1=8C=E6=8E=A7=E5=88=B6=E5=99=A8?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1028021 --user=王孝刚 【接口测试】场景-生成报告-并行控制器下的多了断言步骤 https://www.tapd.cn/55049933/s/1397715 --- .../ApiScenarioReportStructureService.java | 3 +- .../automation/report/ApiReportDetail.vue | 43 ++++++++----------- .../report/components/ScenarioResult.vue | 3 +- .../report/components/ScenarioResults.vue | 8 ++-- .../scenario/variable/VariableList.vue | 7 ++- .../src/business/definition/api-definition.js | 4 +- 6 files changed, 36 insertions(+), 32 deletions(-) diff --git a/api-test/backend/src/main/java/io/metersphere/service/scenario/ApiScenarioReportStructureService.java b/api-test/backend/src/main/java/io/metersphere/service/scenario/ApiScenarioReportStructureService.java index 6dac9ca643..4708c38f69 100644 --- a/api-test/backend/src/main/java/io/metersphere/service/scenario/ApiScenarioReportStructureService.java +++ b/api-test/backend/src/main/java/io/metersphere/service/scenario/ApiScenarioReportStructureService.java @@ -663,7 +663,8 @@ public class ApiScenarioReportStructureService { allUnExecute.set(allUnExecute.longValue() + 1); } } - if (step.getValue() == null && StringUtils.equals(step.getType(), "GenericController") && StringUtils.equalsIgnoreCase(step.getTotalStatus(), ApiReportStatus.PENDING.name())) { + if (step.getValue() == null && StringUtils.containsAnyIgnoreCase(step.getType(), "GenericController", "IfController", "LoopController", "TransactionController") + && StringUtils.equalsIgnoreCase(step.getTotalStatus(), ApiReportStatus.PENDING.name())) { allUnExecute.set(allUnExecute.longValue() + 1); } if (CollectionUtils.isNotEmpty(step.getChildren())) { diff --git a/api-test/frontend/src/business/automation/report/ApiReportDetail.vue b/api-test/frontend/src/business/automation/report/ApiReportDetail.vue index 611df53b05..1a69f47223 100644 --- a/api-test/frontend/src/business/automation/report/ApiReportDetail.vue +++ b/api-test/frontend/src/business/automation/report/ApiReportDetail.vue @@ -17,11 +17,11 @@ :pool-name="poolName" :is-share="isShare" @reportExport="handleExport" - @reportSave="handleSave" /> + @reportSave="handleSave"/>
- + @@ -33,7 +33,7 @@ :is-share="isShare" :share-id="shareId" v-on:requestResult="requestResult" - ref="resultsTree" /> + ref="resultsTree"/> @@ -46,7 +46,7 @@ :share-id="shareId" :treeData="errorTreeNodes" ref="failsTree" - :errorReport="content.error" /> + :errorReport="content.error"/> @@ -60,7 +60,7 @@ :share-id="shareId" :console="content.console" :treeData="fakeErrorTreeNodes" - ref="errorReportTree" /> + ref="errorReportTree"/> @@ -74,7 +74,7 @@ :share-id="shareId" :console="content.console" :treeData="unExecuteTreeNodes" - ref="unExecuteTree" /> + ref="unExecuteTree"/> @@ -85,7 +85,7 @@ :mode="'text'" :read-only="true" :data.sync="content.console" - height="calc(100vh - 500px)" /> + height="calc(100vh - 500px)"/>
@@ -104,7 +104,7 @@ :mode="mode" :pool-name="poolName" :report="report" - :total-time="totalTime" /> + :total-time="totalTime"/> @@ -119,9 +119,9 @@ import MsMainContainer from 'metersphere-frontend/src/components/MsMainContainer import MsApiReportExport from './ApiReportExport'; import MsApiReportViewHeader from './ApiReportViewHeader'; import MsInfiniteScrollScenarioResults from '@/business/automation/report/components/InfiniteScrollScenarioResults.vue'; -import { RequestFactory } from '../../definition/model/ApiTestModel'; -import { getCurrentProjectID } from 'metersphere-frontend/src/utils/token'; -import { getUUID } from 'metersphere-frontend/src/utils'; +import {RequestFactory} from '../../definition/model/ApiTestModel'; +import {getCurrentProjectID} from 'metersphere-frontend/src/utils/token'; +import {getUUID} from 'metersphere-frontend/src/utils'; import { getScenarioReport, getScenarioReportDetail, @@ -129,7 +129,7 @@ import { getShareScenarioReport, reportReName, } from '../../../api/scenario-report'; -import { STEP } from '../../automation/scenario/Setting'; +import {STEP} from '../../automation/scenario/Setting'; import MsCodeEdit from 'metersphere-frontend/src/components/MsCodeEdit'; import print from 'print-js'; @@ -243,10 +243,7 @@ export default { }, filterNodes(node, status) { if (status === 'ERROR' || status === 'FAKE_ERROR' || status === 'UN_EXECUTE') { - let data = { ...node }; - /*if (!data.value && (!data.children || data.children.length === 0)) { - return null; - }*/ + let data = {...node}; if (data.children.length > 0) { let filteredChildren = []; for (let i = 0; i < data.children.length; i++) { @@ -268,10 +265,8 @@ export default { if (data.value && data.value.status === 'PENDING' && data.type !== 'IfController') { return data; } - if (data.type === 'IfController' && data.totalStatus === 'PENDING') { - return data; - } - if (data.type === 'GenericController' && data.totalStatus === 'PENDING') { + if ((data.type === 'IfController' || data.type === 'GenericController' || data.type === 'LoopController' || data.type === 'TransactionController') + && data.totalStatus === 'PENDING') { return data; } } else if (status === 'ERROR') { @@ -666,7 +661,7 @@ export default { if (this.isNotRunning) { this.content = JSON.parse(this.report.content); if (!this.content) { - this.content = { scenarios: [] }; + this.content = {scenarios: []}; } this.formatResult(this.content); this.getFails(); @@ -765,14 +760,14 @@ export default { // 多次点击导出报告, 场景步骤未清空#771; this.content.scenarios = []; if (this.report.reportType === 'API_INTEGRATED' || this.report.reportType === 'UI_INTEGRATED') { - let scenario = { name: '', requestResults: [] }; + let scenario = {name: '', requestResults: []}; this.content.scenarios = [scenario]; this.formatExportApi(this.fullTreeNodes, scenario); } else { if (this.fullTreeNodes) { this.fullTreeNodes.forEach((item) => { if (item.type === 'scenario') { - let scenario = { name: item.label, requestResults: [] }; + let scenario = {name: item.label, requestResults: []}; if (this.content.scenarios && this.content.scenarios.length > 0) { this.content.scenarios.push(scenario); } else { @@ -785,7 +780,7 @@ export default { } } if (this.content.scenarios && this.content.scenarios[0].requestResults) { - this.content.scenarios[0].requestResults.push({ responseResult: {} }); + this.content.scenarios[0].requestResults.push({responseResult: {}}); } this.reportExportVisible = true; let reset = this.exportReportReset; diff --git a/api-test/frontend/src/business/automation/report/components/ScenarioResult.vue b/api-test/frontend/src/business/automation/report/components/ScenarioResult.vue index 1dabbf530a..15e94d8199 100644 --- a/api-test/frontend/src/business/automation/report/components/ScenarioResult.vue +++ b/api-test/frontend/src/business/automation/report/components/ScenarioResult.vue @@ -28,8 +28,7 @@ v-if=" node.type !== 'ConstantTimer' && node.type !== 'Assertion' && - node.children && - node.children.length > 0 + node.children " /> diff --git a/api-test/frontend/src/business/automation/report/components/ScenarioResults.vue b/api-test/frontend/src/business/automation/report/components/ScenarioResults.vue index 7cb53d4ac8..51354ce192 100644 --- a/api-test/frontend/src/business/automation/report/components/ScenarioResults.vue +++ b/api-test/frontend/src/business/automation/report/components/ScenarioResults.vue @@ -73,9 +73,6 @@ export default { }, methods: { filterNode(value, data) { - if (!data.value && (!data.children || data.children.length === 0)) { - return false; - } if (!value) return true; if (data.value) { if (value === 'FAKE_ERROR') { @@ -90,6 +87,11 @@ export default { return data.totalStatus !== 'FAKE_ERROR' && data.value.error > 0; } } + if (!data.value) { + if (value === 'PENDING' && data.totalStatus === 'PENDING') { + return true; + } + } return false; }, filter(val) { diff --git a/api-test/frontend/src/business/automation/scenario/variable/VariableList.vue b/api-test/frontend/src/business/automation/scenario/variable/VariableList.vue index a7f251b60d..149152fe4e 100644 --- a/api-test/frontend/src/business/automation/scenario/variable/VariableList.vue +++ b/api-test/frontend/src/business/automation/scenario/variable/VariableList.vue @@ -518,6 +518,7 @@ export default { }, close() { let saveVariables = []; + let isContinue = true; this.variables.forEach((item) => { item.hidden = undefined; if (item.name && item.name != '') { @@ -526,10 +527,14 @@ export default { } if (item.type === 'CSV' && item.files.length === 0) { this.$warning(this.$t('api_test.variable') + item.name + ' ' + this.$t('api_test.automation.csv_warning')); - this.visible = true; + isContinue = false; return; } }); + if (!isContinue) { + this.visible = true; + return; + } this.selectVariable = ''; this.searchType = ''; this.selectType = 'CONSTANT'; diff --git a/api-test/frontend/src/business/definition/api-definition.js b/api-test/frontend/src/business/definition/api-definition.js index 5b643cf3a3..f2886c5ff3 100644 --- a/api-test/frontend/src/business/definition/api-definition.js +++ b/api-test/frontend/src/business/definition/api-definition.js @@ -194,7 +194,9 @@ export function hisDataProcessing(array, request) { const rmIndex = request.hashTree.findIndex((d) => d.id === item.id && d.resourceId === item.resourceId); request.hashTree.splice(rmIndex, 1); }); - + if (request.type && request.type === 'GenericController') { + return; + } request.hashTree.push(assertions); }