jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stephen Ash <>
Subject Dynamically enable/disable HTTP Request Defaults parameters
Date Thu, 02 Aug 2012 23:01:05 GMT
In the following test plan example, the HTTP Request Defaults element
is applied to all HTTP Samplers. Is there a way to modify that test
element dynamically during the test execution?

The use case is that each of the /foo, /bar, /baz requests can take an
optional request parameter. So both GET /foo and GET
/foo?verboseLogs=true would be valid requests. I was looking for a way
to pass in a property (-JoptionalParameters=true) to JMeter in order
turn on or off those arguments.

Test Plan
- HTTP Request Defaults
- Thread Group
-- HTTP Sampler (GET /foo)
-- HTTP Sampler (GET /bar)
-- HTTP Sampler (GET /baz)

A couple of things that I have tried so far without luck:
- Move the HTTP Request Defaults into the Thread Group and then
surround with an If Controller. This causes the HTTP Requests Defaults
to only be in the context of the If Controller now, and not propagated
up the If Controller's parent.
- Adding a BeanShell pre-processor to the Test Plan or Thread Group
that will get the ThreadGroup from the current context and add a new
Debug Sampler Element (would swap with ConfigTestElement later). That
probably won't work in general since the structure of the test is
already defined and not re-evaluated when I add the Test Element.

Some things that will work, but I would like to avoid since they are
not as sustainable:
- Split into two separate scripts/thread groups, one with and one
without the optional parameters.
- Pass in another JMeter property for the parameter's key. The HTTP
Requests Default would have an argument where name=${verboseKey} and
value=${verboseValue}. If I wanted the parameter, I would have to set
verboseKey="verboseLogs=" and verboseValue="true". This becomes hard
to manage with many parameters.

Any other ideas to try would be appreciated.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message