Wrap your *|${requestBody}|* into __eval() function <https://jmeter.apache.org/usermanual/functions.html#__eval>, it will allow JMeter to resolve JMeter Functions and Variables <https://jmeter.apache.org/usermanual/functions.html> which are present as "placeholders" in the CSV file to their respective values.

|*${__eval(${requestBody})}* |

Also if you consider scripting to accomplish your requirements be informed that starting from JMeter 3.1 it's recommended to use JSR223 Test Elements and Groovy language <https://jmeter.apache.org/usermanual/best-practices.html#bsh_scripting>. More information: Apache Groovy: What Is Groovy Used For? <https://www.blazemeter.com/blog/apache-groovy>

On 7/26/2022 6:52 AM, ohaya wrote:
  I was able to get this woring by using a Beanshell pre-processor and some 
Java code that does var.get() and then Java String replaceall() and then 
var.put().


      On Monday, July 25, 2022, 11:29:41 PM EDT, ohaya<[email protected]>  wrote:
I tried using __evalVar:

https://am.net/lib/tools/NetworkManagement/apache-jmeter-2.8/printable_docs/usermanual/functions.html

where I had the following in the string from the CSV Data 
Config-element-requestBodies:

<Request ...>{name=${subjectDn}+...

But it looks like the __evalVar is NOT replacing the ${subjectDn} variable with 
the value from the CSV Data Config-element-subject: variables :(...

Jim


      On Monday, July 25, 2022, 10:55:10 PM EDT, ohaya<[email protected]>  wrote:
Hi,

In my JMeter test plan, I have two CSV Data Config elements.

- CSV Data Config-element-requestBodies: variables: requestBody

- CSV Data Config-element-subject: variables: subjectDn

The requestBody variable contains an XML request, with a placeholder string and 
I want to replace that placeholder with the contents of the subjectDn variable, 
and then use the modified requestBody variable in the HTTP Request element.  In 
other words:

1) Replace the placeholder string in the ${requestBody} with the value in the 
${subjectDn}, then

2) Use the ${requestBody} in the HTTP Request

How can I do that?  What is the easiest/least overhead way of doing that?

Thanks,
Jim




     

Reply via email to