jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Barrie Treloar <>
Subject Re: V2.5 - Additional arguments not kept in JavaSamplers
Date Fri, 19 Aug 2011 06:14:44 GMT
On Fri, Aug 19, 2011 at 12:26 PM, Heinz Drews <> wrote:
> Hi Sebb,
> the version I'm using preserves the arguments, it shows V2.4 R961953.
> I have own JavaSamplers, which method I have to overwrite to get the
> arguments in V 2.5 also?

I'm using v2.4 r961953 too and it definitely deletes these unspecified
parameters since Sebb answered essentially the same question that you
raised when I asked it.
I've squirreled into the code to see why.

You need to specify

which returns a map of key/value pairs in the arguments result.
  public Arguments getDefaultParameters() {
    Arguments arguments = new Arguments();
    arguments.addArgument(PARAMETER_REMOTE_HOST, "${REMOTE_HOST}");
    arguments.addArgument(PARAMETER_TIMEOUT, "${TIMEOUT}");
    arguments.addArgument(PARAMETER_LOCAL_PORT_BASE, "${LOCAL_PORT_BASE}");
    return arguments;

I recommend specifying a default value which is a variable for each
parameter so that you can override values easily by using a User
Defined Variables.
e.g. if you have a parameter called "URL" then the default value is "${URL}".
We also define a public constant call PARAMETER_URL in the class and
document in the class javadoc all the Parameters, what they are for
and what you should be setting them to.

Often these parameters are either global to the test plan - in which
case you dont want to be specifying them in every JavaSampler,
or they are loaded from a CVS file - in which case they get put into a
variable name which conveniently your JavaSampler has already
configured to match your CVS variables.

When you are in JMeter test plan writing mode a dummy instance of your
Java class is created to pull out the arguments in
Its a known defect that the configuration screen for JavaSamplers have
"add" and "delete" buttons.  They are meant to be deleted one day...
When you edit the values of the JavaSampler configuration only those
entries whose keys match the keys getDefaultParameters get stored in
the *.jmx file - which is why it looks like they disappear.

When JMeter is invoking the test plan that's when your JavaSampler's
  public SampleResult runTest(JavaSamplerContext context) {
gets called.
You then pull out the values previously set via
to do whatever you want.

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

View raw message