Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use Jmeter's 'Simple Data Writer' to store data in dynamic filenames

Tags:

jmeter

Can anyone let me know how to use 'Simple Data Writer' in Jmeter to store data in dynamic file names?

I need to store request and response for each SOAP call processed from Jmeter in different files. I want to pass the variable name 'ABC' used in the jmeter as the file name. It is expected to create a folder with the date and create the file with value in 'ABC' variable and store the data I selected in the 'configure'

The 'Filename' that I have set under 'Simple Data Writer' is as:

C:\XXX\JMeter\\${__time(dd-MMM-Y)}\\${ABC}.xml

This setting is only creating the folder correctly, but the file name is being created as ${ABC}.xml instead of the value in ${ABC}

Also I see that the data is not being stored properly in xml format. Instead of populating < and > for XML Tags, &lt; and &gt; are being populated in the data respectively.

Sample below:

&lt;imp1:Name/&gt;
&lt;imp1:Pay&gt;515255413&lt;/imp1:Pay&gt;
&lt;imp1:CCLast&gt;6380&lt;/imp1:CCLast&gt;
&lt;imp1:CCType&gt;VISA&lt;/imp1:CCType&gt;

Any help will be much appreciated.

Note: I am able to resolve the file name issue by using 'Save Responses to a file' as it indeed is able to fetch the variable values and create the files correctly. But this does not provide me the Request for the SOAP call as it displays only the response which does not solve my cause.

like image 338
Maniram Avatar asked Dec 13 '25 22:12

Maniram


1 Answers

Jmeter Simple Data Writer does not do what you're looking for. The Simple Data Writer writes data, in CSV or XML format to a single file for an entire test. The data of each request/response is a separate line or XML block within the same file.

Since you're looking to write a new file per request/response, this is not possible with Simple Data Writer.

Variable in filename:

Looks like JMeter does not support using a variable for filename. (I'm unsure if this is by design or a bug) However properties works fine. You can convert the variable you want to use into a property using the __setProperty function and then use ${__P(propName)} in the filename textbox.

like image 85
RaGe Avatar answered Dec 16 '25 23:12

RaGe



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!