LoadRunner Correlation

From PeformIQ Upgrade
Revision as of 14:18, 20 March 2008 by PeterHarding (talk | contribs)
Jump to navigation Jump to search

Scraping Binary Data within LoadRunner Scripts

Using Winsocket...

The left boundary is composed of 3F and DD. The right boundary is composed of CC and b.

So:

web_reg_save_param("ParamName",
                   "LB/BIN=\\x3F\\xDD",
                   "RB/BIN=\\xCCb",
                   LAST);

For whichever boundary, use BIN with LB and RB, then web_reg_save_param() can be used with binary data.

Capture the Entire Page Body in HTML

Tto capture the whole data from a body of server's response use the web_reg_save_param()function as follows:


web_reg_save_param("body",
                   "LB=\r\n\r\n",
                   "RB=",
                   LAST);

This function should be placed before the web_url() function which will return the data. After execution, the parameter, 'Body', will contain the body data.

I will clarify briefly the meaning of boundaries - "LB=\r\n\r\n" and "RB=". Please, read the basic concepts of HTTP protocol, read Request message section:

A requirement of the HTTP protocol is that the header and body of a HTTP return be separated by an empty line (i.e. two (2) CRLF pairs)

The first CRLF (that is, a carriage return (CR = "\r") followed by a line feed (LF = "\n")) ends the last header line. The second CRLF ("\r\n") creates empty line. All data, followed by second CRLF, are the message body. So to summarize, the specification ("LB=\r\n\r\n") means "start capturing from the beginning of message body". The empty right boundary ("RB=") will be interpreted as "capture data till the end of message".

Note that server returns the length of file to be downloaded this can be used when using thios mechanism to download files.

Catpuring Data from HTML Page Headers