Jmeter : How to test a website to render a page regardless of the content - testing

I have a requirement where the site only needs to respond to the user within certain seconds, regardless of the contents.
Now there is a option in Jmeter in HTTP Proxy Server -> URL Patterns to exclude and then to start recording.
Here I can specify gif, css or other content to ignore. However before starting the recording I have to be aware of what are the various contents that are going to be there.
Is there any specific parameter to pass to Jmeter or any other tool which takes care about loading the page only and I can assert the response code of that page and no the other contents of the page are recorded.
Thanks.

Use the standard HTTP Request sampler with DISABLED (not checked) option Retrieve All Embedded Resources from HTML Files (set via sampler's control panel):
"It also lets you control whether or not JMeter parses HTML files for
images and other embedded resources and sends HTTP requests to
retrieve them."
NOTE: You may also define the same setting via HTTP Request Defaults.
NOTE: See also "Response size calculation" in the same HTTP Request article.
Add assertions to your http samplers:
Duration Assertion: to tests if response was received within a defined amount of time;
Response Assertion: to ensure that request was successfull,
e.g.
Response Field to Test = Response Code
Pattern Matching Rules = Equals
Patterns to Test = 200

You want to run test that would ignore resources after certain number of seconds?
I don't understand, what are you trying to accomplish by doing that?
Users will still receive those resources when they request your url, so your tests wont be accurate.
I don't mean any disrespect, but is it possible that you misunderstood the requirements?
I assume that the requirement is to load all the resources in certain number of seconds, not to cut off the ones that fail to fit in that time?

Related

HTML page is causing error in JMeter even if status is green

HTML page is causing error in JMeter even if status is green , why this error is coming
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).
the Window interface is something browser-specific hence JMeter cannot execute the request properly.
You need to perform manual correlation of the dynamic parameters to replicate browser's behaviour, this way you should stop seeing errors, at least ViewState parameter needs to be extracted from the previous response and passed to the next request, see primefaces-jmeter-test.jmx example test plan for details.

Same response data for all iterations even though cookie is cleared

My Test structure in Jmeter
Thread group (2 users)
Http request
Listener
For each iteration same form_key values are getting in response which should not be.
How to get unique form_key in response for each iteration
Jmeter Test result screenshot
I cannot reproduce your issue using one of the online Magento demo instances, in particular this one: http://demo-acm-2.bird.eu/customer/account/login/
As you can see, each time form_key is different for each user for each iteration.
If you're using HTTP Cookie Manager - make sure to tick "Clear cookies each iteration" box
Also make sure to properly setup the HTTP Request sampler, to wit put http or https into "Protocol", server name or IP to the relevant field, path, etc.

How can I capture dynamic value in Load Runner that appears in the Request header section?

