0
votes

In JMeter, my HTTP Request performs a POST of a JSON-formmated body data. Within that request, I have a Listener (Save Responses to a File) to save the response. see image: Listener: Save Resonses

I need to post this response within a 2nd HTTP Request, so I created a Config Element (CSV Data Set Config) containing the basename as follows: see image: Config Element: CSV Data Set Config

In the 2nd HTTP Request, I added the following to the Body Data with the hope of posting the contents of the saved file as the body of this second request.

 ${__FileToString(/Users/C13018/Documents/results/${__eval(${JSON_FILE})}.json,,)}

When I run it, I get a Stop Thread Exception caused by "... file 'EOF'.json does not exist."

If I change this to the following using the hard-coded filename, it works.

 ${__FileToString(C:/Users/C13018/Documents/results/${__eval(RecordTest_1)}.json,,)}

Any idea why?

1

1 Answers

0
votes

SOLVED

I guess I was taking some of the examples provided by others "too literally". The correct payload body needed to be

${__FileToString(${__eval(${JSON_FILE})},,)}

Additionally, I removed the CVS controller element because it was no longer needed after correctly fixing the HTTP body to use the Variable Name (newRecordFile) defined in the Listener.