Performancing Metrics

Vamsi Tokala's blog: May 2010

Thursday, May 6, 2010

Testing RESTful Web Services using LoadRunner

Brief overview of RESTful web services

REST defines a set of architectural principles by which you can design Web services that focus on a system's resources, including how resource states are addressed and transferred over HTTP by a wide range of clients written in different languages. If measured by the number of Web services that use it. REST has had such a large impact on the Web that it has mostly displaced SOAP- and WSDL-based interface design because it's a considerably simpler style to use.

From the standpoint of client applications addressing resources, the URIs determine how intuitive the REST Web service is going to be and whether the service is going to be used in ways that the designers can anticipate. A third RESTful Web service characteristic is all about the URIs.

REST Web service URIs should be intuitive to the point where they are easy to guess. Think of a URI as a kind of self-documenting interface that requires little, if any, explanation or reference for a developer to understand what it points to and to derive related resources. To this end, the structure of a URI should be straightforward, predictable, and easily understood.

One way to achieve this level of usability is to define directory structure-like URIs. This type of URI is hierarchical, rooted at a single path, and branching from it are subpaths that expose the service's main areas. According to this definition, a URI is not merely a slash-delimited string, but rather a tree with subordinate and superordinate branches connected at nodes. For example, in a discussion threading service that gathers topics ranging from Java to paper, you might define a structured set of URIs like this:{topic}

(Refer this article written by Alex Rodriguez on RESTful webservices for more information)

Sumilating RESTful web Services using LoadRunner

REST Services can be scripted using web_custom_request by adding appropriate headers using web_add_header function before the web_custom_request.

An example for REST services script is given below.


web_add_header ("X-ELS-APIKey","11111");

web_add_header ("X-Forwarded-For","");

web_add_header ("Accept","text/xml");





"EncType=text/xml; charset=iso-8859-1",







If you want to verify the response manually, you need to set up the header values first in your browser.

Please find below the steps for setting up the header using mozilla firefox browser.

  • Open firefox. Click "Add-ons" from tools menu
  • Click "get Add-ons" tab.
  • Type "HTTP header" in the text box for search all add-ons and enter.
  • In search results, click on "Add to firefox" for "Modify Headers 0.6.6" and install. Now you can see "Modify Headers 0.6.6" in the extension tab.
  • Click on "Modify Headers 0.6.6" from the "Extensions" tab and select the check box for "Always on" and "Open modify header in a new tab" and close.
  • Now click "Modify headers" from the firefox tools menu and add the appropriate header name and value for your request.

Now launch the URL in the firefox browser and verify the response manually.

Also refer RESTClient  addon available for firefox to test RESTful services