You can read my post about jmeter downloading and installation before learning jmeter once only controller. I hope you already knows that Apache jmeter is load or i can say performance testing tool and during software performance testing, you need to handle multiple kind of scenarios and
conditions. For that Apache jmeter has many tools like Logic Controllers, Timers, Preprocessors etc. Once Only Controller is one of the Logic Controller.Now let us see when to use once only controller in jmeter. During your software application's performance testing, you will face scenario like - user should login in to application only 1 time and then he should access inner pages(after login pages) 2 or more than 2 times. How will you do this? Now Once Only Controller will comes in to picture. You can handle this scenario using jmeter once only controller.
Let we look at simple example script. I recorded jmeter testing script for login, View My Account Page and then view My Orders Page. Then added Once Only Controller under thread group and moved login page request inside once only controller. You can read, how to add controller, how to move requests and hot to add listener in my previous post. Then set Number of Threads (users) = 2 and Loop Count = 3 in your thread groups. Now your Apache jmeter load testing script will looks like bellow.
Now run above given example script and run it and look at results on View Results Tree. It will looks like bellow.
As shown in above image,
- Login page request is executed only 2 times because we set 2 users in thread group so 1 time for each user.
- Remaining both requests are executed 6 times each because we set Threads (users) = 2 and Loop Count = 3 in thread group so 3 time for each user.
- So conclusion is - requests under Once Only Controller will be executed only once per user without considering loops.
You can experiment same jmeter once only controller scenario for your on test software application to get better idea.
No comments:
Post a Comment