Search code examples
jmeterbeanshell

JMeter ordered execution


I am setting up a project for performance test a REST application. I need to create N records in a file (productName, category) and hit an endpoint to add them.

Under Test Plan, I created a ThreadGroup, Loop controller and beanshell sampler to create the file.

ThreadGroup 
-LoopController
--Beanshell Sampler

Add Product (ThreadGroup)
-Add Product (Http request)
--Http Header Manager
--CSV Data Set Config
-View Results in Table

I want to create N records before I want other ThreadGroup to start picking records but I am unable to figure it out how.


Solution

  • As far as I understand you just want to run the thread groups one by one, so in Test Plan there's an option you have to tick, and it's called 'Run Thread Groups consecutively' (click at the top of the tree on the left where you see Test Plan name and check its options on the bottom in main part of the window).

    The other approach that is far more better is to use 'setUp Thread Group' (Add -> Threads -> setUp Thread Group) to run the setup at the beginning and then the rest of the test from other Thread Groups in parallel.

    I hope it helps.