Class ResponseFileSaver
- java.lang.Object
-
- us.abstracta.jmeter.javadsl.core.testelements.BaseTestElement
-
- us.abstracta.jmeter.javadsl.core.listeners.BaseListener
-
- us.abstracta.jmeter.javadsl.core.listeners.ResponseFileSaver
-
- All Implemented Interfaces:
DslTestElement,DslTestPlan.TestPlanChild,DslListener,BaseSampler.SamplerChild,MultiLevelTestElement,BaseThreadGroup.ThreadGroupChild
public class ResponseFileSaver extends BaseListener
Generates one file for each response of a sample/request.This element is dependant of the scope: this means that if you add it at test plan level it will generate files for all samplers in test plan, if added at thread group level then it will generate files for samplers only in the thread group, and if you add it at sampler level it will generate files only for the associated sampler.
By default, it will generate one file for each response using the given (which might include the directory location) prefix to create the files and adding an incremental number and an extension according to the response mime type.
Eg:
will generate files like "responses/resp1.json".responseFileSaver("responses/resp")Both the incremental number and the file extension can be disabled setting
autoNumber(boolean)andautoFileExtension(boolean)to false.- Since:
- 0.13
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classResponseFileSaver.CodeBuilder
-
Field Summary
Fields Modifier and Type Field Description protected booleanautoFileExtensionprotected booleanautoNumberprotected StringfileNamePrefix-
Fields inherited from class us.abstracta.jmeter.javadsl.core.testelements.BaseTestElement
guiClass, name
-
-
Constructor Summary
Constructors Constructor Description ResponseFileSaver(String fileNamePrefix)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ResponseFileSaverautoFileExtension(boolean autoFileExtension)Specifies whether, or not, to append an automatic file extension to the file name.ResponseFileSaverautoNumber(boolean autoNumber)Specifies whether, or not, to append an auto incremental number to each generated response file name.protected org.apache.jmeter.testelement.TestElementbuildTestElement()-
Methods inherited from class us.abstracta.jmeter.javadsl.core.testelements.BaseTestElement
buildConfiguredTestElement, buildTestElementGui, buildTreeUnder, configureTestElement, durationToSeconds, loadBeanProperties, showAndWaitFrameWith, showFrameWith, showInGui, showTestElementGui
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface us.abstracta.jmeter.javadsl.core.DslTestElement
buildTreeUnder, showInGui
-
-
-
-
Field Detail
-
fileNamePrefix
protected String fileNamePrefix
-
autoNumber
protected boolean autoNumber
-
autoFileExtension
protected boolean autoFileExtension
-
-
Constructor Detail
-
ResponseFileSaver
public ResponseFileSaver(String fileNamePrefix)
-
-
Method Detail
-
buildTestElement
protected org.apache.jmeter.testelement.TestElement buildTestElement()
- Specified by:
buildTestElementin classBaseTestElement
-
autoNumber
public ResponseFileSaver autoNumber(boolean autoNumber)
Specifies whether, or not, to append an auto incremental number to each generated response file name.WARNING: if you disable this feature you might not get the files for all generated responses (due to potential file name collision and file rewrite). Consider using some jmeter expression in file name to avoid file name collisions and overrides (eg: "responses/${__threadNum}-${__jm__Thread Group__idx}").
- Parameters:
autoNumber- specifies to add the auto incremental numbers to the file when set to true. By default, this is set to true.- Returns:
- the ResponseFileSaver for further configuration or usage.
- Since:
- 1.27
-
autoFileExtension
public ResponseFileSaver autoFileExtension(boolean autoFileExtension)
Specifies whether, or not, to append an automatic file extension to the file name.The automatic file extension is solved according to the response MIME type.
- Parameters:
autoFileExtension- specifies to use the automatic file type extension when set to true. By default, is set ti true.- Returns:
- the ResponseFileSaver for further configuration or usage.
- Since:
- 1.27
-
-