fix(接口自动化): 导出jmx 部分问题修复
This commit is contained in:
parent
048addaf00
commit
2b9a239d6c
|
@ -35,7 +35,6 @@ import org.aspectj.util.FileUtil;
|
|||
import org.dom4j.Document;
|
||||
import org.dom4j.DocumentHelper;
|
||||
import org.dom4j.Element;
|
||||
import org.dom4j.QName;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
@ -582,9 +581,11 @@ public class APITestService {
|
|||
for (Element itemElement : sampleProxyElementList) {
|
||||
if (isFromScenario) {
|
||||
testName = itemElement.attributeValue(attribute_testName);
|
||||
String[] testNameArr = testName.split(scenarioCaseNameSplit);
|
||||
if (testNameArr.length > 0) {
|
||||
testName = testNameArr[0];
|
||||
if (StringUtils.isNotBlank(testName)) {
|
||||
String[] testNameArr = testName.split(scenarioCaseNameSplit);
|
||||
if (testNameArr.length > 0) {
|
||||
testName = testNameArr[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
itemElement.attribute(attribute_testName).setText(testName);
|
||||
|
|
|
@ -457,12 +457,15 @@ public class ApiAutomationService {
|
|||
});
|
||||
scenario.setHashTree(elements);
|
||||
}
|
||||
if (StringUtils.isNotEmpty(element.getString("variables"))) {
|
||||
if (element != null && StringUtils.isNotEmpty(element.getString("variables"))) {
|
||||
LinkedList<ScenarioVariable> variables = mapper.readValue(element.getString("variables"),
|
||||
new TypeReference<LinkedList<ScenarioVariable>>() {
|
||||
});
|
||||
scenario.setVariables(variables);
|
||||
}
|
||||
if (scenario == null) {
|
||||
return null;
|
||||
}
|
||||
// 针对导入的jmx 处理
|
||||
if (CollectionUtils.isNotEmpty(scenario.getHashTree()) && (scenario.getHashTree().get(0) instanceof MsJmeterElement)) {
|
||||
scenario.toHashTree(jmeterHashTree, scenario.getHashTree(), config);
|
||||
|
@ -879,9 +882,13 @@ public class ApiAutomationService {
|
|||
// 生成jmx
|
||||
List<ApiScenrioExportJmx> resList = new ArrayList<>();
|
||||
apiScenarioWithBLOBs.forEach(item -> {
|
||||
String jmx = generateJmx(item);
|
||||
ApiScenrioExportJmx scenrioExportJmx = new ApiScenrioExportJmx(item.getName(), apiTestService.updateJmxString(jmx, null, true));
|
||||
resList.add(scenrioExportJmx);
|
||||
if (StringUtils.isNotEmpty(item.getScenarioDefinition())) {
|
||||
String jmx = generateJmx(item);
|
||||
if (StringUtils.isNotEmpty(jmx)) {
|
||||
ApiScenrioExportJmx scenrioExportJmx = new ApiScenrioExportJmx(item.getName(), apiTestService.updateJmxString(jmx, null, true));
|
||||
resList.add(scenrioExportJmx);
|
||||
}
|
||||
}
|
||||
});
|
||||
return resList;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue