Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Testing JSF application with JMeter - ViewState issue

All day I try to run JMeter tests of my JSF application. I am aware of ViewState, but it seemed to be quite simple issue. I prepared Regular Expression Extractor:

Reference Name: jsfViewState
Regular expression: id=\"javax.faces.ViewState\" value=\"(.+?)\"
Template $1$
Match No. 1

Regular Exp Extractor

The following samplers are created with proxy and recording.

First request /TourJSF/pages/protected/admin/addTourPage.xhtml. This is GET request from which ViewState will be extracted.

First GET

The POST request /TourJSF/pages/protected/admin/addTourPage.xhtml where .${jsfViewStete} is passed into javax.faces.ViewState

jsfViewState passed

The second GET request, now very important in this case.

Second GET

The results:

First GET. On the right we can see value of ViewState.

first GET result

Debug Sampler which shows that jsfViewState value is correct. We can compare it with the previous screen.

Debug Sampler

javax.faces.application.ViewExpiredException: viewId:/pages/protected/admin/addTourPage.xhtml - View /pages/protected/admin/addTourPage.xhtml could not be restored.

ViewExpiredException addTourPage.xhtml could not be restored

I found some blogs and topics about this issue but many of them were unsolved. If it is needed I can put links to these topics. I am really confused...

Where is the issue? Maybe something with

  • jsessionid?
  • HTTP Header Manager in every HTTP Request? I deleted HTTP Header Manager but nothing changed.
  • something with JSF apllication? When I added context-param com.sun.faces.enableRestoreView11Compatibility into web.xml, there was no ViewExpiredException but the content of returned page was not correct.
like image 349
LancerX Avatar asked Oct 04 '12 18:10

LancerX


1 Answers

Aren't you missing a Cookie Manager ?

See:

  • http://jmeter.apache.org/usermanual/component_reference.html#HTTP_Cookie_Manager

Also read this:

  • http://wiki.apache.org/myfaces/PerformanceTestingWithJMeter
like image 107
UBIK LOAD PACK Avatar answered Nov 17 '22 11:11

UBIK LOAD PACK