SUBSCRIBE HERE TO GET POST UPDATES VIA EMAIL :

Delivered by FeedBurner

Jmeter - Using Duration Assertion With Example

Duration assertion is used to assert the response time of request in jmeter software load test plan. It will assert that response of request is received within given amount of time or not. If response of request is received in given amount of time then it will be pass and if it exceeds given amount of time then it will be fail. Let's learn how to use duration assertion in jmeter software load test plan.

Add Duration Assertion In Software Load Test Plan
You can add duration assertion parallel to request or under request of your software load test plan. To add it under request,
  • Right click on request -> Add -> Select Assertions -> Duration Assertion. Please look in to the bellow given image.

It will add duration assertion under selected request.

Example : Assert Response Time of Request Using Duration Assertion
I have prepared simple example to tech you use of  duration assertion in jmeter software load test plan. Test plan config is as bellow.
  • I have added 2 HTTP request.
  • Under each request, Added Duration Assertion and Assertion Results.
  • 1st request's Duration Assertion : Set Duration in milliseconds = 200
  • 2nd request's Duration Assertion : Set Duration in milliseconds = 5000
  • Thread Group Config : Number of Threads = 1, Ramp up period = 1, Loop count = 1.
  • Added view result in tree listener under thread group.

You can see that duration in milliseconds = 200 for 1st duration assertion and duration in milliseconds = 5000 for 2nd duration assertion.

Now when you run above sample software load test plan, result of 1st duration assertion will looks like bellow.


You can see in result that request has taken 1274 milliseconds to complete which is greater than expected 200 milliseconds so assertion is failed. 2nd assertion is pass as we set duration in milliseconds = 5000.

This way you can use duration assertion in your software load test plan to assert time duration of request.

No comments:

Post a Comment