refactor(测试计划): 增加单元测试覆盖率
This commit is contained in:
parent
b84a874aa9
commit
1248028981
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue