Showing posts with label regular expression extractor. Show all posts
Showing posts with label regular expression extractor. Show all posts

Tuesday, February 7, 2012

jmeter: Validate regular expression extractor

I had some extractors in my test, and when I was looking on the request using the extracted values, I noticed that it is not coming correctly. I looked for someway to validate this extractors to see whether I did it correct or not.

First I made sure that I am using the variables correctly in my test

So if the regular expression Reference Name is param1, it should be used as ${param1}

Second, I found that the regular expression can be verified from the “View Results Tree”, so I went to the request, then selected the Response Data tab in the details panel as below

Screenshot-2012-02-07_11.48.58

Then at the bottom, I have entered regular expression in the search box, and checked the Regular exp. check box

at first it wasn’t bringing any results, because there is ? in the regular expression that needs to be escaped

when I changed ? to \?, results was found and highlighted in the response

Screenshot-2012-02-07_11.48.15     Screenshot-2012-02-07_11.48.31

Using this method I was able to verify and correct the regular expressions for the regular expression extractor

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=(.+?)$