Monday, September 7, 2020

Jmeter Controllers - Once Only Controller

This is second controller in Jmeter Controllers series. If you don't read the first post in this series, I would suggest you to read it here.

2. Only Once Controller

As the name suggested, the samplers placed under this controller will be executed only once and that too in the first iteration.

This will be useful when you want to login only once in the system and do the business process through out the load test. In this occasion, you just need to place login sampler under this Only Once Controller. This is similar to vuser_init() and vuser_end() in Loadrunner.

NOTEOnce Only Logic Controller tells JMeter to process the controller(s) inside it only once per Thread.

Let us see the practical example. I have 3 HTTP samplers named (LIST USERS, CREATE and SINGLE USER) and I placed CREATE sampler under Only Once Controller. Refer below.


I am going to iterate the test plan 5 times with 1 thread. Let us see the outcome.

As shown in the above snapshot, CREATE sampler is executed in the first iteration and haven't executed from second iteration to fifth iteration.

Now, I am going to iterate the test plan 3 times with 2 threads. Let us see the outcome.


As shown in the above snapshots, CREATE sampler is executed twice (one for first thread and another one for second thread). This will clearly tells that Only Once Controller executes once per thread.

Simple. isn't it? 😀

No comments:

Post a Comment

Linux Series - SED Utility/Package - 4. Deleting Lines

Let’s explore sed’s explicit delete command, which you specify by using the option 'd'. Again, we are using the sample file named &#...