2

I've a thread group to run for 100+ users with-in that there is a need to execute a particular http request only once for all the threads. I know the "Once only Controller" but it execute the child samplers once per thread that is why it doesn't meet the requirement here:

As shown in the image: The "once only controller" run the request E & F only once for every thread where as I my requirement to run the sampler request E & F once only for all the threads A, B, C & D. having said that if i run the 100+ thread request E & F should run only 1 time.

Is there any way to achieve this in jmeter??

Problem ScreenShot:

enter image description here

Masud Jahan
  • 3,418
  • 2
  • 22
  • 35
S Thakur
  • 45
  • 1
  • 7
  • When do you want E & F to run ? – UBIK LOAD PACK Sep 26 '16 at 20:09
  • @UBIKLOADPACK I want E & F to be executed once all the http requests gets completed, i.e. if there are 100 threads for 99 thread it should skip the E & F but for 100th thread it should include E & F. – S Thakur Sep 27 '16 at 03:54

2 Answers2

2

There is no direct logic controller to achieve this. Usually this type of requirement should be part of setup or tear down thread group.

If it has to be part of your regular thread group, then it can be achieved by using some workaround. example:

Once Only Controller + If Controller:

If controller will execute E & F only if ${__threadNum} == 1. This way we can block other threads from executing E & F

vins
  • 15,030
  • 3
  • 36
  • 47
1

Put your requests E and F under the If Controller and use the following condition:

${__BeanShell(ctx.getThreadNum() == 0 && vars.getIteration() == 1)}

If Controller Example

Where:

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