javajmeteryamltaurus

Passing a variable from Taurus yaml file to Jmeter script to switch JDBC connection


I currently have a jmeter script which I would like to switch it's jdbc connections in the script, by passing a variable at runtime through the taurus yaml.

The aim is to switch environment by setting the variable in the yaml.

Using the guide provided by Taurus, I created an environment variable under settings in the yaml file as follows:

settings: env: ENV_VARIABLE: randomvariabletest

Then using the variable, I call on that in the Jmeter script as follows

enter image description here

I want the JDBC request to then call the JDBC connection which I have named as randomvariabletest. I was expecting that the JDBC request would read the value which I passed in.

enter image description here

This doesn't work as expected as I am getting the following error:

java.lang.IllegalArgumentException: Variable Name must not be null in GET MAX ORDER ID

What am I doing wrong here, any help would be appreciated.


Solution

  • You're using wrong function, __P() function reads a JMeter Property and if you plan to use JMeter Properties for parameterization you need to follow this chapter

    If you plan to continue using environment variables you either need to: