Getting view javax.faces.application.ViewExpiredException in jemeter5.3 - jmeter

Trying to test JSF2.2 application in jmeter5.3. Getting javax.faces.application.ViewExpiredException
in each request. Using Regular expression extractor to read view stateenter image description here.

Looking into this answer
The ViewExpiredException will be thrown whenever the javax.faces.STATE_SAVING_METHOD is set to server (default) and the enduser sends a HTTP POST request on a view via <h:form> with <h:commandLink>, <h:commandButton> or <f:ajax>, while the associated view state isn't available in the session anymore.
So you're sending stale viewstate parameter, check JMeter Scoping Rules user manual entry, you need to extract the ViewState not only once, but from each and every subsequent page so if you placed Regular Expression Extractor as a child of a single request try moving it one level up
Few more hints:
Using regular expressions for extracting data from HTML is not the best idea, I would suggest considering switching to CSS Selector Extractor instead
According to JMeter Best Practices you should always be using the latest version of JMeter so consider upgrading to JMeter 5.4.1 or whatever is the latest stable version available at JMeter Downloads page

Related

Jmeter: I can't get the response that I needed for assertion

I have been working on this project and I can't get the response that I needed for assertion because the response body in Jmeter only says "Your browser does not support framing. Please update your browser", but Im using the latest version of Firefox (image 2). I also manually execute the request in the real browser, same as what browser Im using in Jmeter, and didn't encounter the said message. Can someone please tell me whats going on? Thank you for your help
Response Body
HTTP header Manager
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).
Most probably the value you're looking for lives inside an iframe is being loaded using some JavaScript function which is not being kicked off by JMeter as it doesn't evaluate JavaScript.
So you need to invoke the relevant request manually using another HTTP Request sampler which would load the required page. You can figure out the necessary request URL by looking into page source using your favorite browser developer tools or by recording your test scenario using JMeter's HTTP(S) Test Script Recorder.
Also be aware that due to asynchronous nature of JavaScript calls it is better to wrap it (and other JavaScript calls, if any, in Parallel Controller
You can install Parallel Controller and Sampler via JMeter Plugins Manager

jmeter does not show the same page result as my browser's developer view

jmeter http request results in a page that has div's, but the div's do not contain the rest of the http page.
If I use a browser's developer's view, I can expand the div's to see the rest of the http page results.
How do I get jmeter to show everything that is below the div's? The problem with getting all of the embedded resources is that the embedded resource shows ALL of the possible resulting page code for many different pages. I simply need the RESULT of ONE page to do testing that is specific to THAT page result.
You need to tick Retrieve All Embedded Resources on "Advanced" tab of the HTTP Request sampler (or even better HTTP Request Defaults). If you're receiving resources you're not interested in you have URLs must match input which acts in 2 modes:
You can put specify URL pattern which will match your ONLY ONE PAGE
You can specify URL pattern which will not match specified pages, i.e. something like ^((?!google|facebook|cdn|yahoo|microsoft).)*$ will exclude requests originating from google, facebook, cdn, yahoo and microsoft domains.
Patterns should be in form of Perl-5 style regular expressions. See Excluding Domains from the Load Test for more details.
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
So if you "divs" are populated by AJAX calls - JMeter will not execute them automatically, you will need to add the relevant HTTP Request samplers to mimic each AJAX call separately. As real browsers execute JavaScript asynchronously (in parallel) you should put these requests under Parallel Controller
And finally to put everything together it makes sense to place all the requests under Transaction Controller so you could measure how much time does whole sequence take.

JMeter to wait until form is fully loaded

I have a form, which is inside a div on page. When page is loaded, form start to load with a loading screen. JMeter capture it, when page is loaded, it doesn't wait for the form, so page loader is on 0 % when I view results. I tried to use Constant Timer to delay processing. JMeter says too early in this case, that request is successful, because a failure can happen during loading of input fields.
JMeter waits for the whole response with one little exception, 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 your form is being loaded via AJAX request JMeter won't automatically execute it, you will have to add a separate HTTP Request sampler to invoke the relevant AJAX request(s) which will load your form.
In order to mimic real browser's behavior you can put the main and the "AJAX" requests under Parallel Controller (you can install it using JMeter Plugins Manager)

JMeter: JavaScript is not returning exact data in Response Data Sets

As we all know JMeter is not supporting JavaScript till now, but is there any alternative way to extract data from JavaScript's Response Data (Not generating exact response which we can get using Browser) using Regular Expression Extractor and inject it as parameter for another HTTP Request?
Note: In the response page getting message as "JavaScript is required. This web browser does not support JavaScript or JavaScript in this web browser is not enabled."
I think you are looking at HTML view. As documentation states:
The HTML view attempts to render the response as HTML. The rendered HTML is likely to compare poorly to the view one would get in any web browser; however, it does provide a quick approximation that is helpful for initial result evaluation.
Images, style-sheets, etc. aren't downloaded.
In your case that view is not very helpful, since page has <noscript> tag, which ensures that you only see one message about missing JavaScript. So don't look at it, use Text mode instead, which gives you the actual page source.
Another confusion you seems have is that JavaScript has some sort of "response data". It does not. JavaScript is a client-side technology, while JMeter is working directly with HTTP requests/responses. So when client issues a new HTTP request (which could be result of JavaScript code, user operation, or anything else), JMeter representation of such request is always the same: HTTP Sampler, which has some response data, which, as I said, bast viewed in Text mode.
So bottom line is: likely you have no problem with recording or playback of your script, you are just not checking it correctly.
If you send the same request as the browser you should get the same response. If you are receiving only the error message regarding not-enabled JavaScript - your test is not working properly and doesn't mimic all the requests which are being sent by a real browser with 100% accuracy (i.e. you are sending only main request with JMeter while browser does few more AJAX requests which fetch data from the server and actually render the content).
It also means that your test does not make a lot of sense as each JMeter virtual user needs to represent real user using real browser as close as possible with all its stuff (cookies, headers, cache, think times, etc.)
So I would recommend the next steps:
Make sure you have correlation in place.
Make sure you are following recommendations from the How to make JMeter behave more like a real browser article.
Once done - compare the request(s) which are being sent by browser and JMeter using a sniffer tool like Fiddler or Wireshark the requests should be exactly the same (apart from dynamic data which needs to be correlated). If there are inconsistencies or missing requests you need to amend JMeter configuration to so JMeter requests would exactly match the browser ones.

Jmeter VIEWSTATE Dynamic

I am trying to catch the element "VIEWSTATE".
I am able to catch the "VIEWSTATE" on the first page, but not on the next.
On next page, the element is dynamic.
How do I catch the viewstate Dynamic element on the second page?
See images below:
The first page
The second page
My expectation is that your login fails, most probably due to missing HTTP Cookie Manager.
Also be aware that JMeter's Post-Processors follow Scoping Rules so moving the extractors to be the children of the relevant requests could also be a reason as sub-samples may not contain the dynamic parameters you are looking for and variables extracted from main sample are simply being overwritten by the sub-samples.
See ASP.NET Login Testing with JMeter article for example .NET based web application login test plan.

Resources