Reputation: 179
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, <
and >
are being populated in the data respectively.
Sample below:
<imp1:Name/>
<imp1:Pay>515255413</imp1:Pay>
<imp1:CCLast>6380</imp1:CCLast>
<imp1:CCType>VISA</imp1:CCType>
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.
Upvotes: 3
Views: 9738
Reputation: 1
I used Jmeter 5.4.3 and simple data writer with adressing variable. The hint is that you can't directly use variable in the simple data writer filename. So if you use javascript function of variable like ${date}.jtl, you will receive the same hardcoded name with curly brackets. What you need to do is to add some symbols here before variable: test results\res${date}.jtl In User defined variables I defined ${date} as ${__time(ddMMMyyyy_HHmm,)}
Upvotes: 0
Reputation: 23657
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.
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.
Upvotes: 1