Difference between revisions of "LoadRunner Correlation"

From PeformIQ Upgrade
Jump to navigation Jump to search
 
Line 18: Line 18:
=Capture the Entire Page Body in HTML=
=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:
To capture the whole data from a body of server's response use the web_reg_save_param()function as follows:




Line 35: Line 35:
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)
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.
The first CRLF ends the last line of the header.  Note, The C notation for a carriage return (CR) is "\n" and line feed (LF) is "\n".  The second CRLF ("\r\n") creates the blank line.
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.
All data following the second CRLF will be 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 up to the end of the message".
 
Note that server returns the length of file to be downloaded in the header and this can be used when using this mechanism to download files.
 
See [http://motevich.blogspot.com/2007/10/loadrunner-save-download-file-server.html File Download] for an example.


=Catpuring Data from HTML Page Headers=
=Catpuring Data from HTML Page Headers=

Latest revision as of 14:23, 20 March 2008

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

To 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 ends the last line of the header. Note, The C notation for a carriage return (CR) is "\n" and line feed (LF) is "\n". The second CRLF ("\r\n") creates the blank line.

All data following the second CRLF will be 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 up to the end of the message".

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

See File Download for an example.

Catpuring Data from HTML Page Headers