In this article we are going to learn about how to test REST APIs in LoadRunner. REST APIs is a trend in creating versatile applications. REST stands for Representational State Transfer. You can learn more about REST in wiki page. This blog article focuses about testing REST APIs in HPE LoadRunner.
Testing REST APIs in HPE LoadRunner
If you noticed any auto insurance quote website, after selecting your car year, immediately you can see appropriate make list. Similarly, once you select the make, appropriate model will get listed. Please see below screen.
If you select 2016 as year, request will be sent with the parameter ‘year’ and the response will have all the makes of the year 2016. Similarly, if you select the make, appropriate models list will be returned. We will see how to add REST API calls in the HPE LoadRunner script.
How to insert REST APIs request in HPE LoadRunner?
Follow the below steps in Web HTTP/HTML protocol. I am using HPE LoadRunner 12.53 version in my laptop.
- Go to Design > Insert in Script > REST API or press Ctrl + Shift + W
2. You will get REST Step Properties dialog box as shown below
3. In this example, we are going to use sample REST API http://jsonplaceholder.typicode.com/posts/1. Just sending the URL will not work, you need to add the header as shown below.
Below is the valid response for the call.
Below is the sample POST call details.
POST call output.