Skip to content

Sending JMeter variables

Anthony Gauthier edited this page Sep 9, 2019 · 4 revisions

There are two ways this plugin allows you to send JMeter variables through to your ElasticSearch index. The reason why there are two ways of doing this is due to JMeter's internal behaviour. The way the Backend Listener is instantiated makes so it doesn't have access to the variables set during test execution. Therefore, variables loaded before the Backend Listener's instantiation will be accessible (Test Plan, CSV from jp@gc) but not variables set with a post-processor for example.

Our way of working around this is by adding the possibility to send the variables through request headers. That way, the plugin will parse the headers and retrieve the variables 😄 ! (Thanks for the idea @cprevot04)

Custom Fields

Custom fields are fields that you add to the listener's configuration. See the picture below: Listener's configuration

CSV (loaded through the jp@gc CSV plugin)

Let's say I have a variable CSV file that's loaded through the jp@gc plugin, all I'd have to do is add a field to the listener with a name that doesn't contain "es." and specify the variable in the value column. So let's say I added the field test with the value 1, I'd be able to see the key/value pair in the document inside my index in the ElasticSearch engine. CSV from jp@gc

Test Plan variables

Same thing as the CSV, but just declare your variables in the Test Plan element like so: Test Plan Element Config

Request Header

The plugin will look for headers starting with X-es-backend. If the header's name starts with that value, it will use the rest of the header's name as the key and will use the value after the colon as the value! As simple as that!

See here for an example: Header configuration

You would then see the following in your index: test-variable: hola variable-test: aloh