diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/dto/TestPlanCaseExecuteHistoryDTO.java b/backend/services/case-management/src/main/java/io/metersphere/functional/dto/TestPlanCaseExecuteHistoryDTO.java
index d05796e4e1..1b0a481536 100644
--- a/backend/services/case-management/src/main/java/io/metersphere/functional/dto/TestPlanCaseExecuteHistoryDTO.java
+++ b/backend/services/case-management/src/main/java/io/metersphere/functional/dto/TestPlanCaseExecuteHistoryDTO.java
@@ -31,4 +31,7 @@ public class TestPlanCaseExecuteHistoryDTO extends TestPlanCaseExecuteHistory {
@Schema(description = "编辑模式")
private String caseEditType;
+ @Schema(description = "是否显示步骤信息")
+ private boolean showResult = false;
+
}
diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/mapper/ExtFunctionalCaseMapper.xml b/backend/services/case-management/src/main/java/io/metersphere/functional/mapper/ExtFunctionalCaseMapper.xml
index 7580935cc9..1ca905efae 100644
--- a/backend/services/case-management/src/main/java/io/metersphere/functional/mapper/ExtFunctionalCaseMapper.xml
+++ b/backend/services/case-management/src/main/java/io/metersphere/functional/mapper/ExtFunctionalCaseMapper.xml
@@ -804,7 +804,7 @@
fc.project_Id = #{request.projectId}
AND
fc.module_id = #{request.moduleId}
- order by fc.pos
+ order by fc.pos desc
diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalTestCaseService.java b/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalTestCaseService.java
index f7649136cc..2e17c97dce 100644
--- a/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalTestCaseService.java
+++ b/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalTestCaseService.java
@@ -7,6 +7,7 @@ import io.metersphere.dto.TestCaseProviderDTO;
import io.metersphere.functional.constants.AssociateCaseType;
import io.metersphere.functional.domain.FunctionalCaseTest;
import io.metersphere.functional.domain.FunctionalCaseTestExample;
+import io.metersphere.functional.dto.FunctionalCaseStepDTO;
import io.metersphere.functional.dto.FunctionalCaseTestDTO;
import io.metersphere.functional.dto.FunctionalCaseTestPlanDTO;
import io.metersphere.functional.dto.TestPlanCaseExecuteHistoryDTO;
@@ -22,12 +23,14 @@ import io.metersphere.provider.BaseAssociateScenarioProvider;
import io.metersphere.provider.BaseTestPlanProvider;
import io.metersphere.request.*;
import io.metersphere.sdk.constants.TestPlanConstants;
+import io.metersphere.sdk.util.JSON;
import io.metersphere.sdk.util.LogUtils;
import io.metersphere.sdk.util.Translator;
import io.metersphere.system.dto.sdk.BaseTreeNode;
import io.metersphere.system.uid.IDGenerator;
import jakarta.annotation.Resource;
import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.session.ExecutorType;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
@@ -292,7 +295,14 @@ public class FunctionalTestCaseService {
planCaseExecuteHistoryDTO.setContentText(new String(planCaseExecuteHistoryDTO.getContent(), StandardCharsets.UTF_8));
}
if (planCaseExecuteHistoryDTO.getSteps() != null) {
- planCaseExecuteHistoryDTO.setStepsText(new String(planCaseExecuteHistoryDTO.getSteps(), StandardCharsets.UTF_8));
+ String historyStepStr = new String(planCaseExecuteHistoryDTO.getSteps(), StandardCharsets.UTF_8);
+ planCaseExecuteHistoryDTO.setStepsText(historyStepStr);
+ if (StringUtils.isNotBlank(historyStepStr)) {
+ List historySteps = JSON.parseArray(historyStepStr, FunctionalCaseStepDTO.class);
+ if (org.apache.commons.collections.CollectionUtils.isNotEmpty(historySteps)) {
+ planCaseExecuteHistoryDTO.setShowResult(true);
+ }
+ }
}
}
return planExecuteHistoryList;
diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/xmind/parser/XMindCaseParser.java b/backend/services/case-management/src/main/java/io/metersphere/functional/xmind/parser/XMindCaseParser.java
index 19c0395738..6f98addfc5 100644
--- a/backend/services/case-management/src/main/java/io/metersphere/functional/xmind/parser/XMindCaseParser.java
+++ b/backend/services/case-management/src/main/java/io/metersphere/functional/xmind/parser/XMindCaseParser.java
@@ -353,7 +353,7 @@ public class XMindCaseParser {
if (StringUtils.isBlank(tag)) {
testCase.setTags("");
} else {
- String[] tagArr = tag.split("\\|");
+ String[] tagArr = tag.split("\\s*[||]\\s*");
if (CollectionUtils.isNotEmpty(Arrays.asList(tagArr))) {
testCase.setTags(String.join(",", tagArr));
}
diff --git a/backend/services/case-management/src/test/java/io/metersphere/functional/controller/FunctionalTestCaseControllerTests.java b/backend/services/case-management/src/test/java/io/metersphere/functional/controller/FunctionalTestCaseControllerTests.java
index 584ca1088d..94fc2ce8ed 100644
--- a/backend/services/case-management/src/test/java/io/metersphere/functional/controller/FunctionalTestCaseControllerTests.java
+++ b/backend/services/case-management/src/test/java/io/metersphere/functional/controller/FunctionalTestCaseControllerTests.java
@@ -1,6 +1,7 @@
package io.metersphere.functional.controller;
import io.metersphere.api.domain.ApiDefinitionModule;
+import io.metersphere.api.domain.ApiScenario;
import io.metersphere.api.domain.ApiScenarioModule;
import io.metersphere.api.domain.ApiTestCase;
import io.metersphere.api.mapper.ApiDefinitionModuleMapper;
@@ -11,6 +12,7 @@ import io.metersphere.functional.constants.AssociateCaseType;
import io.metersphere.functional.constants.FunctionalCaseReviewStatus;
import io.metersphere.functional.domain.FunctionalCase;
import io.metersphere.functional.domain.FunctionalCaseTest;
+import io.metersphere.functional.dto.FunctionalCaseStepDTO;
import io.metersphere.functional.dto.FunctionalCaseTestDTO;
import io.metersphere.functional.dto.FunctionalCaseTestPlanDTO;
import io.metersphere.functional.dto.TestPlanCaseExecuteHistoryDTO;
@@ -254,6 +256,21 @@ public class FunctionalTestCaseControllerTests extends BaseTest {
resultHolder = JSON.parseObject(returnData, ResultHolder.class);
Assertions.assertNotNull(resultHolder);
+ List operationScenarios = new ArrayList<>();
+ ApiScenario apiScenario = new ApiScenario();
+ apiScenario.setId("gyq_associate_scenario_id_1");
+ apiScenario.setVersionId("11");
+ operationScenarios.add(apiScenario);
+ Mockito.when(scenarioProvider.getSelectScenarioCases(request, false)).thenReturn(operationScenarios);
+ Assertions.assertNotNull(resultHolder);
+ request.setSelectAll(false);
+ request.setProjectId("project-associate-case-test");
+ request.setSelectIds(List.of("gyq_associate_case_id_1"));
+ mvcResult = this.requestPostWithOkAndReturn(URL_CASE_PAGE_ASSOCIATE, request);
+ returnData = mvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8);
+ resultHolder = JSON.parseObject(returnData, ResultHolder.class);
+ Assertions.assertNotNull(resultHolder);
+
}
@Test
@@ -590,8 +607,13 @@ public class FunctionalTestCaseControllerTests extends BaseTest {
testPlanCaseExecuteHistory.setStatus(FunctionalCaseReviewStatus.RE_REVIEWED.toString());
testPlanCaseExecuteHistory.setId("testNoContent");
testPlanCaseExecuteHistory.setCreateTime(System.currentTimeMillis());
- String steps = "你好评论";
- testPlanCaseExecuteHistory.setSteps(steps.getBytes());
+ FunctionalCaseStepDTO functionalCaseStepDTO = new FunctionalCaseStepDTO();
+ functionalCaseStepDTO.setNum(1);
+ functionalCaseStepDTO.setDesc("步骤一");
+ functionalCaseStepDTO.setResult("你好评论");
+ List list = new ArrayList<>();
+ list.add(functionalCaseStepDTO);
+ testPlanCaseExecuteHistory.setSteps(JSON.toJSONString(list).getBytes());
testPlanCaseExecuteHistory.setCreateTime(System.currentTimeMillis());
testPlanCaseExecuteHistoryMapper.insertSelective(testPlanCaseExecuteHistory);
gyqReviewCaseTest = getPlanExecuteHistoryList("gyq_associate_function_case");
diff --git a/backend/services/case-management/src/test/resources/file/2module.xmind b/backend/services/case-management/src/test/resources/file/2module.xmind
index 08458dc8f3..0941716de3 100644
Binary files a/backend/services/case-management/src/test/resources/file/2module.xmind and b/backend/services/case-management/src/test/resources/file/2module.xmind differ
diff --git a/backend/services/test-plan/src/main/java/io/metersphere/plan/dto/response/TestPlanCaseExecHistoryResponse.java b/backend/services/test-plan/src/main/java/io/metersphere/plan/dto/response/TestPlanCaseExecHistoryResponse.java
index cf24e9d297..9aaf80069f 100644
--- a/backend/services/test-plan/src/main/java/io/metersphere/plan/dto/response/TestPlanCaseExecHistoryResponse.java
+++ b/backend/services/test-plan/src/main/java/io/metersphere/plan/dto/response/TestPlanCaseExecHistoryResponse.java
@@ -25,6 +25,9 @@ public class TestPlanCaseExecHistoryResponse extends TestPlanCaseExecuteHistory
@Schema(description = "执行人邮箱")
private String email;
- @Schema(description = "步骤描述")
+ @Schema(description = "编辑模式")
private String caseEditType;
+
+ @Schema(description = "是否显示步骤信息")
+ private boolean showResult = false;
}
diff --git a/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanFunctionalCaseService.java b/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanFunctionalCaseService.java
index 325ee11432..1957fdc9d5 100644
--- a/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanFunctionalCaseService.java
+++ b/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanFunctionalCaseService.java
@@ -708,7 +708,14 @@ public class TestPlanFunctionalCaseService extends TestPlanResourceService {
item.setContentText(new String(item.getContent(), StandardCharsets.UTF_8));
}
if (item.getSteps() != null) {
- item.setStepsExecResult(new String(item.getSteps(), StandardCharsets.UTF_8));
+ String historyStepStr = new String(item.getSteps(), StandardCharsets.UTF_8);
+ item.setStepsExecResult(historyStepStr);
+ if (StringUtils.isNotBlank(historyStepStr)) {
+ List historySteps = JSON.parseArray(historyStepStr, FunctionalCaseStepDTO.class);
+ if (CollectionUtils.isNotEmpty(historySteps)) {
+ item.setShowResult(true);
+ }
+ }
}
});
return list;
diff --git a/backend/services/test-plan/src/test/java/io/metersphere/plan/controller/TestPlanCaseControllerTests.java b/backend/services/test-plan/src/test/java/io/metersphere/plan/controller/TestPlanCaseControllerTests.java
index 33b58028e8..6fd93bcc63 100644
--- a/backend/services/test-plan/src/test/java/io/metersphere/plan/controller/TestPlanCaseControllerTests.java
+++ b/backend/services/test-plan/src/test/java/io/metersphere/plan/controller/TestPlanCaseControllerTests.java
@@ -38,10 +38,7 @@ import org.springframework.test.context.jdbc.SqlConfig;
import org.springframework.test.web.servlet.MvcResult;
import java.nio.charset.StandardCharsets;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
@@ -280,6 +277,18 @@ public class TestPlanCaseControllerTests extends BaseTest {
request.setTestPlanId("plan_1");
request.setCaseId("fc_1");
this.requestPostWithOk(FUNCTIONAL_CASE_EXEC_HISTORY_URL, request);
+ TestPlanCaseExecuteHistory testPlanCaseExecuteHistory = new TestPlanCaseExecuteHistory();
+ testPlanCaseExecuteHistory.setId("123445");
+ FunctionalCaseStepDTO functionalCaseStepDTO = new FunctionalCaseStepDTO();
+ functionalCaseStepDTO.setId(UUID.randomUUID().toString());
+ functionalCaseStepDTO.setNum(1);
+ functionalCaseStepDTO.setDesc("步骤描述");
+ functionalCaseStepDTO.setResult("结果");
+ Listlist = new ArrayList<>();
+ list.add(functionalCaseStepDTO);
+ testPlanCaseExecuteHistory.setSteps(JSON.toJSONString(list).getBytes());
+ testPlanCaseExecuteHistoryMapper.updateByPrimaryKeySelective(testPlanCaseExecuteHistory);
+ this.requestPostWithOk(FUNCTIONAL_CASE_EXEC_HISTORY_URL, request);
}
@Test
diff --git a/backend/services/test-plan/src/test/resources/dml/init_test_plan_case_relate_bug.sql b/backend/services/test-plan/src/test/resources/dml/init_test_plan_case_relate_bug.sql
index a5c5b9e290..4b2037434a 100644
--- a/backend/services/test-plan/src/test/resources/dml/init_test_plan_case_relate_bug.sql
+++ b/backend/services/test-plan/src/test/resources/dml/init_test_plan_case_relate_bug.sql
@@ -65,7 +65,7 @@ VALUES
INSERT INTO `test_plan_case_execute_history`(`id`, `test_plan_case_id`, `test_plan_id`, `case_id`, `status`, `content`, `steps`, `deleted`, `notifier`, `create_user`, `create_time`)
VALUES
- ('123445', 'relate_case_1', 'plan_1', 'fc_1', 'PASSED', '1234', '2132134', b'0', '', 'admin', 1715828421525);
+ ('123445', 'relate_case_1', 'plan_1', 'fc_1', 'PASSED', '1234', null, b'0', '', 'admin', 1715828421525);
INSERT INTO functional_case_blob(id, steps, text_description, expected_result, prerequisite, description) VALUES ('fc_1', 'STEP', '1111', '', '', 'TEST');
INSERT INTO project (id, num, organization_id, name, description, create_user, update_user, create_time, update_time, module_setting)