fix(接口测试): 修复接口测试用例批量执行的缺陷

--bug=1046011 --user=宋天阳 [接口测试] github#32905接口测试-根据执行结果筛选 case 数据后,选择所有数据,会把所有case 都执行 https://www.tapd.cn/55049933/s/1576090
This commit is contained in:
Jianguo-Genius 2024-09-09 15:20:08 +08:00 committed by 建国
parent 9b3aaa7326
commit 73054347d3
3 changed files with 19 additions and 18 deletions

View File

@ -18,6 +18,7 @@ public class ApiCaseRunRequest {
private String id; private String id;
private List<String> ids; private List<String> ids;
private List<OrderRequest> orders; private List<OrderRequest> orders;
private String apiDefinitionId;
private String projectId; private String projectId;
private String environmentId; private String environmentId;
private RunModeConfigDTO config; private RunModeConfigDTO config;

View File

@ -2,9 +2,8 @@ package io.metersphere.api.parse;
import io.metersphere.api.dto.ApiTestImportRequest; import io.metersphere.api.dto.ApiTestImportRequest;
import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
public interface ApiImportParser<T> { public interface ApiImportParser<T> {
T parse(InputStream source, ApiTestImportRequest request) throws IOException, Exception; T parse(InputStream source, ApiTestImportRequest request) throws Exception;
} }

View File

@ -319,11 +319,11 @@ import {
testCaseReduction, testCaseReduction,
updateExecuteInfo, updateExecuteInfo,
} from '@/api/api-test-case'; } from '@/api/api-test-case';
import { getDefinitionById } from '@/api/definition'; import {getDefinitionById} from '@/api/definition';
import { getApiReportDetail } from '@/api/definition-report'; import {getApiReportDetail} from '@/api/definition-report';
import { genPerformanceTestXml } from '@/api/home'; import {genPerformanceTestXml} from '@/api/home';
import { getMaintainer } from '@/api/project'; import {getMaintainer} from '@/api/project';
import { getProjectVersions, synCaseBatch, versionEnableByProjectId } from '@/api/xpack'; import {getProjectVersions, synCaseBatch, versionEnableByProjectId} from '@/api/xpack';
import MsTable from 'metersphere-frontend/src/components/table/MsTable'; import MsTable from 'metersphere-frontend/src/components/table/MsTable';
import MsTableColumn from 'metersphere-frontend/src/components/table/MsTableColumn'; import MsTableColumn from 'metersphere-frontend/src/components/table/MsTableColumn';
import MsTableOperator from 'metersphere-frontend/src/components/MsTableOperator'; import MsTableOperator from 'metersphere-frontend/src/components/MsTableOperator';
@ -336,7 +336,7 @@ import MsContainer from 'metersphere-frontend/src/components/MsContainer';
import MsBottomContainer from '../BottomContainer'; import MsBottomContainer from '../BottomContainer';
import ShowMoreBtn from '@/business/commons/ShowMoreBtn'; import ShowMoreBtn from '@/business/commons/ShowMoreBtn';
import MsBatchEdit from '../basis/BatchEdit'; import MsBatchEdit from '../basis/BatchEdit';
import { getUUID } from 'metersphere-frontend/src/utils'; import {getUUID} from 'metersphere-frontend/src/utils';
import { import {
API_METHOD_COLOUR, API_METHOD_COLOUR,
CASE_PRIORITY, CASE_PRIORITY,
@ -345,19 +345,19 @@ import {
SQL_METHOD, SQL_METHOD,
TCP_METHOD, TCP_METHOD,
} from '../../model/JsonData'; } from '../../model/JsonData';
import { getCurrentProjectID } from 'metersphere-frontend/src/utils/token'; import {getCurrentProjectID} from 'metersphere-frontend/src/utils/token';
import { hasLicense } from 'metersphere-frontend/src/utils/permission'; import {hasLicense} from 'metersphere-frontend/src/utils/permission';
import { getBodyUploadFiles } from '@/business/definition/api-definition'; import {getBodyUploadFiles} from '@/business/definition/api-definition';
import PriorityTableItem from '@/business/commons/PriorityTableItem'; import PriorityTableItem from '@/business/commons/PriorityTableItem';
import MsApiCaseTableExtendBtns from '../reference/ApiCaseTableExtendBtns'; import MsApiCaseTableExtendBtns from '../reference/ApiCaseTableExtendBtns';
import MsShowReference from '../reference/ShowReference'; import MsShowReference from '../reference/ShowReference';
import MsSetEnvironment from '@/business/definition/components/basis/SetEnvironment'; import MsSetEnvironment from '@/business/definition/components/basis/SetEnvironment';
import TestPlan from '@/business/definition/components/jmeter/components/test-plan'; import TestPlan from '@/business/definition/components/jmeter/components/test-plan';
import ThreadGroup from '@/business/definition/components/jmeter/components/thread-group'; import ThreadGroup from '@/business/definition/components/jmeter/components/thread-group';
import { parseEnvironment } from '@/business/environment/model/EnvironmentModel'; import {parseEnvironment} from '@/business/environment/model/EnvironmentModel';
import MsTableHeaderSelectPopover from 'metersphere-frontend/src/components/table/MsTableHeaderSelectPopover'; import MsTableHeaderSelectPopover from 'metersphere-frontend/src/components/table/MsTableHeaderSelectPopover';
import MsTableAdvSearchBar from 'metersphere-frontend/src/components/search/MsTableAdvSearchBar'; import MsTableAdvSearchBar from 'metersphere-frontend/src/components/search/MsTableAdvSearchBar';
import { API_CASE_CONFIGS, API_CASE_CONFIGS_TRASH } from 'metersphere-frontend/src/components/search/search-components'; import {API_CASE_CONFIGS, API_CASE_CONFIGS_TRASH} from 'metersphere-frontend/src/components/search/search-components';
import { import {
_filter, _filter,
_sort, _sort,
@ -366,17 +366,17 @@ import {
getLastTableSortField, getLastTableSortField,
handleRowDrop, handleRowDrop,
} from 'metersphere-frontend/src/utils/tableUtils'; } from 'metersphere-frontend/src/utils/tableUtils';
import { API_CASE_LIST } from 'metersphere-frontend/src/utils/constants'; import {API_CASE_LIST} from 'metersphere-frontend/src/utils/constants';
import HeaderLabelOperate from 'metersphere-frontend/src/components/head/HeaderLabelOperate'; import HeaderLabelOperate from 'metersphere-frontend/src/components/head/HeaderLabelOperate';
import ApiCaseBatchRun from '@/business/definition/components/list/ApiCaseBatchRun'; import ApiCaseBatchRun from '@/business/definition/components/list/ApiCaseBatchRun';
import MsRequestResultTail from '@/business/definition/components/response/RequestResultTail'; import MsRequestResultTail from '@/business/definition/components/response/RequestResultTail';
import { TYPE_TO_C } from '@/business/automation/scenario/Setting'; import {TYPE_TO_C} from '@/business/automation/scenario/Setting';
import i18n from 'metersphere-frontend/src/i18n'; import i18n from 'metersphere-frontend/src/i18n';
import MsSearch from 'metersphere-frontend/src/components/search/MsSearch'; import MsSearch from 'metersphere-frontend/src/components/search/MsSearch';
import SyncSetting from '@/business/definition/util/SyncSetting'; import SyncSetting from '@/business/definition/util/SyncSetting';
import { getEnvironmentByProjectId } from 'metersphere-frontend/src/api/environment'; import {getEnvironmentByProjectId} from 'metersphere-frontend/src/api/environment';
import { useApiStore, usePerformanceStore } from '@/store'; import {useApiStore, usePerformanceStore} from '@/store';
import { REPORT_STATUS } from '@/business/commons/js/commons'; import {REPORT_STATUS} from '@/business/commons/js/commons';
import MsApiRunMode from '@/business/automation/scenario/common/ApiRunMode'; import MsApiRunMode from '@/business/automation/scenario/common/ApiRunMode';
import ApiDeleteConfirm from '@/business/definition/components/list/ApiDeleteConfirm'; import ApiDeleteConfirm from '@/business/definition/components/list/ApiDeleteConfirm';
@ -728,6 +728,7 @@ export default {
obj.unSelectIds = this.unSelection; obj.unSelectIds = this.unSelection;
obj.ids = Array.from(this.selectRows).map((row) => row.id); obj.ids = Array.from(this.selectRows).map((row) => row.id);
obj.config = config; obj.config = config;
obj.apiDefinitionId = this.apiDefinitionId;
obj.condition = this.condition; obj.condition = this.condition;
obj.condition.status = ''; obj.condition.status = '';
testCaseBatchRun(obj).then(() => { testCaseBatchRun(obj).then(() => {