Set up and tear down thread groups in jmeter

Set up thread group-run before actual thread groups .used to set up pre-test conditions or environment set up etc. All the tests needed to set up the test like creating variables,intilialising an object or creating a connection to a database are done by set up thread group.

Tear-Down thread Group-Will run at the end of other threads. Tear down thread group is used to clear the memory or destroy a connection to a database at the end of test.

We make a new TestPlan and two different thread groups to it named Thread Group A and B.In each thread group we add a http request sampler ,each going to a different website.We then add a set up thread and tear down thread as well.

In both set-up thread and tear-down thread we can add a http request sampler and these samplers go to different websites.

Then we add a view result tree at the test plan level and when we see the results we see first the sampler in set-up thread will execute then samplers in thread A and B and finally the sampler in tear-down thread group will be executed.

Also note that after adding set-up and tear down thread group no matter if we run the the other thread groups consecutively or not the set-up and tear down threads will run in the beginning and end respectively.