2

I try to create a scenario that I put a user defined delay in my test.

  1. In the start of the test I created JSR sampler and created a variable called vertica_results_delay and put in it the value of 400000. Than I crated a timer and put ${vertica_results_delay}, since I want the delay will be configured in the start of the test, the problem is that Jmeter ignores my value, and not wait. If I used Use defined field and put vertica_results_delay = 4000 it worked, but than all the tests will get the same delay, I do not want to create hard coded delay. I want to enter all properties of the test in the start of the test using JSR.

    String vertica_results_delay = "400000"; vars.put("vertica_results_delay", vertica_results_delay); log.error("vertica_results_delay " + vertica_results_delay);

enter image description here enter image description here

enter image description here

enter image description here

Ori Marko
  • 56,308
  • 23
  • 131
  • 233
Bastian
  • 1,089
  • 7
  • 25
  • 74

2 Answers2

0

Check JMeter order of execution

  1. Configuration elements
  2. Pre-Processors
  3. Timers
  4. Sampler

Your sampler executed after Timer, you need to set it before,

Add JSR223 PreProcessor outside Thread Group with your code and the delay value will be set before Timer is executed.

Ori Marko
  • 56,308
  • 23
  • 131
  • 233
0

Timer is a scoped element which is executed before each sampler so what happens in your case is that :

  • JSR223 Sampler is executed after Timer

See:

To fix your issue, set your timers in a setup Thread Group, or if you only want to set it from outside of JMeter, just use function __P and pass values on command-line:

-Jkey=value

UBIK LOAD PACK
  • 33,980
  • 5
  • 71
  • 116