Wednesday, June 10, 2009

Fixing URLs

For some tests, the URL to visit is extracted from the previous request using one of the PostProcessors (usually the Regex PostProcessor). However a URL containing parameters should normally have ampersands(&) escaped . This causes problems because JMeter will not automatically unescape these URL's

Use a javascript function to unescape the urls.

Assume that the Regex Post processor has extracted the url into a variable named returnUrl, then in the next HTTPSampler (Path field), instead of using ${returnUrl} use the function below.

This will simply replace amp; with a blank string so that a URL of the form becomes

Note that we don't need to do this for encoded values like %2F or whatever because that is taken care by the webserver

No comments: