jmeter-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Doornbosch <peter.doornbo...@gmail.com>
Subject add hooks to JMeter for websocket plugin
Date Sun, 17 Dec 2017 19:48:36 GMT
Hi,

In my JMeter websocket plugin (
https://bitbucket.org/pjtr/jmeter-websocket-samplers) I want to hide
advanced options for first time users. One of my design goals for this
plugin was to make it very easy to use, so that first-time users are
not overwhelmed with loads of options they don't know how to use and this
will only confuse them. Up till now, i think i succeeded (but of course
that's for others to judge ;-)).

However, i'm now at the point that i need to add functionality that will
only be used by advanced users. To keep the UI simple and clear for others,
these advanced options must be explicitly enabled. Currently, this is done
by setting a JMeter property. It works, but what i would like is that users
can simply enable this (and other) option(s) by adding a special Config
element in their test plan and enable/disable the options they want to use.
This keeps the settings (e.g. whether options are enabled or not) in the
testplan, which will avoid surprises when a testplan that relies on these
features is being loaded in a JMeter instance that doesn't have the
property set.

I've been experimenting with this approach and i'm pretty happy with it.
However, to make it work correctly, i need some extra hooks in JMeter.

The proposed changes explained below, are committed to my JMeter fork at
https://github.com/ptrd/jmeter/commits/more-hooks-for-testplan-modifications
.

Change 1
See
https://github.com/ptrd/jmeter/commit/a968db8bb63d16d6ea176ed00c074668958b7544
A "removed" method is added to TestElement, so a test element can react on
it being removed from the test plan.
I need this for the functionality explained above, because when the user
removes the special Configuration element that enables certain options,
these options must be disabled.

Change 2
See
https://github.com/ptrd/jmeter/commit/50e326ff824e231961308eed5185aeaf2d894f60
A "TestPlanListener" is added, and its "testPlanCleared" method is called
when the test plan is clear.
Similarly to change 1, when a testplan is closed and another one is loaded,
i need a hook to reset the state of the advanced options.
Of course, when included in JMeter, the TestPlanListener should probably be
extended with some other methods to make it a consistent interface; for now
i just wanted to create a working proof-of-concept.

If you're interested in how these additions are used in the plugin, please
see this branch:
https://bitbucket.org/pjtr/jmeter-websocket-samplers/commits/branch/configure-options-in-testplan
.

Actually, i need one more feature, namely that a config element can be
declared as "singleton" so it can't be added multiple times, but i haven't
developed code for that yet - will follow later.

I hope you are willing to add these hooks to JMeter, as, IMHO, these are
generic hooks that can be useful for others and other use cases as well.
For example, it has always frustrated me that the SSL keystore cannot be
configured in a testplan; which such additions as proposed here, i think
that would become possible too.
Of course, if you have any thoughts about how the proposed changes can be
improved, i'm happy to discuss it with you.

Kind regards,
Peter Doornbosch

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message