Jmeter, User Defined Variable doesn't recognized when do remote test

1k views Asked by At

My Jmeter test scripts is very simple like below

Thread Group
   - User Defined Variable
       : log_prefix="test"
   - HttpRequest
       : host=www.abc.com, path=/
   - SummaryReport
       : filename = ${log_prefix}_my.log

Local test is everything OK, but remote test is a little weird.

I expected to get "test_my.log" file but SummaryReport create "${log_prefix}_my.log" file in the 'bin' directory.

I think User Defined Variable doesn't affects to Listener(Summary Report) when doing remote test. what is the problem??

1

There are 1 answers

1
Dmitri T On

Don't use listeners for anything but tests development and/or debugging. You can get all the necessary information from .jtl results file after your test is finished, there is no need for having listeners enabled during the test run.

If for some reason you cannot live without this setting you can use __P() function as a workaround.

  • Define log_prefix in user.properties file (located in the "bin" folder of your JMeter installation) like:

    log_prefix=test
    

    Alternative way of setting it is passing the log_prefix property value via -G command-line argument like:

    jmeter -Glog_prefix=test -n -t test.jmx -r slave1, slave2 -l result.jtl
    
  • Change your listener to use the property instead of the variable like:

    ${__P(log_prefix,)}_my.log
    
  • That's it, JMeter should replace the function definition with the log_prefix property value.

References: