0
votes

I am new in JMeter.

I am using JMeter to test scenario in JSF application, the scenario to login the application and open crud page (issue_warning_create.jsf) to create record in database and it is successful with my browser but when I test the scenario with JMeter it fails with this exception:

javax.faces.application.ViewExpiredException: viewId:/secure/adt/fin/issue_warning_create.jsf could not be restored.

I noticed that JMeter use different session id than session id get from response. I tried to listen logout to terminate session and make new request with new session in JMeter but also give me the same exception. I add http cookie manager and xpath extractor to get view state as in images:

enter image description here

enter image description here

enter image description here

2
Please read Under what circumstances may I add “urgent” or other similar phrases to my question, in order to obtain faster answers? - the summary is that this is not an ideal way to address volunteers, and is probably counterproductive to obtaining answers. Please refrain from adding this to your questions.halfer
I updated my answer following your additional detailsUBIK LOAD PACK

2 Answers

0
votes

JSESSIONID can operate in 2 modes:

  1. As a HTTP Cookie, in this case HTTP Cookie Manager will do the trick
  2. As a part of the URL. If your application appends JSESSIONID to the request URL you need to use HTTP URL Re-writing Modifier to automatically handle this value and amend your URLs accordingly.

With regards to Viewstate, your XPath Extractor seems to be correct, however in case of not very well-formed XHTML you might need to tick Use Tidy box. Double check your myViewState variable value using Debug Sampler and View Results Tree listener combination.

0
votes
  • You must add a Cookie Manager

  • You must also correlate JSF View State using Regex Extractor:

Regex : input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="([^"]+)".*/

varName: jsfViewState

Template : $1$

You'll have then to use ${jsfViewState} wherever it is present.

See:

In your test, replace -1 in XPath Extractor by 1