How to synchronize JMeter Thread groups - jmeter

I fill the database with JMeter. There is 2 thread groups which fill 2 tables in parallel.
After these 2 tables filled I need to start the last thread group to fill the third table.
How can I do it?
Is it possible to synchronize JMeter Thread groups?

You could do a while controller for the third thread group, and do something like this:
ThreadGroup 1
- Code to fill Table 1
- Set a UserDefined Variable "Group1_done==true" as the last step
ThreadGroup 2
- Code to fill Table 2
- Set a UserDefined Variable "Group2_done==true" as the last step
ThreadGroup 3
- WHILE CONTROLLER "Group1_done==true"&&"Group2_done==true"
- Code to fill Table 3

Related

Test execution using N Threads and N2 Loops

Jmeter executed the following test using only one thread Thread group 1: Thread Group
In this test there are the following Thread group properties: Thread Group properties
Loop controller configuration: Loop Controller
Accoring to this scenario, Http request GET CustomerDataUpdate should be executed simultaneously using N (50) threads, for each call taking new customer ID from a CSV file (CSV Data Set Config Customers) and Http requests POST StockUpdate and GET PricesUpdate should be executed in parallel in a loop for each Customer N2 (50) times, taking new product ID from a CSV file (CSV Data Set Config Products).
Why my test is executing all the steps only using Thread Group 1 (as shown below) ? Thread Names
I am expecting this test to be executed using N (50) Threads simultaneously for N unique Customers and N2 (50) unique Products for each Customer, getting Customer ID and product ID from a CSV files.
What your test does is:
50 threads and 50 loops in the Thread Group mean that CustomerDataUpdate will be executed 2500 times
After executing the CustomerDataUpdate each thread will execute StockUpdate and PricesUpdate 50 times each due to the Loop Controller
In total you will have:
CustomerDataUpdate - 2500 times
POST StockUpdate - 125000 times
GET PricesUpdate - 125000 times
Neither CustomerDataUpdate nor StockUpdate will not be concurrent as Parallel Controller is executing its children in parallel, are you looking for the Synchronizing Timer?

How do i read the contents of a csv file specific number of times in JMeter?

I have a csv file that has 100 rows. How do i read this file 2 times (2 * 100) and then stop the flow? I used Loop controller and gave loop count 100 and the loop count in main thread group is 2. Its working good when iam running the test with 1 thread but when i update the number of threads to 10 then the total number of requests are 2000. How do i make my test run only 2 times (iterate my csv file only 2 times with number of threads = 10). Any help is appreciated.enter image description here
enter image description here
enter image description here
If you're using default CSV Data Set Config settings when it comes to "Sharing Mode" (each user will read next row on each iteration)
Remove your Loop Controller
Amend your Thread Group configuration to have 20 loops:
In this case you will have 200 total requests, each line from the CSV file will be hit twice:

Is it possible to allocate certain rows of data per thread in JMeter?

Can we achieve something like blocks in LR (as shown below) in JMeter, where if I have 100 rows of data, and I am running with 10 users, I want 1st user to pick data only from 1-10 rows, 2nd to pick only for 11 -20 rows, 3rd thread to pick 21-30, and so does 10th thread from 91-100 rows irrespective of no of iterations each thread does?
As of JMeter 5.3 it's not possible using built-in configuration elements. I'm not aware of any plugins implementing this feature as well.
The only workaround I can think of is using Counter config element and __groovy() function combination.
For example if you configure the Counter like:
You should be able to get the line from the CSV file according to your scenario with the following __groovy() function:
${__groovy(new File('test.csv').readLines().get(ctx.getThreadNum() * 10 + (vars.get('counter') as int)),)}
Demo:

Ordering of Jmeter Thread Groups

I have a setup like this,
Test Plan =>Execute Threads in Parallel
-THread Group 1
-THread Group 2
-THread Group 3
-THread Group 4
-THread Group 5
I want 1,2 and 5 to execute in parallel. 3 has to start after 1 finishes and 4 has to start after 2 has finished. How can I create such inter dependency in the execution order?
Use Transaction controller or simple controller to execute one after the other.
Implement the logic in the Thread Groups in Simple Controllers. Let's name them SimpleController 1 ... SimpleController 5.
In the TestPlan choose parallel execution of thread groups. Create three Thread Groups A, B and C.
Thread Group A has Simple Controller 1 and 3
Thread Group B has Simple Controller 2 and 4
Thread Group C has Simple Controller 5
The above arrangement would achieve your dependency requirements.

Multiple group by for dataset query

I am currently working on report generation using BIRT Tool. consider the table below,
TaskId Status SLAMiss
----------------------------------------------------------
1 Completed Yes
2 In Progress No
3 Completed No
I need to create a table which shows the count of Completed ,In progress tasks along with the count SLA missed tasks like below,
Tasks Completed Tasks InProgress SLA Adherence SLA Miss
---------------------------------------------------------------------------
2 1 2 1
Now i need to create the dataset using sql query. For the first two columns i have to group by 'Status'. And for the last two columns i have to group by 'SLA Miss'. So,
1.Is it possible to achieve this using a single dataset?
2.If yes what will be the sql query for the dataset?
3.If not, I can create 4 dataset's for each column and apply that to the table.
Will that be a good idea?
Thanks in advance.
The easiset way to do this is use computed columns. You would use some JavaScript like the following in a new colum named "CompletedCount" as Interger. Then when you build your report you sum the values with an "Aggregation" item from the palette.
if (row["Status"] == "Completed" )
{
"1"
}else{
"0"}

Resources