refactor(用例管理): 修改xmind导入tag的保存
This commit is contained in:
parent
65c7b0001c
commit
31c10984fb
|
@ -344,11 +344,15 @@ public class XMindCaseParser {
|
||||||
testCase.setTextDescription(replace(item.getTitle(), DESCRIPTION));
|
testCase.setTextDescription(replace(item.getTitle(), DESCRIPTION));
|
||||||
} else if (isAvailable(item.getTitle(), TAGS)) {
|
} else if (isAvailable(item.getTitle(), TAGS)) {
|
||||||
String tag = replace(item.getTitle(), TAGS);
|
String tag = replace(item.getTitle(), TAGS);
|
||||||
String[] tagArr = tag.split("\\|");
|
if (StringUtils.isBlank(tag)) {
|
||||||
if (CollectionUtils.isNotEmpty(Arrays.asList(tagArr))) {
|
testCase.setTags("");
|
||||||
String tags = StringUtils.joinWith(",", Arrays.asList(tagArr));
|
} else {
|
||||||
testCase.setTags(tags);
|
String[] tagArr = tag.split("\\|");
|
||||||
|
if (CollectionUtils.isNotEmpty(Arrays.asList(tagArr))) {
|
||||||
|
testCase.setTags(String.join(",", tagArr));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (isAvailable(item.getTitle(), STEP_DESCRIPTION)) {
|
} else if (isAvailable(item.getTitle(), STEP_DESCRIPTION)) {
|
||||||
if (item.getChildren() != null) {
|
if (item.getChildren() != null) {
|
||||||
testCase.setSteps(this.getSteps(item.getChildren().getAttached(), title));
|
testCase.setSteps(this.getSteps(item.getChildren().getAttached(), title));
|
||||||
|
|
|
@ -784,13 +784,14 @@ public class FunctionalCaseControllerTests extends BaseTest {
|
||||||
@Test
|
@Test
|
||||||
@Order(19)
|
@Order(19)
|
||||||
public void testImportXmind() throws Exception {
|
public void testImportXmind() throws Exception {
|
||||||
String filePath = Objects.requireNonNull(this.getClass().getClassLoader().getResource("file/1xml.xmind")).getPath();
|
|
||||||
MockMultipartFile file = new MockMultipartFile("file", "11.xmind", MediaType.APPLICATION_OCTET_STREAM_VALUE, FileBaseUtils.getFileBytes(filePath));
|
|
||||||
FunctionalCaseImportRequest request = new FunctionalCaseImportRequest();
|
FunctionalCaseImportRequest request = new FunctionalCaseImportRequest();
|
||||||
request.setCover(true);
|
request.setCover(true);
|
||||||
request.setProjectId("100001100001");
|
request.setProjectId("100001100001");
|
||||||
request.setCount("1");
|
request.setCount("1");
|
||||||
LinkedMultiValueMap<String, Object> paramMap = new LinkedMultiValueMap<>();
|
LinkedMultiValueMap<String, Object> paramMap = new LinkedMultiValueMap<>();
|
||||||
|
|
||||||
|
String filePath = Objects.requireNonNull(this.getClass().getClassLoader().getResource("file/1xml.xmind")).getPath();
|
||||||
|
MockMultipartFile file = new MockMultipartFile("file", "11.xmind", MediaType.APPLICATION_OCTET_STREAM_VALUE, FileBaseUtils.getFileBytes(filePath));
|
||||||
paramMap.add("request", JSON.toJSONString(request));
|
paramMap.add("request", JSON.toJSONString(request));
|
||||||
paramMap.add("file", file);
|
paramMap.add("file", file);
|
||||||
MvcResult functionalCaseMvcResult = this.requestMultipartWithOkAndReturn(IMPORT_XMIND_URL, paramMap);
|
MvcResult functionalCaseMvcResult = this.requestMultipartWithOkAndReturn(IMPORT_XMIND_URL, paramMap);
|
||||||
|
@ -815,9 +816,8 @@ public class FunctionalCaseControllerTests extends BaseTest {
|
||||||
functionalCaseResultHolder = JSON.parseObject(functionalCaseImportResponseData, ResultHolder.class);
|
functionalCaseResultHolder = JSON.parseObject(functionalCaseImportResponseData, ResultHolder.class);
|
||||||
functionalCaseImportResponse = JSON.parseObject(JSON.toJSONString(functionalCaseResultHolder.getData()), FunctionalCaseImportResponse.class);
|
functionalCaseImportResponse = JSON.parseObject(JSON.toJSONString(functionalCaseResultHolder.getData()), FunctionalCaseImportResponse.class);
|
||||||
Assertions.assertNotNull(functionalCaseImportResponse);
|
Assertions.assertNotNull(functionalCaseImportResponse);
|
||||||
System.out.println(JSON.toJSONString(functionalCaseImportResponse));
|
|
||||||
functionalCaseExample = new FunctionalCaseExample();
|
functionalCaseExample = new FunctionalCaseExample();
|
||||||
functionalCaseExample.createCriteria().andNameEqualTo("用例名称");
|
functionalCaseExample.createCriteria().andNameLike("%" + "用例名称"+"%");
|
||||||
functionalCases = functionalCaseMapper.selectByExample(functionalCaseExample);
|
functionalCases = functionalCaseMapper.selectByExample(functionalCaseExample);
|
||||||
Assertions.assertNotNull(functionalCases);
|
Assertions.assertNotNull(functionalCases);
|
||||||
|
|
||||||
|
@ -852,7 +852,7 @@ public class FunctionalCaseControllerTests extends BaseTest {
|
||||||
paramMap = new LinkedMultiValueMap<>();
|
paramMap = new LinkedMultiValueMap<>();
|
||||||
paramMap.add("request", JSON.toJSONString(request));
|
paramMap.add("request", JSON.toJSONString(request));
|
||||||
paramMap.add("file", file2);
|
paramMap.add("file", file2);
|
||||||
this.requestMultipart(IMPORT_XMIND_URL, paramMap).andExpect(status().is5xxServerError());;
|
this.requestMultipart(IMPORT_XMIND_URL, paramMap).andExpect(status().is5xxServerError());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue