Sunday, August 25, 2019

How to capture all HTTP Responses in load runner

If you want to capture the http response of a page, but some times it may redirects as HTTP 301,HTTP 302 etc

By using the below code we can capture the status code and write itin to a variable.

HttpRetCode = web_get_int_property(HTTP_INFO_RETURN_CODE);

You need to place it after all the page request in the script. However, this will only capture the LAST status code received. If there is a redirection in between, it will not be captured. So to capture that we need to use web_reg_save_param function with the following arguments.

Use "ORD=ALL" argument to capture all occurrences and 
use "Search=Headers" argument to search the response header only

web_reg_save_param("HttpResponses","LB=HTTP/1.1 ", "RB= ", "Search=Headers" ,"ORD=ALL", LAST);


The HttpResponse variable contains all http requests and output log as a message.

No comments: