6
votes

I'm using JMeter to do some load tests on my JSF application and I'm having trouble passing the ViewState along the pages. The ViewState variable doesn't get extracted at all or it doesn't get passed along the pages.

I've recorded my test steps with a proxy server and this is what it looks like:

First GET Request

I've added the Regex extractor in the first GET request. Tested the regex and it is correct.

First POST Request

In every POST request I replace the hardwired View IDs with my variable.

And what I get when I send the request is the following:

Request sent

The POST parameters are incorrect, as it sends the name of the variable.

POST data:

loginForm%3ArequestToken=&loginForm%3Ausername=heller&loginForm%3Apassword=%21QAYxsw2%A7EDC&loginForm%3AloginButton=Anmelden&com.sun.faces.VIEW=%24%7BjsfViewState%7D&loginForm=loginForm

Could you tell what I'm doing wrong here?
Thanks!

2

2 Answers

2
votes

The ViewState parameter is an encoded value (Base64 I believe?) and may contain values that would be inappropriate if passed in a GET request through the url. URL parameters are typically encoded so that special values (Eg. space -> %20) can be represented and decoded when the request reaches the server.

The issue here is that the following request is a POST meaning that the parameters do not need to be URL encoded.

com.sun.faces.VIEW=%24%7BjsfViewState%7D&loginForm=loginForm

The above shows that JMeter or some other process is URL encoding the ViewState in the request which is incorrect. The value of the ViewState should simply be sent as is.

2
votes

Found my problem: the regex was wrong, so it couldn't find anything in the response. I had to change the regex. Noticed it after adding a default value "NOT FOUND".