Table of content

Duration Assertion in JMeter

  • Duration assertion is used to verify how long a request takes to complete. The Duration measured in milliseconds, and, if any request lasts longer than the value specified, the sample is marked as failed.

The Following example Demonstrates the Duration Assertion

  • Launch the JMeter and then add a Thread Group to the Test Plan.
  • Next, right click on the Thread Group > Add >Sampler> HTTP Request.
    add-http-sampler-request-to-thraed-group-jmeter
  • Set Server Name as www.google.com inside the HTTP Request and path as/.
    adding-server-and-path-details-in-http-request-jmeter
  • Next, add Duration Assertion to the HTTP Request and enter the Duration in Milliseconds as 1500MS.
  • Next, add View Result Tree Listener and Assertion Result to the Thread Group to View the Result.
    add-view-result-tree-and-assertion-result-jmeter
  • Now, Save and run the Test Plan, if the HTTP Request which contains the google.com, if JMeter receives a response within the specified time1500 milliseconds then the result will be pass, else failed.
  • The Duration request has been passed successfully.
    request-has-been-passed-successfully-jmeter
  • Now, I am going to change the Duration in Milliseconds to 100ms
  • Now, if you run the test plan, you will receive the below result.
    duration-assertion-failed-jmeter
Comment / Suggestion Section
Point our Mistakes and Post Your Suggestions