fix(接口测试): 修复导入JMeter文件执行报错问题

--bug=1017880 --user=赵勇 【接口测试】接口自动化-导入jmeter格式-执行场景-报告无法查看请求结果 https://www.tapd.cn/55049933/s/1260836
This commit is contained in:
fit2-zhao 2022-10-13 18:01:55 +08:00 committed by 建国
parent 66f79de62e
commit fbde8efa54
2 changed files with 14 additions and 3 deletions

View File

@ -175,7 +175,7 @@ public class ApiScenarioEnvService {
String definition = apiScenarioWithBLOBs.getScenarioDefinition();
MsScenario scenario = JSON.parseObject(definition, MsScenario.class);
GenerateHashTreeUtil.parse(definition, scenario);
if (StringUtils.equals(environmentType, EnvironmentType.JSON.toString())) {
if (StringUtils.equals(environmentType, EnvironmentType.JSON.toString()) && StringUtils.isNotEmpty(environmentJson)) {
scenario.setEnvironmentMap(JSON.parseObject(environmentJson, Map.class));
} else if (StringUtils.equals(environmentType, EnvironmentType.GROUP.toString())) {
Map<String, String> map = environmentGroupProjectService.getEnvMap(environmentGroupId);

View File

@ -63,8 +63,19 @@ import java.util.stream.Collectors;
@Service
@Transactional(rollbackFor = Exception.class)
public class ApiScenarioReportStructureService {
private static final List<String> REQUESTS = ElementConstants.REQUESTS;
private static final List<String> CONTROLS = Arrays.asList(ElementConstants.ASSERTIONS, ElementConstants.IF_CONTROLLER, ElementConstants.CONSTANT_TIMER);
private static final List<String> REQUESTS = Arrays.asList(
ElementConstants.HTTP_SAMPLER,
ElementConstants.DUBBO_SAMPLER,
ElementConstants.JDBC_SAMPLER,
ElementConstants.TCP_SAMPLER,
ElementConstants.JSR223,
ElementConstants.ABS_SAMPLER
);
private static final List<String> CONTROLS = Arrays.asList(
ElementConstants.ASSERTIONS,
ElementConstants.IF_CONTROLLER,
ElementConstants.CONSTANT_TIMER
);
private static final String RESOURCE_ID = "resourceId";
private static final String REFERENCED = "referenced";
private static final String ERROR_CODE = "errorCode";