Thursday, February 2, 2012

JMETER: Extracting values using regular expression extractor

We were trying jmeter to do our performance test, one of the issues we faced is that we needed to extract values from pages to be used in next requests

to do so we need to add Regular Expression Extractor to the request, and to set the extractor properties

The most important part is the Regular Expression property

Getting some help from http://jmeter.apache.org/usermanual/regular_expressions.html

I used a general form like the following, to extract readme.txt from name="file" value="readme.txt"

we use Regular Expression

name="file" value="(.+?)"

OR

name="file" value="([^"]+)"

If there is no double quotes  at the end, then it will be like

login?execution=(.+?)$