6
votes

how to configure the thread group ramp up time with a jmeter variable, I tried for both number of threads and ramp up time. No of threads is working fine, but ramp up time takes the default value 1 and the variable value doesn't take effect, Appreciate any help

3
Hi , any feedback on answer? thxUBIK LOAD PACK

3 Answers

18
votes

You cannot use variables in Thread Group setting as Thread Groups are initialised during startup, before any variables are read.

If you need to make number of threads and/or ramp-up period configurable use __P() function like:

  • ${__P(threads,)}
  • ${__P(rampup,)}

Properties

Aforementioned threads and rampup properties can be defined in several ways:

  1. If you run JMeter in command-line non-GUI mode you can pass the properties via -J command line key as

    jmeter -Jthreads=50 -Jrampup=30 -n -t /path/to/your/testplan.jmx
    

    The same approach will work for GUI mode, however it is not recommended to use GUI for load test execution as it is quite resource consuming and may ruin your test.

  2. You can define these properties in user.properties file (located in /bin folder of your JMeter installation) as:

    threads=50
    rampup=30
    

    After restart JMeter will pick the properties up and you will be able to refer them via __P() function as described above.

See Apache JMeter Properties Customization Guide for comprehensive information on various JMeter properties and ways of working with them

2
votes

There is no reason why it works for # of threads but doesn't work for ramp-up time. I've been using configurable properties for both with success.

1 is the default value in JMeter if variable can't be resolved properly. You likely made a typo. To investigate the problem, you may want to use 'Property Display' element (right-click WorkBench / Add / Non-Test Element / Property Display).

If this doesn't help, please post link to the screenshot of thread group, and relevant part of your config where you define the ramp-up time variable.

EDIT : example

This is the way I usually work with configurable properties stored in external files (and it works for ramp-up as well):

  • define user defined variable on test plan level, e.g. someVarName is ${__P(someVarName)}
  • then use this var e.g. in ramp-up as ${someVarName}
1
votes

You cannot use variables for those values, only properties:

Properties are not the same as variables. Variables are local to a thread; properties are common to all threads, and need to be referenced using the __P or __property function.