feat(接口自动化): 完成 jmx 导出功能

This commit is contained in:
fit2-zhao 2021-02-22 16:32:44 +08:00
parent cb1b9b1d67
commit 42a9c3b1de
22 changed files with 94 additions and 103 deletions

View File

@ -10,7 +10,6 @@ import io.metersphere.api.dto.automation.ImportPoolsDTO;
import io.metersphere.api.dto.definition.request.MsScenario;
import io.metersphere.api.dto.definition.request.MsTestElement;
import io.metersphere.api.dto.definition.request.assertions.*;
import io.metersphere.api.dto.definition.request.controller.MsIfController;
import io.metersphere.api.dto.definition.request.controller.MsLoopController;
import io.metersphere.api.dto.definition.request.controller.loop.CountController;
import io.metersphere.api.dto.definition.request.controller.loop.MsForEachController;
@ -51,7 +50,6 @@ import org.apache.commons.collections.CollectionUtils;
import org.apache.jmeter.assertions.*;
import org.apache.jmeter.config.ConfigTestElement;
import org.apache.jmeter.control.ForeachController;
import org.apache.jmeter.control.IfController;
import org.apache.jmeter.control.LoopController;
import org.apache.jmeter.control.WhileController;
import org.apache.jmeter.extractor.JSR223PostProcessor;
@ -568,12 +566,12 @@ public class MsJmeterParser extends ScenarioImportAbstractParser {
BeanUtils.copyBean(elementNode, key);
elementNode.setType("ConstantTimer");
}
// IF条件控制器
else if (key instanceof IfController) {
elementNode = new MsIfController();
BeanUtils.copyBean(elementNode, key);
elementNode.setType("IfController");
}
// IF条件控制器这里平台方式和jmeter 不同暂时不处理
// else if (key instanceof IfController) {
// elementNode = new MsIfController();
// BeanUtils.copyBean(elementNode, key);
// elementNode.setType("IfController");
// }
// 次数循环控制器
else if (key instanceof LoopController) {
elementNode = new MsLoopController();

View File

@ -66,9 +66,6 @@ public class MsScenario extends MsTestElement {
@Override
public void toHashTree(HashTree tree, List<MsTestElement> hashTree, ParameterConfig config) {
if (!this.isEnable()) {
return;
}
if (this.getReferenced() != null && this.getReferenced().equals("Deleted")) {
return;
} else if (this.getReferenced() != null && this.getReferenced().equals("REF")) {
@ -103,6 +100,9 @@ public class MsScenario extends MsTestElement {
this.addCsvDataSet(tree, variables);
this.addCounter(tree, variables);
this.addRandom(tree, variables);
if (CollectionUtils.isNotEmpty(this.headers)) {
setHeader(tree, this.headers);
}
if (CollectionUtils.isNotEmpty(hashTree)) {
for (MsTestElement el : hashTree) {
// 给所有孩子加一个父亲标志
@ -110,9 +110,6 @@ public class MsScenario extends MsTestElement {
el.toHashTree(tree, el.getHashTree(), config);
}
}
if (CollectionUtils.isNotEmpty(this.headers)) {
setHeader(tree, this.headers);
}
}
public void setOldVariables(List<KeyValue> oldVariables) {

View File

@ -45,11 +45,11 @@ public class MsThreadGroup extends MsTestElement {
loopController.setName("LoopController");
loopController.setProperty(TestElement.TEST_CLASS, LoopController.class.getName());
loopController.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("LoopControlPanel"));
loopController.setEnabled(true);
loopController.setEnabled(this.isEnable());
loopController.setLoops(1);
ThreadGroup threadGroup = new ThreadGroup();
threadGroup.setEnabled(true);
threadGroup.setEnabled(this.isEnable());
threadGroup.setName(this.getName());
threadGroup.setProperty(TestElement.TEST_CLASS, ThreadGroup.class.getName());
threadGroup.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("ThreadGroupGui"));

View File

@ -8,15 +8,27 @@ import java.util.List;
@Data
public class ParameterConfig {
// 环境配置
/**
* 环境配置
*/
private EnvironmentConfig config;
// 公共场景参数
/**
* 公共场景参数
*/
private List<ScenarioVariable> variables;
// 公共Cookie
/**
* 公共Cookie
*/
private boolean enableCookieShare;
// 步骤
/**
* 步骤
*/
private String step;
private String stepType;
/**
* 是否是导入/导出操作
*/
private boolean isOperating;
}

View File

@ -27,9 +27,7 @@ public class MsAssertions extends MsTestElement {
@Override
public void toHashTree(HashTree tree, List<MsTestElement> hashTree, ParameterConfig config) {
if (this.isEnable()) {
addAssertions(tree);
}
addAssertions(tree);
}
private void addAssertions(HashTree hashTree) {
@ -64,7 +62,7 @@ public class MsAssertions extends MsTestElement {
private ResponseAssertion responseAssertion(MsAssertionRegex assertionRegex) {
ResponseAssertion assertion = new ResponseAssertion();
assertion.setEnabled(true);
assertion.setEnabled(this.isEnable());
assertion.setName(assertionRegex.getDescription());
assertion.setProperty(TestElement.TEST_CLASS, ResponseAssertion.class.getName());
assertion.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("AssertionGui"));
@ -89,7 +87,7 @@ public class MsAssertions extends MsTestElement {
private JSONPathAssertion jsonPathAssertion(MsAssertionJsonPath assertionJsonPath) {
JSONPathAssertion assertion = new JSONPathAssertion();
assertion.setEnabled(true);
assertion.setEnabled(this.isEnable());
assertion.setName(StringUtils.isEmpty(assertionJsonPath.getDescription()) ? "JSONPathAssertion" : assertionJsonPath.getDescription());
assertion.setProperty(TestElement.TEST_CLASS, JSONPathAssertion.class.getName());
assertion.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("JSONPathAssertionGui"));
@ -104,7 +102,7 @@ public class MsAssertions extends MsTestElement {
private XPath2Assertion xPath2Assertion(MsAssertionXPath2 assertionXPath2) {
XPath2Assertion assertion = new XPath2Assertion();
assertion.setEnabled(true);
assertion.setEnabled(this.isEnable());
assertion.setName(StringUtils.isEmpty(assertionXPath2.getExpression()) ? "XPath2Assertion" : assertionXPath2.getExpression());
assertion.setProperty(TestElement.TEST_CLASS, XPath2Assertion.class.getName());
assertion.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("XPath2AssertionGui"));
@ -115,7 +113,7 @@ public class MsAssertions extends MsTestElement {
private DurationAssertion durationAssertion(MsAssertionDuration assertionDuration) {
DurationAssertion assertion = new DurationAssertion();
assertion.setEnabled(true);
assertion.setEnabled(this.isEnable());
assertion.setName("Response In Time: " + assertionDuration.getValue());
assertion.setProperty(TestElement.TEST_CLASS, DurationAssertion.class.getName());
assertion.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("DurationAssertionGui"));
@ -125,7 +123,7 @@ public class MsAssertions extends MsTestElement {
private JSR223Assertion jsr223Assertion(MsAssertionJSR223 assertionJSR223) {
JSR223Assertion assertion = new JSR223Assertion();
assertion.setEnabled(true);
assertion.setEnabled(this.isEnable());
assertion.setName(StringUtils.isEmpty(assertionJSR223.getDesc()) ? "JSR223Assertion" : assertionJSR223.getDesc());
assertion.setProperty(TestElement.TEST_CLASS, JSR223Assertion.class.getName());
assertion.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("TestBeanGUI"));

View File

@ -27,11 +27,8 @@ public class MsHeaderManager extends MsTestElement {
@Override
public void toHashTree(HashTree tree, List<MsTestElement> hashTree, ParameterConfig config) {
if (!this.isEnable()) {
return;
}
HeaderManager headerManager = new HeaderManager();
headerManager.setEnabled(true);
headerManager.setEnabled(this.isEnable());
headerManager.setName(this.getName() + "Headers");
headerManager.setProperty(TestElement.TEST_CLASS, HeaderManager.class.getName());
headerManager.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("HeaderPanel"));

View File

@ -26,9 +26,6 @@ public class MsIfController extends MsTestElement {
@Override
public void toHashTree(HashTree tree, List<MsTestElement> hashTree, ParameterConfig config) {
if (!this.isEnable()) {
return;
}
final HashTree groupTree = tree.add(ifController());
if (CollectionUtils.isNotEmpty(hashTree)) {
hashTree.forEach(el -> {
@ -41,7 +38,7 @@ public class MsIfController extends MsTestElement {
private IfController ifController() {
IfController ifController = new IfController();
ifController.setEnabled(true);
ifController.setEnabled(this.isEnable());
ifController.setName(StringUtils.isEmpty(this.getName()) ? "IfController" : this.getName());
ifController.setProperty(TestElement.TEST_CLASS, IfController.class.getName());
ifController.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("IfControllerPanel"));

View File

@ -44,9 +44,6 @@ public class MsLoopController extends MsTestElement {
@Override
public void toHashTree(HashTree tree, List<MsTestElement> hashTree, ParameterConfig config) {
if (!this.isEnable()) {
return;
}
if (StringUtils.equals(this.loopType, LoopConstants.WHILE.name()) && this.whileController != null) {
config.setStep("While 循环");
}
@ -104,7 +101,7 @@ public class MsLoopController extends MsTestElement {
private LoopController initLoopController() {
LoopController loopController = new LoopController();
loopController.setEnabled(true);
loopController.setEnabled(this.isEnable());
loopController.setName("LoopController");
loopController.setProperty(TestElement.TEST_CLASS, LoopController.class.getName());
loopController.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("LoopControlPanel"));
@ -142,7 +139,7 @@ public class MsLoopController extends MsTestElement {
return null;
}
WhileController controller = new WhileController();
controller.setEnabled(true);
controller.setEnabled(this.isEnable());
controller.setName("WhileController");
controller.setProperty(TestElement.TEST_CLASS, WhileController.class.getName());
controller.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("WhileControllerGui"));
@ -152,7 +149,7 @@ public class MsLoopController extends MsTestElement {
private ForeachController initForeachController() {
ForeachController controller = new ForeachController();
controller.setEnabled(true);
controller.setEnabled(this.isEnable());
controller.setName("ForeachController");
controller.setProperty(TestElement.TEST_CLASS, ForeachController.class.getName());
controller.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("ForeachControlPanel"));
@ -188,7 +185,7 @@ public class MsLoopController extends MsTestElement {
private ConstantTimer getCnstantTimer() {
ConstantTimer constantTimer = new ConstantTimer();
constantTimer.setEnabled(true);
constantTimer.setEnabled(this.isEnable());
constantTimer.setProperty(TestElement.TEST_CLASS, ConstantTimer.class.getName());
constantTimer.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("ConstantTimerGui"));
if (StringUtils.equals(this.loopType, LoopConstants.WHILE.name()) && this.whileController != null) {

View File

@ -30,9 +30,6 @@ public class MsExtract extends MsTestElement {
@Override
public void toHashTree(HashTree tree, List<MsTestElement> hashTree, ParameterConfig config) {
if (!this.isEnable()) {
return;
}
addRequestExtractors(tree);
}
@ -68,7 +65,7 @@ public class MsExtract extends MsTestElement {
private RegexExtractor regexExtractor(MsExtractRegex extractRegex, StringJoiner extract) {
RegexExtractor extractor = new RegexExtractor();
extractor.setEnabled(true);
extractor.setEnabled(this.isEnable());
extractor.setName(extractRegex.getVariable() + " RegexExtractor");
extractor.setProperty(TestElement.TEST_CLASS, RegexExtractor.class.getName());
extractor.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("RegexExtractorGui"));
@ -86,7 +83,7 @@ public class MsExtract extends MsTestElement {
private XPath2Extractor xPath2Extractor(MsExtractXPath extractXPath, StringJoiner extract) {
XPath2Extractor extractor = new XPath2Extractor();
extractor.setEnabled(true);
extractor.setEnabled(this.isEnable());
extractor.setName(extractXPath.getVariable() + " XPath2Extractor");
extractor.setProperty(TestElement.TEST_CLASS, XPath2Extractor.class.getName());
extractor.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("XPath2ExtractorGui"));
@ -101,7 +98,7 @@ public class MsExtract extends MsTestElement {
private JSONPostProcessor jsonPostProcessor(MsExtractJSONPath extractJSONPath, StringJoiner extract) {
JSONPostProcessor extractor = new JSONPostProcessor();
extractor.setEnabled(true);
extractor.setEnabled(this.isEnable());
extractor.setName(extractJSONPath.getVariable() + " JSONExtractor");
extractor.setProperty(TestElement.TEST_CLASS, JSONPostProcessor.class.getName());
extractor.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("JSONPostProcessorGui"));

View File

@ -29,18 +29,15 @@ public class MsJSR223Processor extends MsTestElement {
@Override
public void toHashTree(HashTree tree, List<MsTestElement> hashTree, ParameterConfig config) {
if (!this.isEnable()) {
return;
}
JSR223Sampler processor = new JSR223Sampler();
processor.setEnabled(true);
processor.setEnabled(this.isEnable());
if (StringUtils.isNotEmpty(this.getName())) {
processor.setName(this.getName());
} else {
processor.setName("JSR223Processor");
}
String name = this.getParentName(this.getParent(), config);
if (StringUtils.isNotEmpty(name)) {
if (StringUtils.isNotEmpty(name) && !config.isOperating()) {
processor.setName(this.getName() + "<->" + name);
}
processor.setProperty(TestElement.TEST_CLASS, JSR223Sampler.class.getName());

View File

@ -29,11 +29,8 @@ public class MsJSR223PostProcessor extends MsTestElement {
@Override
public void toHashTree(HashTree tree, List<MsTestElement> hashTree, ParameterConfig config) {
if (!this.isEnable()) {
return;
}
JSR223PostProcessor processor = new JSR223PostProcessor();
processor.setEnabled(true);
processor.setEnabled(this.isEnable());
if (StringUtils.isNotEmpty(this.getName())) {
processor.setName(this.getName());
} else {

View File

@ -29,9 +29,6 @@ public class MsJSR223PreProcessor extends MsTestElement {
@Override
public void toHashTree(HashTree tree, List<MsTestElement> hashTree, ParameterConfig config) {
if (!this.isEnable()) {
return;
}
final HashTree jsr223PreTree = tree.add(getJSR223PreProcessor());
if (CollectionUtils.isNotEmpty(hashTree)) {
hashTree.forEach(el -> {
@ -42,7 +39,7 @@ public class MsJSR223PreProcessor extends MsTestElement {
public JSR223PreProcessor getJSR223PreProcessor() {
JSR223PreProcessor processor = new JSR223PreProcessor();
processor.setEnabled(true);
processor.setEnabled(this.isEnable());
if (StringUtils.isNotEmpty(this.getName())) {
processor.setName(this.getName());
} else {

View File

@ -57,9 +57,6 @@ public class MsDubboSampler extends MsTestElement {
@Override
public void toHashTree(HashTree tree, List<MsTestElement> hashTree, ParameterConfig config) {
if (!this.isEnable()) {
return;
}
if (this.getReferenced() != null && "Deleted".equals(this.getReferenced())) {
return;
}
@ -77,9 +74,10 @@ public class MsDubboSampler extends MsTestElement {
private DubboSample dubboSample(ParameterConfig config) {
DubboSample sampler = new DubboSample();
sampler.setEnabled(this.isEnable());
sampler.setName(this.getName());
String name = this.getParentName(this.getParent(), config);
if (StringUtils.isNotEmpty(name)) {
if (StringUtils.isNotEmpty(name) && !config.isOperating()) {
sampler.setName(this.getName() + "<->" + name);
}
sampler.setProperty(TestElement.TEST_CLASS, DubboSample.class.getName());

View File

@ -93,17 +93,15 @@ public class MsHTTPSamplerProxy extends MsTestElement {
@Override
public void toHashTree(HashTree tree, List<MsTestElement> hashTree, ParameterConfig config) {
if (!this.isEnable()) {
return;
}
if (this.getReferenced() != null && MsTestElementConstants.REF.name().equals(this.getReferenced())) {
this.getRefElement(this);
}
HTTPSamplerProxy sampler = new HTTPSamplerProxy();
sampler.setEnabled(true);
sampler.setEnabled(this.isEnable());
sampler.setName(this.getName());
String name = this.getParentName(this.getParent(), config);
if (StringUtils.isNotEmpty(name)) {
if (StringUtils.isNotEmpty(name) && !config.isOperating()) {
sampler.setName(this.getName() + "<->" + name);
}
sampler.setProperty(TestElement.TEST_CLASS, HTTPSamplerProxy.class.getName());
@ -124,7 +122,7 @@ public class MsHTTPSamplerProxy extends MsTestElement {
// 添加环境中的公共变量
Arguments arguments = this.addArguments(config);
if (arguments != null) {
tree.add(this.addArguments(config));
tree.add(arguments);
}
try {
if (config != null && config.getConfig() != null) {

View File

@ -55,9 +55,6 @@ public class MsJDBCSampler extends MsTestElement {
@Override
public void toHashTree(HashTree tree, List<MsTestElement> hashTree, ParameterConfig config) {
if (!this.isEnable()) {
return;
}
if (this.getReferenced() != null && MsTestElementConstants.REF.name().equals(this.getReferenced())) {
this.getRefElement(this);
}
@ -70,7 +67,10 @@ public class MsJDBCSampler extends MsTestElement {
}
final HashTree samplerHashTree = tree.add(jdbcSampler(config));
tree.add(jdbcDataSource());
tree.add(arguments(this.getName() + " Variables", this.getVariables()));
Arguments arguments = arguments(this.getName() + " Variables", this.getVariables());
if (arguments != null) {
tree.add(arguments);
}
if (CollectionUtils.isNotEmpty(hashTree)) {
hashTree.forEach(el -> {
el.toHashTree(samplerHashTree, el.getHashTree(), config);
@ -111,9 +111,10 @@ public class MsJDBCSampler extends MsTestElement {
private JDBCSampler jdbcSampler(ParameterConfig config) {
JDBCSampler sampler = new JDBCSampler();
sampler.setEnabled(this.isEnable());
sampler.setName(this.getName());
String name = this.getParentName(this.getParent(), config);
if (StringUtils.isNotEmpty(name)) {
if (StringUtils.isNotEmpty(name) && !config.isOperating()) {
sampler.setName(this.getName() + "<->" + name);
}
sampler.setProperty(TestElement.TEST_CLASS, JDBCSampler.class.getName());

View File

@ -72,9 +72,6 @@ public class MsTCPSampler extends MsTestElement {
@Override
public void toHashTree(HashTree tree, List<MsTestElement> hashTree, ParameterConfig config) {
if (!this.isEnable()) {
return;
}
if (this.getReferenced() != null && MsTestElementConstants.REF.name().equals(this.getReferenced())) {
this.getRefElement(this);
}
@ -84,7 +81,7 @@ public class MsTCPSampler extends MsTestElement {
// 添加环境中的公共变量
Arguments arguments = this.addArguments(config);
if (arguments != null) {
tree.add(this.addArguments(config));
tree.add(arguments);
}
final HashTree samplerHashTree = new ListedHashTree();
@ -110,9 +107,10 @@ public class MsTCPSampler extends MsTestElement {
private TCPSampler tcpSampler(ParameterConfig config) {
TCPSampler tcpSampler = new TCPSampler();
tcpSampler.setEnabled(this.isEnable());
tcpSampler.setName(this.getName());
String name = this.getParentName(this.getParent(), config);
if (StringUtils.isNotEmpty(name)) {
if (StringUtils.isNotEmpty(name) && !config.isOperating()) {
tcpSampler.setName(this.getName() + "<->" + name);
}

View File

@ -26,9 +26,7 @@ public class MsConstantTimer extends MsTestElement {
@Override
public void toHashTree(HashTree tree, List<MsTestElement> hashTree, ParameterConfig config) {
if (!this.isEnable()) {
return;
}
final HashTree groupTree = tree.add(constantTimer());
if (CollectionUtils.isNotEmpty(hashTree)) {
hashTree.forEach(el -> {
@ -39,7 +37,7 @@ public class MsConstantTimer extends MsTestElement {
private ConstantTimer constantTimer() {
ConstantTimer constantTimer = new ConstantTimer();
constantTimer.setEnabled(true);
constantTimer.setEnabled(this.isEnable());
constantTimer.setName(this.getDelay() + " ms");
constantTimer.setProperty(TestElement.TEST_CLASS, ConstantTimer.class.getName());
constantTimer.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("ConstantTimerGui"));

View File

@ -29,17 +29,17 @@ public class MsJmeterElement extends MsTestElement {
@Override
public void toHashTree(HashTree tree, List<MsTestElement> hashTree, ParameterConfig config) {
if (!this.isEnable()) {
return;
}
try {
InputStream inputSource = getStrToStream(jmeterElement);
if (inputSource != null) {
Object scriptWrapper = SaveService.loadElement(inputSource);
HashTree elementTree = tree;
if (!(scriptWrapper instanceof TestPlan) && !(scriptWrapper instanceof ThreadGroup)) {
if (config.isOperating()) {
elementTree = tree.add(scriptWrapper);
} else if (!(scriptWrapper instanceof TestPlan) && !(scriptWrapper instanceof ThreadGroup)) {
elementTree = tree.add(scriptWrapper);
}
if (CollectionUtils.isNotEmpty(hashTree)) {
for (MsTestElement el : hashTree) {
el.toHashTree(elementTree, el.getHashTree(), config);

View File

@ -40,6 +40,10 @@ public class ScenarioVariable {
private String minNumber;
private String maxNumber;
public ScenarioVariable() {
}
public ScenarioVariable(String key, String value, String description, String type) {
this.name = key;
this.value = value;

View File

@ -15,6 +15,7 @@ import io.metersphere.api.dto.automation.parse.ScenarioImportParserFactory;
import io.metersphere.api.dto.datacount.ApiDataCountResult;
import io.metersphere.api.dto.definition.RunDefinitionRequest;
import io.metersphere.api.dto.definition.request.*;
import io.metersphere.api.dto.definition.request.unknown.MsJmeterElement;
import io.metersphere.api.dto.definition.request.variable.ScenarioVariable;
import io.metersphere.api.dto.scenario.environment.EnvironmentConfig;
import io.metersphere.api.jmeter.JMeterService;
@ -438,11 +439,11 @@ public class ApiAutomationService {
private String generateJmx(ApiScenarioWithBLOBs apiScenario) {
HashTree jmeterHashTree = new ListedHashTree();
MsTestPlan testPlan = new MsTestPlan();
testPlan.setName(apiScenario.getName());
testPlan.setHashTree(new LinkedList<>());
ParameterConfig config = new ParameterConfig();
config.setOperating(true);
try {
MsThreadGroup group = new MsThreadGroup();
group.setLabel(apiScenario.getName());
group.setName(apiScenario.getName());
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
@ -462,17 +463,26 @@ public class ApiAutomationService {
});
scenario.setVariables(variables);
}
group.setEnableCookieShare(scenario.isEnableCookieShare());
group.setHashTree(new LinkedList<MsTestElement>() {{
this.add(scenario);
}});
// 针对导入的jmx 处理
if (CollectionUtils.isNotEmpty(scenario.getHashTree()) && (scenario.getHashTree().get(0) instanceof MsJmeterElement)) {
scenario.toHashTree(jmeterHashTree, scenario.getHashTree(), config);
return scenario.getJmx(jmeterHashTree);
} else {
MsThreadGroup group = new MsThreadGroup();
group.setLabel(apiScenario.getName());
group.setName(apiScenario.getName());
group.setEnableCookieShare(scenario.isEnableCookieShare());
group.setHashTree(new LinkedList<MsTestElement>() {{
this.add(scenario);
}});
testPlan.getHashTree().add(group);
}
testPlan.getHashTree().add(group);
} catch (Exception ex) {
ex.printStackTrace();
MSException.throwException(ex.getMessage());
}
testPlan.toHashTree(jmeterHashTree, testPlan.getHashTree(), new ParameterConfig());
testPlan.toHashTree(jmeterHashTree, testPlan.getHashTree(), config);
return testPlan.getJmx(jmeterHashTree);
}
@ -867,7 +877,8 @@ public class ApiAutomationService {
// 生成jmx
List<ApiScenrioExportJmx> resList = new ArrayList<>();
apiScenarioWithBLOBs.forEach(item -> {
ApiScenrioExportJmx scenrioExportJmx = new ApiScenrioExportJmx(item.getName(), apiTestService.updateJmxString(generateJmx(item), item.getName(), true));
String jmx = generateJmx(item);
ApiScenrioExportJmx scenrioExportJmx = new ApiScenrioExportJmx(item.getName(), apiTestService.updateJmxString(jmx, null, true));
resList.add(scenrioExportJmx);
});
return resList;

@ -1 +1 @@
Subproject commit b9042074b780205e275c674f64417799110519fd
Subproject commit 5e0b365f1080197e84055e80071165787e2e79c5

View File

@ -686,7 +686,6 @@
this.result = this.$post("/api/automation/export/jmx", param, response => {
this.loading = false;
let obj = response.data;
console.log(obj)
if (obj && obj.length > 0) {
obj.forEach(item => {
downloadFile(item.name + ".jmx", item.jmx);