Is it possible to load some extra http request parameters from a file in jmeter? My use case is that the filter query parameters I'm sending to SOLR all have exactly same name, but different value:
fq=Field1:Value1&fq=Field2:Value2&fq=Field3:Value3
The bean shell script so far is:
String line = vars.get("facets");
if(line != null) {
StringTokenizer st = new StringTokenizer(line, ",");
while (st.hasMoreTokens()) {
String filterQ = st.nextToken();
String varname = "fq";
vars.put(varname,filterQ);
}
}
Since vars is a "hash map"-like data structure with unique keys it is not an option for supplying many fq parameters in the same go.
I was thinking of using a file with these fq parameters, but does anybody know how to make them attach to the existing http parameters configured in the HTTP Request element?
Upd. Summarizing the answer below, here is what I did:
added the BeanShell PreProcessor as a child of HttpRequest
changed the above code to:
String line = vars.get("facets");
if(line != null) { StringTokenizer st = new StringTokenizer(line, ",");
while (st.hasMoreTokens()) { String filterQ = st.nextToken(); // add fq parameter and its value to the http request body String paramName = "fq"; ctx.getCurrentSampler().addArgument(paramName, filterQ); }}