I tried the multiple API hits on the server through Jmeter and save the result data in the file but some how I cant print the failure Message in the file, any body helps me how to print the failure message.?
2 Answers
I would suggest using a JSR223 post processor, where you will need to do a little scripting to get what you need to save as a CSV file. Here is basic pseudo-code to help with this.
//use PREV to get response data from previous sampler
prev.getResponseDataAsString()
//format this data (remove commas) and output to CSV file
outLog.write(csvResponse + "\n")
for an example in java, please see:
https://lobsterautomation.wordpress.com/2018/01/14/jsr223-tips-and-tricks-part-5/
failureMessage
in the .jtl results file is applicable only for Assertions, if you're looking for a way to create a custom file having only response message and response data the easiest way is going for Flexible File Writer, the basic configuration would look like:
You can install Flexible File Writer using JMeter Plugins Manager: