Favourite Quote

Every artist was first an amateur. - Ralph Waldo Emerson The more difficulties one has to encounter, within and without, the more significant and the higher in inspiration his life will be. - Horace Bushnell

Monday, February 13, 2012

Using XPATH Extrcator

Xpath plays a vital role when you want to extract value of an object present in one request and pass fetched value on to a next request.

This is more often true when you never know what would be the id in simple terms if the value is dynamic & changes for every request.

Let's take a shopping cart example:

1. When we add items to the cart we never know what forms a cartId,if we have to pass that cartId to the basket.

So let's extract the value of Id by passing a xpath query to search for the name "cartId" - This can be determined either by firebug if you are on firefox or debugbar if you are on Internet explorer.

2.Add a debug sampler so that you will know what is returned in the variable you stored.

3.How do we add a XPATH Extractor to our HTTP request.

3.a Right Click the HTTP request

3.b Click on Add >> Post Processors > Xpath Extractor

4. Let's have a closer look at the XPATH Extractor.

4.a Give a name to the xpath extractor.

4.b Check the Use Tidy and the Quiet

4.c Add Reference name - It is like a variable name

4.d Pass the Xpath query

4.e Pass the default value it will displayed if there is no value being fetched from the query.

GUI View - System / JMeter Properties.

JMeter Properties let's us have a look at the Jmeter.Properties file that is placed within the bin folder of the jmeter installation directory you.

It gives a nice GUI view as against the files being edited.

To have a look at the Property file.

1.Right Click on the work bench.
2.Add Non- Test Elements.
3.Property Display.

Will result in displaying all properties of the JMeter.You can select to view the system properties or the JMeter Properties. automationwithselenium.blogspot.com-Google pagerank and Worth