feat(用例管理): 增加测试覆盖率

This commit is contained in:
guoyuqi 2024-08-08 19:55:44 +08:00 committed by 刘瑞斌
parent d7927a663a
commit a9eead1b31
1 changed files with 17 additions and 5 deletions

View File

@ -799,12 +799,11 @@ public class FunctionalCaseControllerTests extends BaseTest {
ResultHolder functionalCaseResultHolder = JSON.parseObject(functionalCaseImportResponseData, ResultHolder.class);
FunctionalCaseImportResponse functionalCaseImportResponse = JSON.parseObject(JSON.toJSONString(functionalCaseResultHolder.getData()), FunctionalCaseImportResponse.class);
Assertions.assertNotNull(functionalCaseImportResponse);
System.out.println(JSON.toJSONString(functionalCaseImportResponse));
FunctionalCaseExample functionalCaseExample = new FunctionalCaseExample();
functionalCaseExample.createCriteria().andNameEqualTo("用例名称");
List<FunctionalCase> functionalCases = functionalCaseMapper.selectByExample(functionalCaseExample);
System.out.println(JSON.toJSONString(functionalCases));
Assertions.assertNotNull(functionalCases);
String filePath5 = Objects.requireNonNull(this.getClass().getClassLoader().getResource("file/2module.xmind")).getPath();
MockMultipartFile file5 = new MockMultipartFile("file", "15.xmind", MediaType.APPLICATION_OCTET_STREAM_VALUE, FileBaseUtils.getFileBytes(filePath5));
@ -820,7 +819,7 @@ public class FunctionalCaseControllerTests extends BaseTest {
functionalCaseExample = new FunctionalCaseExample();
functionalCaseExample.createCriteria().andNameEqualTo("用例名称");
functionalCases = functionalCaseMapper.selectByExample(functionalCaseExample);
System.out.println(JSON.toJSONString(functionalCases));
Assertions.assertNotNull(functionalCases);
String filePath1 = Objects.requireNonNull(this.getClass().getClassLoader().getResource("file/3erro.xmind")).getPath();
MockMultipartFile file1 = new MockMultipartFile("file", "14.xmind", MediaType.APPLICATION_OCTET_STREAM_VALUE, FileBaseUtils.getFileBytes(filePath1));
@ -832,7 +831,6 @@ public class FunctionalCaseControllerTests extends BaseTest {
functionalCaseResultHolder = JSON.parseObject(functionalCaseImportResponseData, ResultHolder.class);
functionalCaseImportResponse = JSON.parseObject(JSON.toJSONString(functionalCaseResultHolder.getData()), FunctionalCaseImportResponse.class);
Assertions.assertNotNull(functionalCaseImportResponse);
System.out.println(JSON.toJSONString(functionalCaseImportResponse));
String filePath4 = Objects.requireNonNull(this.getClass().getClassLoader().getResource("file/empty.xmind")).getPath();
MockMultipartFile file2 = new MockMultipartFile("file", "18.xmind", MediaType.APPLICATION_OCTET_STREAM_VALUE, FileBaseUtils.getFileBytes(filePath4));
@ -844,8 +842,17 @@ public class FunctionalCaseControllerTests extends BaseTest {
functionalCaseResultHolder = JSON.parseObject(functionalCaseImportResponseData, ResultHolder.class);
functionalCaseImportResponse = JSON.parseObject(JSON.toJSONString(functionalCaseResultHolder.getData()), FunctionalCaseImportResponse.class);
Assertions.assertNotNull(functionalCaseImportResponse);
System.out.println(JSON.toJSONString(functionalCaseImportResponse));
paramMap = new LinkedMultiValueMap<>();
paramMap.add("request", JSON.toJSONString(request));
paramMap.add("file", null);
this.requestMultipart(IMPORT_XMIND_URL, paramMap).andExpect(status().is5xxServerError());
request.setCount(null);
paramMap = new LinkedMultiValueMap<>();
paramMap.add("request", JSON.toJSONString(request));
paramMap.add("file", file2);
this.requestMultipart(IMPORT_XMIND_URL, paramMap).andExpect(status().is5xxServerError());;
}
@Test
@ -908,6 +915,11 @@ public class FunctionalCaseControllerTests extends BaseTest {
Assertions.assertNotNull(functionalCaseImportResponse);
System.out.println(JSON.toJSONString(functionalCaseImportResponse));
paramMap = new LinkedMultiValueMap<>();
paramMap.add("request", JSON.toJSONString(request));
paramMap.add("file", null);
this.requestMultipart(CHECK_XMIND_URL, paramMap).andExpect(status().is5xxServerError());
}
@Test