reading part of request body from a file

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view

reading part of request body from a file

Leor Amikam

I am creating a set of soap/web service test cases where each case has an HTTP Request sampler.  There is common data in the request body used in the post.  For example:


What I am looking for, is a way to store these request fragments in a file, and load at runtime.  This is to avoid lots of redundant text between HTTP request calls.  Is there a way to do this?


Notice:  This e-mail and any attachments are confidential and may contain legally privileged information and/or copyright material of Hansen Technologies Limited or third parties.  Copying, distributing, disclosing, commercialising or otherwise acting in reliance on this e-mail and any attachments is strictly prohibited unless you are the addressee of this e-mail and have written permission to do so.  If you have received this e-mail in error please delete this e-mail (including any copies and attachments) and contact Hansen Technologies Limited by return e-mail or by telephone on + 61 3 9840 3000.  Any views expressed in this e-mail are those of the individual sender and may not necessarily reflect the views of or be a commitment by the organisation, except where the individual sender has the authority and expressly states them to be so.
Reply | Threaded
Open this post in threaded view

Re: reading part of request body from a file
It is, take a look at  __FileToString() function
<>   which
you can use directly in the HTTP Request sampler "Body Data" tab where it is
required to add this header.

Given you have nested functions inside the payload you will also need to
wrap it into  __eval() function
<>   so they would
be evaluated in the runtime

> ${__eval(${__FileToString(/path/to/your/file,,)})}  

More information:  Here’s What to Do to Combine Multiple JMeter Variables

Sent from:

To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]