Jmeter Post Processor XPath Extractor example

Post processors are used for generally asserting or extracting data from the response/data received from an HTTP request.

XPath extractor is one of the many options provided by the Jmeter to work on a response or data received.

In this test I make a HTTP Api call and get XML data in return and then use XPath extractor to extract a value.

The extracted value can be used as a variable or cab be used to assert for something.

1) Create a Test plan and add a Test group and a HTTP Request sampler. If you do not know how to use a HTTP request sampler then go to my previous post

Here I have used a example server name. You should use an address that will give back XML data to parse.

Screen Shot 2014-04-02 at 7.30.45 PM

2) Now add a XPath Extractor POST processor for the HTTP request sampler you just created. It should look something like this.

Screen Shot 2014-04-02 at 7.36.57 PM

3) Now consider that when you run the test you will receive an XML.

For eg:



Considering this XML data is received in the response and you want to extract the name.

In the XPath extractor there are three fields.

Reference name: Username (variable name you will use this to access this value later in the tests. You can access it using ${Username)

Xpath Query: //user/name (This is the query used to extract the name from the XML data above)

Default Value: NoNameFound(This the the default value the the variable ${Username} will have if it does not find the name tag in the XML data)

It would look something like this

Screen Shot 2014-04-02 at 7.46.49 PM


One thought on “Jmeter Post Processor XPath Extractor example

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s