Search code examples
jmeter

In Jmeter, A prerequisite sampler request should be a part of transaction controller or not?


Usecase:

  1. User searches a product and validates the response time
  2. User validates response time in pagination functionality of searched result.
    To check pagination, we need to search. Should this be part of second test or jmeter doesn't require previous request like UI, can we skip this and only test the pagination request?

Solution

  • As per JMeter project main page:

    JMeter is not a browser, it works at protocol level. As far as web-services and remote services are concerned, JMeter looks like a browser (or rather, multiple browsers); however JMeter does not perform all the actions supported by browsers. In particular, JMeter does not execute the Javascript found in HTML pages. Nor does it render the HTML pages as a browser does (it's possible to view the response as HTML etc., but the timings are not included in any samples, and only one sample in one thread is ever displayed at a time).

    So if there are no dynamic parameters which store client state like ViewState or associated Cookies then you should be able to test the pagination without executing the "main" search request and only perform the correlation to see if there are more pages left, get the number of the current page, etc.

    With regards to whether to put it under the Transaction Controller or not - it's totally up to you, Transaction Controller doesn't have any logic when it comes to "continuation" of the previous request, it just sums up the elapsed time of its children and reports the total amount taken.