I did create a simple testcase in JMeter.
Open a form and all it's content (css, images etc) :
- GET /
- GET /css/site.css
- GET /favicon.ico
- GET /fonts/specific-fonts.woff
- GET /images/banner.png
Wait a little...
Post the values
- POST /
Receive the "Thank You" page. - GET /thanks
In the response on the first GET is a hidden input field which contains a token. This token needs to be included in the POST as well. Now I use the "Regular Expression Extractor" of JMeter to get the token from the response. So far, so good. Then, after retreiving all the other contents I create the POST message, using the variable name in the RegExp-Extractor in the value field of the token parameter. But... when executing the testcase it fills in the default value given and not the actual value of the token.
So... first step in debugging this issue was to add a dummy-HTTP-GET request directly after I get the token. In this GET request I also add the token parameter with the token variable as value, but now I can easily check the parameter by looking at the access-log on my webserver. In this case... the URL looks promising. It contains the actual token value in the GET, but it still uses the default value in the POST.
Second step in debugging was to use the "Debug Sampler" and the "View Results Tree". By moving the Debug Sampler between the different steps I found out the value of the token-variable is back to the default value after I receive the CSS.
So... now the big question is... How can I make JMeter to remember my variable value until the end of my test-script ?