A dynamic value that appears in the subsequent web requests appears in the Request Header throughout the script. I am unable to correlate this value as it is not available in response header / body section. How can I now correlate this value?
I have tried recording using VUGEN - HTML & URL Mode. I have also used Fiddler as well as HAR files exported via Chrome Developer Tools. None of them have any additional request/responses that could have been potentially missed while recording with VUGen or other tools.
The dynamic value appears in the Request Header like this :
Reference:
https://*****/suite/sites/ecase-case-worker/page/home/start-process/iUBVQU4qoHEAl9UkPVyXKjTxMt3bz-olj7yCJ6dulSOHbmIIDal?parameters=**855b2a7b-a175-49e6-9ee0-7b7f37667197**
The "855b2a...." value appears throughout the script in different places like this below :-
web_custom_request("iUBVQU4qoHEAl9UkPVyXKjTxMt3bz-olj7yCJ6dulSOHbmIIDal",
"URL=https://****/suite/rest/a/sites/latest/ecase-case-worker/page/home/startProcess/iUBVQU4qoHEAl9UkPVyXKjTxMt3bz-olj7yCJ6dulSOHbmIIDal?cacheKey=**855b2a7b-a175-49e6-9ee0-7b7f37667197**",
I have manually verified in the application that it this value keeps changing every single time "Create application" link is clicked. Is there a way to capture this dynamically changing value?
If this is not sent to you from the server, as a correlated value, then what remains is that the value is generated on the client, likely as a part of a JavaScript function output.
Speak with the developer of your application about the location of the generation of this value. If it is locally generated then simply execute the JavaScript inside of your HTTP script or reproduce the algorithm in C for native inclusion in a C HTTP virtual user. You have some alternate paths as well, which includes the newer JavaScript based virtual user, Truclient (which runs a full browser), Citrix, RDP or GUI virtual users.
With Truclient, Citrix, RDP or GUI you are simply going to run a full browser and inherit the JavaScript execution and inclusion of the key value as a part of full stack execution.
The Fiddler recording helped in identifying the correlation value as it was hidden in one of the EXTRARES references, which wasn't captured anywhere by the VUGen. The request had to be subsequently added manually into the script to pick up the dynamic value in it's response.

How to force dispatcher cache urls with get parameters

As I understood after reading these links:
How to find out what does dispatcher cache?
http://docs.adobe.com/docs/en/dispatcher.html
The Dispatcher always requests the document directly from the AEM instance in the following cases:
If the HTTP method is not GET. Other common methods are POST for form data and HEAD for the HTTP header.
If the request URI contains a question mark "?". This usually indicates a dynamic page, such as a search result, which does not need to be cached.
The file extension is missing. The web server needs the extension to determine the document type (the MIME-type).
The authentication header is set (this can be configured)
But I want to cache url with parameters.
If I once request myUrl/?p1=1&p2=2&p3=3
then next request to myUrl/?p1=1&p2=2&p3=3 must be served from dispatcher cache, but myUrl/?p1=1&p2=2&p3=3&newParam=newValue should served by CQ for the first time and from dispatcher cache for subsequent requests.
I think the config /ignoreUrlParams is what you are looking for. It can be used to white list the query parameters which are used to determine whether a page is cached / delivered from cache or not.
Check http://docs.adobe.com/docs/en/dispatcher/disp-config.html#Ignoring%20URL%20Parameters for details.
It's not possible to cache the requests that contain query string. Such calls are considered dynamic therefore it should not be expected to cache them.
On the other hand, if you are certain that such request should be cached cause your application/feature is query driven you can work on it this way.
Add Apache rewrite rule that will move the query string of given parameter to selector
(optional) Add a CQ filter that will recognize the selector and move it back to query string
The selector can be constructed in a way: key_value but that puts some constraints on what could be passed here.
You can do this with Apache rewrites BUT it would not be ideal practice. You'll be breaking the pattern that AEM uses.
Instead, use selectors and extensions. E.g. instead of server.com/mypage.html?somevalue=true, use:
server.com/mypage.myvalue-true.html
Most things you will need to do that would ever get cached will work this way just fine. If you give me more details about your requirements and what you are trying to achieve, I can help you perfect the solution.

Handling dynamic http requests instead of hardcoded http requests in Jmeter

I'm creating a 50 users load test on a JSF web application.
I record a scenario using JMeter proxy for one user who logs in, does some db operations and logs out. After recording the scenario, the recorded test contains http requests and data that particularly belongs to the user used while scenario recording.
At the time of running the test for 50 unique virtual users, the recorded test sends http requests and data which was in the recorded scenario. But in our application, the http requests and data vary depending upon the user. So how do I handle such situations in JMeter when it comes to methods being called depending upon the existence or non-existence of data for a user after logging in?
To be precise how would I make changes in my Test plan to manage dynamic urls and dynamic data for each virtual user?
Latest versions of JMeter allow you to write the whole parameters (raw data) from scratch, so you could use variables in this field.
To achieve dynamic URLs use a Regular Expression Extractor (Post-Processor) on a prior request that define what request will be sent and use the variable in HTTP Request's path field.
If you know what request each type of users will send you could use If Controllers and test a thread variable, created by a previous Regular Expression Extractor, and inside each controller add the specific request.
If the subsequent request for each user is defined by the server, using redirection, just check "Follow Redirection" field.
See JMeter Wiki for more examples on how to do this.