Reputation: 11
What is purpose to use setup threadgroup and teardown threagroup in Jmeter? Please explain same with example.
I know why we use thread groups and also aware of fact that setup is for pre activities like creating user and monitoring purpose but not sure with an incident where can i use it. same with tear down.
Upvotes: 1
Views: 5827
Reputation: 21
correct me as i'm probably wrong, but a setUp
thread cannot be used to store variables for use on the test threads (that i can see). any variables that i use in the setUp are never available. however, i found that if i use a beanshell and convert the variable in the setUp thread to a property like this
${__setProperty(userToken, ${userToken})};
then on each test thread i either use the property directly like:
${__property(userToken)}
or at the top of my thread i convert the property back into a variable like:
vars.put("userToken","${__property(userToken)}")
however, this seems a bit long winded and it would be great if there was a way to set up variables in the setUP to be used on every thread.
Upvotes: 2
Reputation: 1
A special type of ThreadGroup that can be utilized to perform Pre-Test/ Post-Test Actions.The behavior of these threads is exactly like a normal Thread Group element. The difference is that these type of threads execute before/after the test has finished executing its regular Thread Groups.enter image description here
Upvotes: 0
Reputation: 11426
It sounds like you have pretty much figured it out already, but let me give you a few examples of when I've used it.
setup:
teardown:
Upvotes: 2