Home > Net >  Access CSV Data Set Config variables in backend listener
Access CSV Data Set Config variables in backend listener

Time:10-20

I'm trying to fetch my variables from CSV Data config and add them to my backend listener in a distributed testing environment like this. FYI, it works on my local machine.

Here is my test plan:

Test Plan

CSV Data Config:

CSV config

My csv looks like this:

SELECT count(*) FROM github_events;simpleQuery
SELECT count(*) FROM github_events;medium
SELECT count(*) FROM github_events;complexQuery
SELECT count(*) FROM github_events;simpleQuery

Backend Listener:

Backend Listener

I'm setting the CSV config variables in the beanshell pre-processor like this:

props.put("query", "${QUERY}");
props.put("query_type", "${QUERY_TYPE}");

and that's why I have the ${__P(query)} ${__P(query_type)} in the backend listener.

The goal is to grab the QUERY and QUERY_TYPE from the CSV data config and send it to the backend listener.

Any help would be appreciated. Let me know if I need to add more info on here. Thank you!

CodePudding user response:

I don't think you can, as per JMeter 5.4.1 all fields of the Backend Listener are being populated in "testStarted" phase

the same applies to your custom listener

it means that JMeter Variables originating from the CSV Data Set Config don't exist at the time the Backend Listener is being initialized and your reference to JMeter Properties returns the default value of 1 as there are no such variables.

If you're looking for the possibility to dynamically send metrics to Azure you will need to replicate the code from the Azure Backend Listener in JSR223 Listener using Groovy language.


The only way how this could work on your local machine is that:

  1. You run your test plan in GUI mode 1st time - it fails, but it sets the properties
  2. You run your test plan in GUI mode 2nd time - it passes but uses the last values of the properties
  3. etc.
  • Related