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:
CSV Data 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:
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:
- You run your test plan in GUI mode 1st time - it fails, but it sets the properties
- You run your test plan in GUI mode 2nd time - it passes but uses the last values of the properties
- etc.