Welcome to 16892 Developer Community-Open, Learning,Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I am using jmeter. I tried two options to pass the token( which needs to be run just once during the performance test) from one request to another. option 1 -I created two thread groups and used intercommunication thread post processor and thread process as you can see from the screenshot. The second concurrency thread group is just run once which needs to run at 1 rps for certain time initially( later this would be modified)

Option-2- I have one thread group which has a token request as once in a controller and post API request but the token request is not just run once it's been run multiple times during the test. please see the attached screenshot.

I have not tried the option of using a preprocessor and setting the token as property and getting the property value. is this a viable option or am I missing anything from option 1 why the second thread in option 1 is not running more than once?

option 1 test plan: https://i.stack.imgur.com/9Se4l.png result tree of option 1 -where post request is run once- https://i.stack.imgur.com/ESx3J.png once in a controller option 2: https://i.stack.imgur.com/MROok.png


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
4.1k views
Welcome To Ask or Share your Answers For Others

1 Answer

  1. Option 1: most probably your Post MPRequest is run only once because it "waits" for the next token, I think you should be reading this token only once instead of trying to do this before each request
  2. Option 2: you're seeing more than one Token Request because you're using more than one thread (virtual user), Once Only Controller's children are executed only once (during the first Thread Group iteration) per thread/virtual user

If you want to get the token only once and share it across all threads (virtual users) - you need to:

  1. Do it in a setUp Thread Group with 1 user and 1 loop
  2. Once you get the token use __setProperty() function to convert JMeter Variable holding the token into a JMeter Property
  3. In your main thread group use __P() function to read the token value

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to 16892 Developer Community-Open, Learning and Share
...