Search code examples
jspjmeterperformance-testingstress-testingjmeter-3.2

How to handle dynamic JSP pages in Jmeter


We're trying to perform performance testing on one of our web application based on jsp using Jmeter. Now when I open a link in that application, the URL that is visible in browser remains same and does not change, for example if URL of the application is www.johndoe.com/abc and there is a link on the webpage that says click here to contact, now on clicking that page if contact form opens but the URL of the webpage visible in browser is still www.johndoe.com/abc.

I recorded these steps using Jmeter recording controller so that I can do performance tests on it, when I see the http samples, it shows path something like /abc/rest/a/task/latest/3067/form and when I execute the script it throws 401 Unauthorized error in Jmeter.

What I assume is behind the scenes this is the actual link of that contact form page and that number 3067 is the ID of the page which is dynamic and changes every time when you refresh the page.

Can someone please suggest how should I capture this auto task ID before hitting the URL and be able to access that page in Jmeter so that I can do performance testing?

To add onto above I also select some radio buttons on that form and select some dropdown fields on form and I want Jmeter to do the same when its executing, please let me know how should I be able to achieve that.


Solution

  • Dynamic parameters don't come "out of nowhere", my expectation is that URL like /abc/rest/a/task/latest/3067/form is present somewhere in the www.johndoe.com/abc page HTML response.

    So inspect the response and check the presence of the dynamic elements and their location in response DOM. Once done you should be able to use Regular Expression Extractor or CSS/JQuery Extractor to extract this dynamic number between latest and form and store it into a JMeter Variable

    Example Regular Expression would be something like /abc/rest/a/task/latest/(\d+)/form

    JMeter Regular Expression Demo

    The whole process is known as "correlation", you should be able to find a lot of information on it over the web.