<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>LoadRunner TnT &#187; functions</title>
	<atom:link href="http://www.loadrunnertnt.com/tag/functions/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.loadrunnertnt.com</link>
	<description>Performance Testing, LoadRunner Tips &#38; Tricks</description>
	<lastBuildDate>Mon, 08 Mar 2010 07:57:02 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>How-to verify file downloaded</title>
		<link>http://www.loadrunnertnt.com/how-tos/how-to-verify-file-downloaded/</link>
		<comments>http://www.loadrunnertnt.com/how-tos/how-to-verify-file-downloaded/#comments</comments>
		<pubDate>Fri, 28 Aug 2009 06:17:15 +0000</pubDate>
		<dc:creator>TnT Admin</dc:creator>
				<category><![CDATA[How-Tos]]></category>
		<category><![CDATA[functions]]></category>
		<category><![CDATA[Scripting]]></category>

		<guid isPermaLink="false">http://www.loadrunnertnt.com/?p=586</guid>
		<description><![CDATA[Often there is a need to verify the validity of the file being downloaded by the script.  Under normal circumstances, if the file is a PDF or excel file, it will be returned/transmitted in binary (when you turned on replay log).  In this way, unlike conventional functional tool, LoadRunner is unable to verify if the [...]]]></description>
			<content:encoded><![CDATA[<p>Often there is a need to verify the validity of the file being downloaded by the script.  Under normal circumstances, if the file is a PDF or excel file, it will be returned/transmitted in binary (when you turned on replay log).  In this way, unlike conventional functional tool, LoadRunner is unable to verify if the file downloaded is valid.<span id="more-586"></span></p>
<p>In order to circumvent that, we use web_get_int_property API to retrieve the file size.  This file size will then be used to make comparison with the actual known file size on the server.  For usage of web_get_int_property, you can refer to the Function Reference available in Vugen.</p>
<p>On a brief overview, place the web_get_int_property APT after the request (web_url, web_custom_request, etc.) made for the file (PDF/excel).  I&#8217;ve extracted examples from <a href="http://tech.groups.yahoo.com/group/LoadRunner/message/23641" target="_blank">LoadRunner Yahoo Groups</a> and list them below for your convenience.</p>
<blockquote><p><strong>Example 1:</strong></p>
<p>lr_message(&#8220;%ld&#8221;,web_get_int_property(HTTP_INFO_DOWNLOAD_SIZE));</p>
<p>web_get_int_property(HTTP_INFO_DOWNLOAD_SIZE);</p>
<p>web_get_int_property(HTTP_INFO_DOWNLOAD_TIME);</p></blockquote>
<p>Note, HTTP_INFO_DOWNLOAD_SIZE does not give the actual size of PDF file.  This HTTP_INFO_DOWNLOAD_SIZE gets the body bytes, header bytes, and chunk bytes.  Therefore, you may need to fine tune the script to determine a range value of the PDF file size due to the header and chunk bytes.</p>
<blockquote><p><strong>Example 2:</strong></p></blockquote>
<blockquote><p>float fFileDownloadSize, fFileDownloadTime, fFileDownloadRate;</p></blockquote>
<blockquote><p>funcFileDownload()<br />
{<br />
fFileDownloadSize = (web_get_int_property(HTTP_INFO_DOWNLOAD_SIZE)/1024.);<br />
//in kilobytes<br />
fFileDownloadTime = (web_get_int_property(HTTP_INFO_DOWNLOAD_TIME)/1000.);<br />
//in seconds<br />
fFileDownloadRate = fFileDownloadSize/fFileDownloadTime; //in KB/s</p>
<p>lr_output_message(&#8220;Size of download was %.0f kilobytes; Time of download was %.3f seconds&#8221;, FileDownloadSize, fFileDownloadTime);</p>
<p>lr_output_message(&#8220;Rate of download was %.2f KB/sec&#8221;, fFileDownloadRate);</p>
<p>return 0;<br />
}</p></blockquote>
<blockquote><p><strong>Example 3:</strong></p>
<p>long DSize=0;</p>
<p>float DTime=0;</p>
<p>DSize = web_get_int_property(HTTP_INFO_DOWNLOAD_SIZE);</p>
<p>lr_output_message(&#8220;DSize is: %.2ld Bytes&#8221;, DSize);</p>
<p>lr_output_message(&#8220;File Download size is: %.2ld KB&#8221;, DSize /1024);</p>
<p>DTime = web_get_int_property(HTTP_INFO_DOWNLOAD_TIME);</p>
<p>lr_output_message(&#8220;File Download Time is:%.2f Seconds&#8221;, DTime / 1000);</p></blockquote>
<p><!--adsensestart--></p>
]]></content:encoded>
			<wfw:commentRss>http://www.loadrunnertnt.com/how-tos/how-to-verify-file-downloaded/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Function web_reg_save_param and arrays</title>
		<link>http://www.loadrunnertnt.com/how-tos/130/</link>
		<comments>http://www.loadrunnertnt.com/how-tos/130/#comments</comments>
		<pubDate>Wed, 15 Oct 2008 14:10:43 +0000</pubDate>
		<dc:creator>TnT Admin</dc:creator>
				<category><![CDATA[How-Tos]]></category>
		<category><![CDATA[functions]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[web_reg_save_param]]></category>

		<guid isPermaLink="false">http://www.loadrunnertnt.com/?p=130</guid>
		<description><![CDATA[There are always situations that required us to work with dynamic data returned by the server through correlation and stored in array.  That is where web_reg_save_param comes into play of capturing a value or list of values based on a defined left boundary and right boundary.  To fully appreciate the power of LoadRunner, VUGen, is to [...]]]></description>
			<content:encoded><![CDATA[<p>There are always situations that required us to work with dynamic data returned by the server through correlation and stored in array.  That is where <strong>web_reg_save_param</strong> comes into play of capturing a value or list of values based on a defined left boundary and right boundary.  To fully appreciate the power of <strong>LoadRunner</strong>, VUGen, is to at best refrain from using those GUI features such as Correlation Studio or Runtime Viewer/Browser.<span id="more-130"></span>Let&#8217;s recap the syntax of web_reg_save_param (also available in Function Reference, &#8220;F1&#8243; key) which looks like the following:</p>
<p>web_reg_save_param(&#8220;p_EmpID&#8221;,<br />
&#8220;LB=Emp_ID=&#8221;,<br />
&#8220;RB=\&#8221;",<br />
&#8220;Ord=ALL&#8221;,<br />
&#8220;RelFrameId=1&#8243;,<br />
&#8220;Search=Body&#8221;,<br />
&#8220;IgnoreRedirections=Yes&#8221;,<br />
LAST);</p>
<p>This is familiar coding where p_EmpID will be captured with LB of EMP_ID= and RB of &#8220;.  However, another parameter to note in <strong>web_reg_save_param</strong> is the ORD, or Ordinal.  This specifies the locaiton of the value to capture if multiple occurrences of LB and RB exists.  By default, the value is ORD=ALL which meant that all occurrences will be captured.  When all occurances are captured, they are stored in an array.  The total number of values captured can be accessed by placing a _count suffix after the parameter name.  Example (note, Total_Employees have to be defined as an integer in the script):</p>
<p>Total_Employees=atoi(atoi(lr_eval_string(&#8220;{p_EmpID_count}&#8221;­));</p>
<p>While to access a specified value in the array, you will put an index after the parameter in _{index} format.  Example illustrates reading the 2nd Employee ID in the array:</p>
<p>Current_EmployeeID=atoi(lr_eval_string(&#8220;{p_Emp_ID_2}&#8221;­));</p>
<p>Of course, these are just methods to read the values extracted for your scripting work.  Hopefully, you will find it easier when you are performing scripting work.</p>
<p>NOTE (21 Oct 2008):  Corrections to the default value of the Ordinal parameter.  It should be ORD=1, meaning the first occurence, instead of ORD=ALL.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.loadrunnertnt.com/how-tos/130/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>

