Skip to content

Commit

Permalink
fix(测试计划): 批量执行历史
Browse files Browse the repository at this point in the history
--bug=1040923 --user=王旭 【测试计划】测试计划详情-功能用例列表-批量执行-批量执行成功后用例的步骤执行结果为空了 https://www.tapd.cn/55049933/s/1518912
  • Loading branch information
WangXu10 authored and liuruibin committed May 23, 2024
1 parent 288b1e1 commit fa0fdb1
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.metersphere.plan.mapper;

import io.metersphere.plan.domain.TestPlanCaseExecuteHistory;
import io.metersphere.plan.dto.request.TestPlanCaseExecHistoryRequest;
import io.metersphere.plan.dto.response.TestPlanCaseExecHistoryResponse;
import org.apache.ibatis.annotations.Param;
Expand All @@ -11,4 +12,6 @@ public interface ExtTestPlanCaseExecuteHistoryMapper {
void updateDeleted(@Param("testPlanCaseIds") List<String> testPlanCaseIds, @Param("deleted") boolean deleted);

List<TestPlanCaseExecHistoryResponse> getCaseExecHistory(@Param("request") TestPlanCaseExecHistoryRequest request);

List<TestPlanCaseExecuteHistory> selectSteps(@Param("testPlanCaseId") String testPlanCaseId, @Param("caseId") String caseId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,24 @@
tpceh.create_time DESC
</select>

<select id="selectSteps" resultType="io.metersphere.plan.domain.TestPlanCaseExecuteHistory">
SELECT
test_plan_case_execute_history.id,
test_plan_case_execute_history.test_plan_case_id as testPlanCaseId,
test_plan_case_execute_history.test_plan_id as testPlanId,
test_plan_case_execute_history.case_id as caseId,
test_plan_case_execute_history.steps
FROM
test_plan_case_execute_history
WHERE
test_plan_case_id = #{testPlanCaseId}
AND case_id = #{caseId}
AND DELETED = FALSE
AND steps IS NOT NULL
ORDER BY
create_time DESC
LIMIT 1
</select>


</mapper>
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@
import io.metersphere.functional.service.FunctionalCaseAttachmentService;
import io.metersphere.functional.service.FunctionalCaseModuleService;
import io.metersphere.functional.service.FunctionalCaseService;
import io.metersphere.plan.domain.*;
import io.metersphere.plan.domain.TestPlan;
import io.metersphere.plan.domain.TestPlanCaseExecuteHistory;
import io.metersphere.plan.domain.TestPlanFunctionalCase;
import io.metersphere.plan.domain.TestPlanFunctionalCaseExample;
import io.metersphere.plan.dto.AssociationNodeSortDTO;
import io.metersphere.plan.dto.ResourceLogInsertModule;
import io.metersphere.plan.dto.TestPlanCaseRunResultCount;
Expand Down Expand Up @@ -141,6 +144,7 @@ public Map<String, Long> caseExecResultCount(String testPlanId) {
List<TestPlanCaseRunResultCount> runResultCounts = extTestPlanFunctionalCaseMapper.selectCaseExecResultCount(testPlanId);
return runResultCounts.stream().collect(Collectors.toMap(TestPlanCaseRunResultCount::getResult, TestPlanCaseRunResultCount::getResultCount));
}

@Override
public void refreshPos(String testPlanId) {
List<String> functionalCaseIdList = extTestPlanFunctionalCaseMapper.selectIdByTestPlanIdOrderByPos(testPlanId);
Expand Down Expand Up @@ -550,10 +554,7 @@ public TestPlanCaseDetailResponse getFunctionalCaseDetail(String id, String user
String caseId = planFunctionalCase.getFunctionalCaseId();
FunctionalCaseDetailDTO functionalCaseDetail = functionalCaseService.getFunctionalCaseDetail(caseId, userId);
String caseDetailSteps = functionalCaseDetail.getSteps();
TestPlanCaseExecuteHistoryExample testPlanCaseExecuteHistoryExample = new TestPlanCaseExecuteHistoryExample();
testPlanCaseExecuteHistoryExample.createCriteria().andCaseIdEqualTo(caseId).andTestPlanCaseIdEqualTo(id);
testPlanCaseExecuteHistoryExample.setOrderByClause("create_time DESC");
List<TestPlanCaseExecuteHistory> testPlanCaseExecuteHistories = testPlanCaseExecuteHistoryMapper.selectByExampleWithBLOBs(testPlanCaseExecuteHistoryExample);
List<TestPlanCaseExecuteHistory> testPlanCaseExecuteHistories = extTestPlanCaseExecuteHistoryMapper.selectSteps(id, caseId);
Integer runListCount = 0;
List<FunctionalCaseStepDTO> functionalCaseStepDTOS = new ArrayList<>();
if (CollectionUtils.isNotEmpty(testPlanCaseExecuteHistories)) {
Expand Down

0 comments on commit fa0fdb1

Please sign in to comment.