fix(性能测试、测试计划): #1007796 #1007758 一键转性能测试会出现csv文件重复的问题、执行测试计划场景没有按照顺序执行的问题

--bug=1007758 --user=宋天阳 【性能测试】性能测试引用带csv文件的场景,csv文件会显示好多次
https://www.tapd.cn/55049933/s/1068040、--bug=1007796 --user=宋天阳
【Github#7579】测试计划中拖拽编排场景用例,只能调整显示顺序,但无法作用于执行顺序
https://www.tapd.cn/55049933/s/1068038
This commit is contained in:
song-tianyang 2021-11-16 11:29:31 +08:00 committed by song-tianyang
parent 87f71784e5
commit aa40f9ffc9
3 changed files with 8 additions and 4 deletions

View File

@ -520,7 +520,6 @@ public class APITestService {
//HTTPSamplerProxy 进行附件转化 1.elementProp里去掉路径 2elementProp->filePath获取路径并读出来 //HTTPSamplerProxy 进行附件转化 1.elementProp里去掉路径 2elementProp->filePath获取路径并读出来
attachmentFilePathList.addAll(this.parseAttachmentFileInfo(element)); attachmentFilePathList.addAll(this.parseAttachmentFileInfo(element));
} }
//如果存在证书文件也要匹配出来 //如果存在证书文件也要匹配出来
attachmentFilePathList.addAll(this.parseAttachmentFileInfo(innerHashTreeElement)); attachmentFilePathList.addAll(this.parseAttachmentFileInfo(innerHashTreeElement));
} }
@ -535,7 +534,10 @@ public class APITestService {
//处理附件 //处理附件
Map<String, String> attachmentFiles = new HashMap<>(); Map<String, String> attachmentFiles = new HashMap<>();
//去重处理
if(!CollectionUtils.isEmpty(attachmentFilePathList)){
attachmentFilePathList = attachmentFilePathList.stream().distinct().collect(Collectors.toList());
}
List<FileMetadata> fileMetadataList = new ArrayList<>(); List<FileMetadata> fileMetadataList = new ArrayList<>();
for (String filePath: attachmentFilePathList) { for (String filePath: attachmentFilePathList) {
File file = new File(filePath); File file = new File(filePath);
@ -555,8 +557,8 @@ public class APITestService {
return returnDTO; return returnDTO;
} }
private List<String> parseAttachmentFileInfo(Element parentHashTreeElement) { private List<String> parseAttachmentFileInfo(Element parentHashTreeElement) {
List<String> attachmentFilePathList = new ArrayList<>(); List<String> attachmentFilePathList = new ArrayList<>();
List<Element> parentElementList = parentHashTreeElement.elements(); List<Element> parentElementList = parentHashTreeElement.elements();
for (Element parentElement: parentElementList) { for (Element parentElement: parentElementList) {
String qname = parentElement.getQName().getName(); String qname = parentElement.getQName().getName();

View File

@ -24,6 +24,7 @@
AND t.api_case_id IN ( AND t.api_case_id IN (
SELECT id FROM api_test_case WHERE status IS NULL OR status != 'Trash' SELECT id FROM api_test_case WHERE status IS NULL OR status != 'Trash'
) )
ORDER BY `order` DESC
</select> </select>
<select id="list" resultType="io.metersphere.api.dto.definition.TestPlanApiCaseDTO"> <select id="list" resultType="io.metersphere.api.dto.definition.TestPlanApiCaseDTO">
select select

View File

@ -20,6 +20,7 @@
AND t.api_scenario_id IN ( AND t.api_scenario_id IN (
SELECT id FROM api_scenario WHERE status IS NULL OR status != 'Trash' SELECT id FROM api_scenario WHERE status IS NULL OR status != 'Trash'
) )
ORDER BY `order` DESC
</select> </select>
<select id="list" resultType="io.metersphere.api.dto.automation.ApiScenarioDTO"> <select id="list" resultType="io.metersphere.api.dto.automation.ApiScenarioDTO">