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

Tuesday, February 21, 2012

How to post parameters with request in - JMeter

We most often have to post our request with dynamic parameters or even static parameters,It would be handy if we did find a way to post our parameters.

For ex:

Let's say that :

1.I have a shopping cart as my application

2.I am seaching for a item

3.Adding it to my shopping basket

Assuming that we figured out what are the parameters that we need to pass to the request.

We can use FireBug as a tool to identify what are parameters that are sent with a request quickly (or)
We can use LiveHTTP Headers to do the same functionality of identifying what are variables that are dynamic,static,values/names of the object.

So let's have a closer look at the image above.

1. Add a sampler viz., the HTTP Request give a name to the request just as i have given.

2. Method is "POST" we have different webmethods for each request we do.

3. POST method uses web method which means that you are posting a request to the
server & the response will be sent inturn to the server.

4. To avoid the hiccups we face in future let's parametrise the dynamic content by passing it as a variable either as user parameter or from a CSV file.

5. Click on the Follow Redirects & Use Keepalive so that we can have a look at if there are any redirests that occur.

8. Now let's have a look at the parameters which we have to pass through our request.

9. Make sure you know what the application code rather id for an object is called as,you can find out this by using Firebug or Live HTTP Headers both the name & value.

10.We send the Name Value pair as request so name is the id/name that uniquely identifies an object on the application.

11.It sometimes rather often happens that we don't want to change the values frequently in those scenarios you can read values from a CSV file.
automationwithselenium.blogspot.com-Google pagerank and Worth

1 comment:

  1. You could also test SOAP using POST and request body. Read this article - http://blazemeter.com/blog/testing-soaprest-web-services-using-jmeter