Когда я вызываю jmeter test из GUI, тогда он работает правильно, но когда я вызываю run или runTests стандартного движка JMeter, он ничего не сохраняет в / tmp / jmeter .
Как это сделать?Как я могу выполнить и извлечь полезную нагрузку API из Java-кода, сохраненного из Save Response to File Listener.
Я использую JMeter 5.0
JMeterUtils.setJMeterHome(getJmeterHome());
JMeterUtils.loadJMeterProperties(jmeterPropertiesFile.toString());
JMeterUtils.initLocale();
StandardJMeterEngine standardJMeterEngine = new StandardJMeterEngine();
standardJMeterEngine.configure(rootTree);
standardJMeterEngine.run();
Класс построителя
public class MySaveResponseToFileBuilder {
private String name;
private String comment;
private boolean enabled;
private String fileName;
private String variableName;
public MySaveResponseToFileBuilder() {
this.name = "Save Response to File";
this.enabled = true;
this.comment = "";
this.fileName = "";
this.variableName = "";
}
public String getName() {
return name;
}
public MySaveResponseToFileBuilder setName(String name) {
this.name = name;
return this;
}
public String getComment() {
return comment;
}
public MySaveResponseToFileBuilder setComment(String comment) {
this.comment = comment;
return this;
}
public boolean isEnabled() {
return enabled;
}
public MySaveResponseToFileBuilder setEnabled(boolean enabled) {
this.enabled = enabled;
return this;
}
public String getFileName() {
return fileName;
}
public MySaveResponseToFileBuilder setFileName(String fileName) {
this.fileName = fileName;
return this;
}
public String getVariableName() {
return variableName;
}
public MySaveResponseToFileBuilder setVariableName(String variableName) {
this.variableName = variableName;
return this;
}
public ResultSaver build() {
ResultSaver resultSaver = new ResultSaver();
resultSaver.setName(this.getName());
resultSaver.setComment(this.getComment());
resultSaver.setEnabled(this.isEnabled());
resultSaver.setVariableName(this.getVariableName());
resultSaver.setFilename(this.getFileName());
resultSaver.setProperty(TestElement.TEST_CLASS, ResultSaver.class.getName());
resultSaver.setProperty(TestElement.GUI_CLASS, ResultSaverGui.class.getName());
return resultSaver;
}
}
ResultSaver resultSaver = new MySaveResponseToFileBuilder().setName("Save Response to File").setFileName("/tmp/jmeter/${__samplerName()}").build();