Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Here is the way of implementing this via <a href="http://blazemeter.com/blog/jmeter-using-functions" rel="nofollow">JMeter __Beanshell function</a></p> <p>Assuming that you're having following logic for generating custom header:</p> <pre><code>package custom.header; public class HttpPwd { public static String getPwd() { return String.valueOf(System.currentTimeMillis()); } } </code></pre> <p>Which is accessible from some jar called "customheader.jar"</p> <p>And you want to add a header named "MyHeader" to your request</p> <ol> <li>Put customheader.jat to lib/ext folder of your jmeter installation. (or to location under search_paths or user.classpath if you have overriden these properties in your user.properties file)</li> <li>Create a Thread Group</li> <li>Add i.e. HTTP Request to Thread Group</li> <li>In HTTP Request put Server Name or IP to be i.e. "google.com", Path - /, and add a parameter "q" with a value of "test". Actually it doesn't matter. </li> <li>Add HTTP Header Manager AS A CHILD of HTTP Request</li> <li>Add Name as MyHeader and Value - "${__BeanShell(import custom.header.*;HttpPwd.getPwd();)}"</li> <li>Add View Results Tree listener after HTTP Request</li> <li>Save and run</li> </ol> <p>You should see something like:</p> <pre><code>GET http://www.google.com/?q=test [no cookies] Request Headers: Connection: keep-alive MyHeader: 1382360571781 Host: www.google.com User-Agent: Apache-HttpClient/4.2.3 (java 1.5) </code></pre> <p>Mention MyHeader presense and value</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload