fix(接口场景-添加环境变量,性能测试-引用场景): 解决性能测试引用场景时没有自动加载csv文件的问题,解决设置环境变量参数在场景执行过程中使用不是最新值的问题
解决性能测试引用场景时没有自动加载csv文件的问题,解决设置环境变量参数在场景执行过程中使用不是最新值的问题
This commit is contained in:
parent
f4ac3e1860
commit
df9f214b19
|
@ -280,6 +280,5 @@ public class ApiAutomationController {
|
|||
public List<ApiScenrioExportJmx> exportJmx(@RequestBody ApiScenarioBatchRequest request) {
|
||||
return apiAutomationService.exportJmx(request);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
package io.metersphere.api.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import io.metersphere.base.domain.FileMetadata;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
|
@ -18,6 +19,7 @@ public class JmxInfoDTO {
|
|||
private String xml;
|
||||
private String id;
|
||||
private Map<String, String> attachFiles;
|
||||
private List<FileMetadata> fileMetadataList;
|
||||
|
||||
public JmxInfoDTO(String name,String xml,Map<String, String> attachFiles){
|
||||
this.name = name;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package io.metersphere.api.dto.automation;
|
||||
|
||||
import io.metersphere.base.domain.FileMetadata;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
|
@ -13,6 +14,9 @@ public class ApiScenrioExportJmx {
|
|||
private Integer version;
|
||||
List<String> files;
|
||||
|
||||
//性能测试引用场景时需要场景下的附件
|
||||
private List<FileMetadata> fileMetadataList;
|
||||
|
||||
public ApiScenrioExportJmx(String name, String jmx) {
|
||||
this.name = name;
|
||||
this.jmx = jmx;
|
||||
|
|
|
@ -530,11 +530,13 @@ public class APITestService {
|
|||
//处理附件
|
||||
Map<String, String> attachmentFiles = new HashMap<>();
|
||||
|
||||
List<FileMetadata> fileMetadataList = new ArrayList<>();
|
||||
for (String filePath: attachmentFilePathList) {
|
||||
File file = new File(filePath);
|
||||
if(file.exists() && file.isFile()){
|
||||
try{
|
||||
FileMetadata fileMetadata = fileService.saveFile(file,FileUtil.readAsByteArray(file));
|
||||
fileMetadataList.add(fileMetadata);
|
||||
attachmentFiles.put(fileMetadata.getId(),fileMetadata.getName());
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
|
@ -543,7 +545,7 @@ public class APITestService {
|
|||
}
|
||||
|
||||
JmxInfoDTO returnDTO = new JmxInfoDTO("Demo.jmx",jmxString,attachmentFiles);
|
||||
|
||||
returnDTO.setFileMetadataList(fileMetadataList);
|
||||
return returnDTO;
|
||||
}
|
||||
|
||||
|
|
|
@ -1776,6 +1776,7 @@ public class ApiAutomationService {
|
|||
}
|
||||
}
|
||||
scenrioExportJmx.setVersion(item.getVersion());
|
||||
scenrioExportJmx.setFileMetadataList(dto.getFileMetadataList());
|
||||
resList.add(scenrioExportJmx);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
},
|
||||
{
|
||||
title: this.$t('api_test.request.processor.param_environment_set_global_variable'),
|
||||
value: 'vars.put(${__metersphere_env_id}+"key","value")',
|
||||
value: 'vars.put(${__metersphere_env_id}+"key","value");\n'+'vars.put("key","value");',
|
||||
},
|
||||
{
|
||||
title: this.$t('api_test.request.processor.code_add_report_length'),
|
||||
|
|
Loading…
Reference in New Issue