fix(接口定义) 修复用例全选问题

--bug=1006483 --user=赵勇 【接口测试】case批量执行的时候只执行了第一页的case https://www.tapd.cn/55049933/s/1051212
This commit is contained in:
fit2-zhao 2021-09-24 15:26:22 +08:00 committed by fit2-zhao
parent 2bcfbd5a4d
commit a5605230c7
4 changed files with 13 additions and 6 deletions

View File

@ -1,5 +1,6 @@
package io.metersphere.api.dto; package io.metersphere.api.dto;
import io.metersphere.api.dto.definition.ApiTestCaseRequest;
import io.metersphere.base.domain.ApiTestCaseWithBLOBs; import io.metersphere.base.domain.ApiTestCaseWithBLOBs;
import io.metersphere.controller.request.BaseQueryRequest; import io.metersphere.controller.request.BaseQueryRequest;
import io.metersphere.controller.request.OrderRequest; import io.metersphere.controller.request.OrderRequest;
@ -15,5 +16,5 @@ public class ApiCaseBatchRequest extends ApiTestCaseWithBLOBs {
private List<OrderRequest> orders; private List<OrderRequest> orders;
private String projectId; private String projectId;
private String environmentId; private String environmentId;
private BaseQueryRequest condition; private ApiTestCaseRequest condition;
} }

View File

@ -701,7 +701,7 @@ public class ApiTestCaseService {
public void batchRun(ApiCaseBatchRequest request) { public void batchRun(ApiCaseBatchRequest request) {
ServiceUtils.getSelectAllIds(request, request.getCondition(), ServiceUtils.getSelectAllIds(request, request.getCondition(),
(query) -> extApiTestCaseMapper.selectIdsByQuery(query)); (query) -> extApiTestCaseMapper.selectIdsByQuery((ApiTestCaseRequest)query));
Map<String, ApiDefinitionExecResult> executeQueue = new HashMap<>(); Map<String, ApiDefinitionExecResult> executeQueue = new HashMap<>();
SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH); SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH);
ApiDefinitionExecResultMapper batchMapper = sqlSession.getMapper(ApiDefinitionExecResultMapper.class); ApiDefinitionExecResultMapper batchMapper = sqlSession.getMapper(ApiDefinitionExecResultMapper.class);

View File

@ -48,7 +48,7 @@ public interface ExtApiTestCaseMapper {
List<String> selectNameByIdIn(@Param("ids")List<String> ids); List<String> selectNameByIdIn(@Param("ids")List<String> ids);
String selectNameById(String id); String selectNameById(String id);
List<String> selectIdsByQuery(BaseQueryRequest query); List<String> selectIdsByQuery(@Param("request") ApiTestCaseRequest request);
List<String> selectProjectIds(); List<String> selectProjectIds();

View File

@ -508,9 +508,15 @@ export default {
this.$refs.batchRun.open(); this.$refs.batchRun.open();
}, },
runBatch(environment) { runBatch(environment) {
this.condition.environmentId = environment.id; let obj = {};
this.condition.ids = this.$refs.caseTable.selectIds; obj.projectId = this.projectId;
this.$post('/api/testcase/batch/run', this.condition, () => { obj.selectAllDate = this.selectAll;
obj.unSelectIds = this.unSelection;
obj.ids = Array.from(this.selectRows).map(row => row.id);
obj.environmentId = environment.id;
obj.condition = this.condition;
this.$post('/api/testcase/batch/run', obj, () => {
this.condition.ids = []; this.condition.ids = [];
this.$refs.batchRun.close(); this.$refs.batchRun.close();
this.search(); this.search();