0

How can I set a Jmeter variable value in to a Linux System or environment variable?

I need to set a value I extract in my jmeter script in to a system variable to use it later in a different script.

Is this supported or if not please provide me an alternative method.

Thanks

Ushani
  • 1,199
  • 12
  • 28

1 Answers1

0
  1. If this is a variable having single value across all threads (virtual users) - go for OS Process Sampler configured like:

    JMeter Add Linux Variable.

    It will add your variable to .bash_profile file so it will be available to the current session and for this user on next login. See How to Run External Commands and Programs Locally and Remotely from JMeter article for more information if needed.

  2. If there could be multiple values the best option would be using Sample Variables property. Add the next line to user.properties file:

    sample_variables=foo
    

    And when you run your test next time it will generate an extra column in the .jtl results file holding your variable value which you should be able to use with i.e. CSV Data Set Config


Replace foo with your actual JMeter Variable reference name if you stick to one of the above options

Dmitri T
  • 159,985
  • 5
  • 83
  • 133