Highlighted
Absent Member.
Absent Member.
565 views

How to test REST API using LR?

How to test REST API using LR?
 

I would like to use LoadRunner to test REST API 

Could anyone please share your experiences and give me some advices?

i tried  Load testing of a REST API, using HP LoadRunner’s(HTTP/HTML protocal) web_custom_request( ) method but i got XSD_VALIDATION_FAIl , please advice me?

Please find the below code for your reference.


        web_custom_request("Add yms-appointment", 
        "URL=http://192.168.68.242:2019/ywc-1.0/services/yms/appointment", 

       
          "Method=POST", 
        "Resource=0", 
        "EncType=application/xml", 
        "Mode=HTTP",
        "BodyFilePath=sample.xml",
        LAST);
    
    
    

 

Thanks,

Sivanjan BV

0 Likes
1 Reply
Highlighted
Super Contributor.
Super Contributor.

Re: How to test REST API using LR?

Hi, 

Maybe you need to set up the headers or to review the body. This is my example :

    web_add_header("Content-Type", "application/json");
      web_add_header("X-ClientKey", "XXXXXX"); //In case it is necessary
    web_add_header("x-TransactionID", "XXXXXXX"); //In case it is necessary

   
    web_custom_request("Login request",
        "URL=https://XXXXXXXXXXX/login",
        "Method=POST",
        "Resource=0",
        "Referer=",
        "Mode=HTTP",
        "Body={JSON}",
        LAST);

 

Regards

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.