Pages

Monday, 30 January 2017

JMeter - Assertions - "Duration Assertion"

Duration Assertion is mainly used when we have response time NFR and on the basis of those figures, we want to make a sampler or transaction controller pass or fail. It is a simple assertion element where we just need to provide 'apply to' and 'duration' input.
How to add "Duration Assertion" element?
You can follow the below steps:
1. Select "Sampler" node whose response duration needs to be validated.
2. Right-click on the node
3. Mouse hovers "Add"
4. Mouse hovers "Assertions"
5. Click "Duration Assertions"

How to remove "Duration Assertion" element?
You can follow the below steps:
1. Select "Duration Assertion" node
2. Right click on "Duration Assertion" node
3. Click "Remove" (Mouse) or "Delete" button from the keyboard
4. Click "Yes"    

What are the attributes of "Duration Assertion" element?

"Duration Assertion" has the following attributes:
  • Name: To provide the name of the assertion.
  • Comments: To provide arbitrary comments (if any)
  • Apply to: To define the search scope. 
  •  Main sample and sub-samples: In case, the request is redirected then use this option, so that the response time duration will be the sum of both main and re-directed request response time and can be compared with the expected duration.
  • Main sample only: This option can be selected when we want to validate the response time of main sample only.
  • Sub-samples only: When request is re-directed and the response time duration comparison is needed only for sub-sample (re-directed) method then this option needs to be selected.
  • Duration to Assert: The expected response time duration needs to be provided in the 'Duration in milliseconds' field which will be compared with the actual response time duration and a decision will be made. When the actual duration is more than the expected duration then the sampler will be marked as failed whereas when the actual duration is less than the expected duration then the result will be treated as pass. 
Some Key Rules related to Duration Assertion:
1. Duration assertion follows scope policy means if we add duration assertion at transaction level then the assertion is applicable to all the samplers under the same transaction. 
2. Duration should be given in milliseconds.
3. Duration value can be parametrized.
4. You can define Global Duration Assertion under the test plan which will be applicable to all the samplers.    
  
Next Topic:
Apache JMeter - Assertion - "Size Assertion" Element

Previous Topic:

Apache JMeter - Assertion - "Response Assertions" Element

Related Topics:


  

No comments:

Post a Comment