Below are the steps to follow for scripting web services to load testing.
- Get WSDL - Also called endpoint
- Get Request XML - Also called request payload
- Test in SOAP UI/POSTMAN - Test manually if proper response payload in fetched
- Open Load Runner. Open new script with protocol as Web Services.
- Go to Action page.
- Go to View in Menu bar, click Step ToolBox.
- Search web_customer_request.
METHOD: POST
POST requests supply additional data from the client (browser) to the server in the message body. In contrast, GET requests include all required data in the URL.
URL : your wsdl
Body: Copy and paste entire request. select all and right. Convert to C.
Click OK.
- Now add below line above your web_custom_request:
web_reg_save_param("c_response","LB=<responseCode>","RB=</responseCode>","ORD=1");
lr_start_transaction("client_project_application_transaction_name");
After this will be your web_custom_request code:
web_custom_request("web_custom_request",
.
.
.
"</soapenv:Envelope>",
LAST);
- Finally below code to check if you received pass response code or failed. You can add more validation in request response.
if (strcmp (lr_eval_string("{c_response}"),"3001") == 0)
{
lr_end_transaction("ngcc_bcm_retrieve_voucher_info", LR_PASS);
}
else
{
lr_end_transaction("ngcc_bcm_retrieve_voucher_info",LR_FAIL);
//lr_output_message ( "Response Ticket#%s", lr_eval_string ( "{c_ticket}" ) );
lr_continue_on_error( 0 );
lr_exit( LR_EXIT_ITERATION_AND_CONTINUE, LR_FAIL );
}
No comments:
Post a Comment