Does LoadRunner support testing RESTful Web Services?
Need to test a RESTful webservice using LoadRunner, but aren't sure if LoadRunner supports RESTFul? Did you try using the Web Services protocol without any luck? Actually, LoadRunner does support RESTful web services using the HTTP/HTML protocol with the web_url function.
Using web_url
REST is a very simple technology that uses XML for communication combined with URL patters. Also RESTFul web services work with most HTTP methods that many services expose. For example:
- GET is used to perform a query or to obtain data. The data returned from the web service is a representation of the request info.
- POST can be used to create a new resource. Typically, a web service will respond with data or a status of success or failure.
(For more detail check out this Oracle article on RESTful Web Services)
Using LoadRunners's web_url allows you to GET a request from a RESTFul service using its URL argument.
Using LoadRunner to test a RESTful example

"URL=http://localhost:24240/HPFlights_REST/Flights?DepartureCity=Denver&ArrivalCity=London", "Resource=0", "RecContentType=text/xml", "Snapshot=t1.inf", "Mode=HTML", LAST);
Modify script
If you wanted to capture the first FlightNumber returned, you would use the same method you would normally use with the web_reg_save_param. The full script should look like this:
Action()
web_reg_save_param("CheckFlightNum",
"LB=
"RB=
"Ord=1",
"RelFrameId=1",
"Search=Body",
"IgnoreRedirections=Yes",
LAST);
web_url("xml",
"URL=http://localhost:24240/HPFlights_REST/Flights?DepartureCity=Denver&ArrivalCity=London",
"Resource=0",
"RecContentType=text/xml",
"Referer=",
"Snapshot=t1.inf",
"Mode=HTML",
LAST);
lr_output_message("This is the first flightnumber %s",lr_eval_string("{CheckFlightNum}"));
return 0;
}
Be Restful!!
To see how to test a NON-RESTful web service using LoadRunner check out my post How to test a web service using HP's LoadRunner

{ 17 comments… read them below or add one }
The example provided by HP in Service Test is not a RESTful web service, at best it is RPC URI tunneling through HTTP. You should rename this blog post to testing XML over HTTP services using LoadRunner.
Jeevak Kasarkod » Thanks Jeevak for your feedback. My apologies but HP’s Service Test’s User Guide does call it a REST service. In your opinion what would you consider the be a good example of a REST service? How about Twitter’s REST API or one of Amazon’s services? Cheers~Joe
I followed the same steps, however the data return is like this Registerid”:” 13123123123123123″}”,with other data in the GET method, i have the read only 13123123123123123, i user web_save_param, but when i gave LB as Registerid”:” and RB as “}, am getting compilation error, how to solve this issue as :
web_reg_save_param(“Reg_GUI_ID”,
“LB=”RegisterGuid”:”",
“RB=”}”;,
“Ord=1″,
“Search=Body”,
“RelFrameId=1″,
LAST);
Preethi » Hi Preethi — did you resolve this yet? Looks like an issue with the quotes since it is a special character in LR. Special characters in the boundaries must be “escaped” by a backslash \
Hey Joe
Which is the best tool for performance testing a enterprise solution that is on .Net REST services and GUI designed in ASP and other MS technologies.
i have HP Loadrunner, NeoLoad, LoadUI we are currently evaluating the tools to see which one best fits in. Any thing that you know off along with cost options.
Probably we might be running a 5k concurrent user load tests against our application at Max. and all these are HTTP requests
Naveen » Hi Naveen – I have to admit that I am biased towards LoadRunner. But I know that it does cost big $$ so it may not be an option for you. I don’t know enough about loadUI and NeoLoad to make a fair comparison. Does anyone else have any experience with either of these tools?
How run this scenario for multiple Vusers?
kumar » Hi – not sure I understand your question. Normally you create a Vuser script and run in the LoadRunner Controller where you can specify how many vusers to run.
How to perform load test on this?
kumar » Do you have a specific issue? To use you could add to the LoadRunner controller and add the amount of Vusers that you need to use.
Hi, I have created a script with web_url in Vugen. After this, I have created a scenario of 10 vusers running for 5 mins, with a user ramping up every 10 seconds.
The scenario runs without any issues. But the average response time comes as 0 for the Rest services! There are transactions logged against the Rest service, but response time is always 0.
These services get loaded on Login. The only transaction that has response time more than 0 is Login.
My script has a main transaction as Login and the Rest services as sub transactions. But I dont see any response time getting logged for the REST services
Hi, I have created a script with web_url in Vugen. After this, I have created a scenario of 10 vusers running for 5 mins, with a user ramping up every 10 seconds.
The scenario runs without any issues. But the average response time comes as 0 for the Rest services! There are transactions logged against the Rest service, but response time is always 0.
These services get loaded on Login. The only transaction that has response time more than 0 is Login.
My script has a main transaction as Login and the Rest services as sub transactions. But I dont see any response time getting logged for the REST services
Hi Joe,
I want to learn abt RESTful web service testing using HP’s LoadRunner. can you guide?
Jean » Hi Jean – what type of info are you looking for?
Hi Joe,
Thanks for sharing the detailed steps. Is there any way that we can add authentication(like tokens) to the request?
Prakash » You can usually use web_set_user for basic authentication info