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 92e98872d2..8e4fcee0ec 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 @@ -279,6 +279,30 @@ public class TestPlanCaseControllerTests extends BaseTest { ResultHolder resultHolder = JSON.parseObject(returnData, ResultHolder.class); FunctionalCaseDetailDTO functionalCaseDetailDTO = JSON.parseObject(JSON.toJSONString(resultHolder.getData()), FunctionalCaseDetailDTO.class); Assertions.assertTrue(CollectionUtils.isEmpty(JSON.parseArray(functionalCaseDetailDTO.getSteps(), FunctionalCaseDetailDTO.class))); + FunctionalCaseStepDTO functionalCaseStepDTO = new FunctionalCaseStepDTO(); + functionalCaseStepDTO.setId("id_step"); + functionalCaseStepDTO.setNum(1); + functionalCaseStepDTO.setDesc("步骤一"); + functionalCaseStepDTO.setResult("步骤一结果"); + functionalCaseStepDTO.setActualResult("步骤一实际结果"); + functionalCaseStepDTO.setExecuteResult("SUCCESS"); + String jsonString = JSON.toJSONString(functionalCaseStepDTO); + FunctionalCaseBlob functionalCaseBlob = new FunctionalCaseBlob(); + functionalCaseBlob.setId("gyq_disassociate_fc_4"); + functionalCaseBlob.setSteps(jsonString.getBytes()); + String textDescription = "textDescription"; + String expectedResult = "expectedResult"; + String prerequisite = "prerequisite"; + String description = "description"; + functionalCaseBlob.setPrerequisite(prerequisite.getBytes(StandardCharsets.UTF_8)); + functionalCaseBlob.setTextDescription(textDescription.getBytes(StandardCharsets.UTF_8)); + functionalCaseBlob.setExpectedResult(expectedResult.getBytes(StandardCharsets.UTF_8)); + functionalCaseBlob.setDescription(description.getBytes(StandardCharsets.UTF_8)); + functionalCaseBlobMapper.updateByPrimaryKeyWithBLOBs(functionalCaseBlob); + mvcResult = this.requestGetWithOkAndReturn(FUNCTIONAL_CASE_DETAIL + "gyq_disassociate_case_4"); + returnData = mvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8); + resultHolder = JSON.parseObject(returnData, ResultHolder.class); + Assertions.assertNotNull(resultHolder); TestPlanCaseExecuteHistory testPlanCaseExecuteHistory = new TestPlanCaseExecuteHistory(); testPlanCaseExecuteHistory.setCaseId("gyq_disassociate_fc_4"); testPlanCaseExecuteHistory.setTestPlanCaseId("gyq_disassociate_case_4"); @@ -293,28 +317,14 @@ public class TestPlanCaseControllerTests extends BaseTest { resultHolder = JSON.parseObject(returnData, ResultHolder.class); Assertions.assertNotNull(resultHolder); TestPlanCaseExecuteHistory testPlanCaseExecuteHistory1 = testPlanCaseExecuteHistoryMapper.selectByPrimaryKey("history_id"); - FunctionalCaseStepDTO functionalCaseStepDTO = new FunctionalCaseStepDTO(); - functionalCaseStepDTO.setId("id_step"); - functionalCaseStepDTO.setNum(1); - functionalCaseStepDTO.setDesc("步骤一"); - functionalCaseStepDTO.setResult("步骤一结果"); - functionalCaseStepDTO.setActualResult("步骤一实际结果"); - functionalCaseStepDTO.setExecuteResult("SUCCESS"); - String jsonString = JSON.toJSONString(functionalCaseStepDTO); + testPlanCaseExecuteHistory1.setSteps(new byte[0]); + testPlanCaseExecuteHistoryMapper.updateByPrimaryKeySelective(testPlanCaseExecuteHistory1); + mvcResult = this.requestGetWithOkAndReturn(FUNCTIONAL_CASE_DETAIL + "gyq_disassociate_case_4"); + returnData = mvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8); + resultHolder = JSON.parseObject(returnData, ResultHolder.class); + Assertions.assertNotNull(resultHolder); testPlanCaseExecuteHistory1.setSteps(jsonString.getBytes()); testPlanCaseExecuteHistoryMapper.updateByPrimaryKeySelective(testPlanCaseExecuteHistory1); - FunctionalCaseBlob functionalCaseBlob = new FunctionalCaseBlob(); - functionalCaseBlob.setId("gyq_disassociate_fc_4"); - functionalCaseBlob.setSteps(jsonString.getBytes()); - String textDescription = "textDescription"; - String expectedResult = "expectedResult"; - String prerequisite = "prerequisite"; - String description = "description"; - functionalCaseBlob.setPrerequisite(prerequisite.getBytes(StandardCharsets.UTF_8)); - functionalCaseBlob.setTextDescription(textDescription.getBytes(StandardCharsets.UTF_8)); - functionalCaseBlob.setExpectedResult(expectedResult.getBytes(StandardCharsets.UTF_8)); - functionalCaseBlob.setDescription(description.getBytes(StandardCharsets.UTF_8)); - functionalCaseBlobMapper.updateByPrimaryKeyWithBLOBs(functionalCaseBlob); mvcResult = this.requestGetWithOkAndReturn(FUNCTIONAL_CASE_DETAIL + "gyq_disassociate_case_4"); returnData = mvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8); resultHolder = JSON.parseObject(returnData, ResultHolder.class);