简体   繁体   中英

Add a Variable to JMeter Pre/Post Processor and Use it on If Controller

I am trying to run 5 Thread Groups.

  1. CreateAssets (This thread group creates assets)
  2. SearchAssets (This thread group searches for assets continuously created before till all get available)
  3. UpdateAssets (This thread group updates the assets which created before)
  4. SearchUpdatedAssets (This thread group searches for updated assets continuously till all get available)
  5. DeleteAssets

How I wants this to work is,

  • Run 1 and 2 Threads Parrallaly.
  • Once 1 and 2 is done, Start 3 and 4 Threads Parralally.
  • Once 3 and 4 is done, Run Thread 5.

So far what I thought was to add if controller into thread 3 and 4, set a flag on the top threads and set that flag true once thread 1 and 2 are done, and add that condition to if controller .

Really appreciate if anyone can help me with this.

Thanks in advance.

You can use your flag concept to deal with this issue. Just you need to communicate with all thread groups. To communicate between thread groups, you can use below method:

props.put("var","value"); // set property in 1st thread group

props.get("var"); // get property in 2nd thread group

Alternatively you can user "Inter-Thread Communication" plugins in JMeter.

This is not something you can do, at Test Plan level you have only 2 options:

  1. Run all Thread Groups sequentially
  2. Run all Thread Groups in parallel

在此处输入图像描述

So it would be easier to go for ie Parallel Controller so you would have only one Thread Group and 5 Samplers organised like:

在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM