In our last post we saw creating a Simple HTTP Request plan in JMeter
, where we just created a HTTP Request Default with some HTTP Request and Listeners. But we did not used any kind of
- Logic Controllers (Looping, Conditions)
- Assertion Validations etc
In this post, we are going to deal with little advanced JMeter Test Plan.
Here is our test plan
|Number of Users
|No of times Iteration/User
|Page Request Criteria per User
As you can see from the above test plan, we have additional items like Assertions and Page request criteria per user.
Creating Test Plan
Let’s first understand what kind of Assertions and page request criteria/user we are going to create in this test plan.
We are going to add Response Assertion (Assertion component) and Duration Assertion for certain request, here Response Assertion
is used to check if the page response has certain expected value, whereas Duration Assertion
is to tell whether the given page loads within expected time frame.
Page Request Criteria per user
We have a criteria here that, we need to execute home page only once
for a given user, but need to execute all other subsequent request for 5 times.
Which means, we need to create Logic controllers.
Let’s start creating the plan, but here I am not going to go each and every aspect one by one, rather I can show the complete detail in one shot as shown below
Let’s start exploring the above plan in detail.
The purpose of Loop Controller (Logic Controller) is to loop single or multiple requests for given amount of time.
As we have the criteria to execute all request (except home page) for 5 times
, I am adding a Loop Controller, with Loop count as 5.
Once Only Controller
The purpose of Once only controller is to execute any given request ONLY ONCE
even if it is under a loop controller, which satisfies our criteria of home page.
I am checking the download page if its title has Download in the page using Response Assertion as shown below
I wanted to check if the download page is loading with certain time frame as shown below
I would like to see the result of all the Assertions I have added in the pages, hence we need to add Assertion Result Listener.
Finally lets execute the test and check the reports for the two new criteria we added in our Test plan
As you can see above there was no problem with Response assertion, since the title was download, but the Duration assertion failed in 4 request except only one request as highlighted above, which means the page loading time is slow than we expected.
Page Request Criteria per user
We need to execute all page 5 times except home page, lets see that in View Result Tree Listener as shown below
As you can see above, home page executed only once, but all other requests executed for 5 times. Note that Docs request passed only once and failed 4 times due to Duration Assertion failure, which is also listed in the view result tree.
I tried to put the Loop controller within Simple Controller
and tried to execute the same test (Since as we know simple controller is just to group multiple requests of same type) but the end result was astonishing, the loop controller was not working within Simple controller,
instead of executing requests for 5 times, it executed only once.
You can download the above JMeter Test plan from here
Please leave your comments and thanks for reading !!!