<?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>ASI &#187; QuickTest Pro</title>
	<atom:link href="http://www.asi-test.com/ASI/category/tools/qtp/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.asi-test.com/ASI</link>
	<description>Automated Solutions, Inc. - Leadership in Software Development, Testing &#38; Test Automation</description>
	<lastBuildDate>Thu, 02 Feb 2012 17:38:43 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>QTP &#8211; Saving your test run data</title>
		<link>http://www.asi-test.com/ASI/qtp-saving-your-test-run-data/</link>
		<comments>http://www.asi-test.com/ASI/qtp-saving-your-test-run-data/#comments</comments>
		<pubDate>Fri, 13 Jan 2012 16:58:02 +0000</pubDate>
		<dc:creator>Shawn</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[QuickTest Pro]]></category>
		<category><![CDATA[Sample Code]]></category>
		<category><![CDATA[Software Testing]]></category>
		<category><![CDATA[automation]]></category>
		<category><![CDATA[data table]]></category>
		<category><![CDATA[export]]></category>
		<category><![CDATA[exportsheet]]></category>
		<category><![CDATA[report]]></category>
		<category><![CDATA[sample]]></category>
		<category><![CDATA[test results]]></category>
		<category><![CDATA[testing]]></category>

		<guid isPermaLink="false">http://www.asi-test.com/ASI/?p=845</guid>
		<description><![CDATA[You can&#8217;t actually modify the data permanently in the datatable associated with the test script during a test run but there are two approaches you can take in order to save the data into an external file that you can use later.  During &#8220;run-time&#8221; a copy of the datatable is created as the &#8220;run-time datatable&#8221; [...]]]></description>
			<content:encoded><![CDATA[<p>You can&#8217;t actually modify the data permanently in the datatable associated with the test script during a test run but there are two approaches you can take in order to save the data into an external file that you can use later. <span id="more-845"></span> During &#8220;run-time&#8221; a copy of the datatable is created as the &#8220;run-time datatable&#8221; and anything you write to the datatable is actually stored in this &#8220;run-time table&#8221; which is actually another instance of the datatable saved with the Test Run.  This has its Pros and Cons depending on how you look at it.  Regardless of your view if you want to permanently save your test data then you basically have two choices:</p>
<ol>
<li>You can use the &#8220;DataTable.Export&#8221; method or &#8220;DataTable.ExportSheet&#8221; method to literally create a new .xls file of the workbook or specified worksheet, and have this new file saved in your file system (locally or on the network).  With this approach you can then use that datatable/spreadsheet however you want including importing it into the permanent datatable attached to the test script if you want.<br />
<img class="aligncenter size-full wp-image-846" title="QTP Export Method for use with the DataTable" src="http://www.asi-test.com/ASI/wp-content/uploads/2012/01/ExportMethod.png" alt="QTP Export Method for use with the DataTable" width="560" height="445" /><br />
<img class="aligncenter size-full wp-image-847" title="QTP ExportSheet Method for use with the DataTable" src="http://www.asi-test.com/ASI/wp-content/uploads/2012/01/ExportSheet.png" alt="QTP ExportSheet Method for use with the DataTable" width="560" height="593" /></li>
<li>Also keep in mind that your Test Results Report will show you the data used and created during the test run.  You can view this in the &#8220;Data Table&#8221; in the test report itself.<br />
<img class="aligncenter size-full wp-image-849" title="QTP Test Report showing the Run-Time Data Table" src="http://www.asi-test.com/ASI/wp-content/uploads/2012/01/TestReport1.png" alt="QTP Test Report showing the Run-Time Data Table" width="587" height="646" /><br />
You can then export that data into an external file too, from the report.  The steps are slightly different depending on the version of QTP you are using, but from QTP v11 you would simply select &#8220;File &gt; Export to File&#8230;&#8221; and then select &#8220;Data Table&#8221; from the &#8220;Report type&#8221; drop-down list.  When you click the &#8220;Export&#8221; button you can then specify a new name and location for the data file (.xls).  This will export ALL the data in the datatable (all the worksheets will be exported this way).  Like the previous approach, you now have an external .xls file that you can now do whatever you want with it, including importing it back into the permanent datatable attached to the test script.</li>
</ol>
<p><img class="aligncenter size-full wp-image-848" title="QTP Test Report Export option to save off the run-time data table" src="http://www.asi-test.com/ASI/wp-content/uploads/2012/01/TestReport_Export.png" alt="QTP Test Report Export option to save off the run-time data table" width="408" height="298" /></p>
<div class="al2fb_like_button"><div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#appId=282419851791791&amp;xfbml=1" type="text/javascript"></script>
<fb:like href="http://www.asi-test.com/ASI/qtp-saving-your-test-run-data/" send="true" layout="button_count" show_faces="true" width="450" action="like" font="arial" colorscheme="light" ref="AL2FB"></fb:like></div>]]></content:encoded>
			<wfw:commentRss>http://www.asi-test.com/ASI/qtp-saving-your-test-run-data/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>QTP &#8220;AddWastedTime&#8221; function</title>
		<link>http://www.asi-test.com/ASI/qtp-addwastedtime-function/</link>
		<comments>http://www.asi-test.com/ASI/qtp-addwastedtime-function/#comments</comments>
		<pubDate>Fri, 06 Jan 2012 17:25:30 +0000</pubDate>
		<dc:creator>Shawn</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[QuickTest Pro]]></category>
		<category><![CDATA[Sample Code]]></category>
		<category><![CDATA[Software Testing]]></category>
		<category><![CDATA[addwastedtime]]></category>
		<category><![CDATA[automation]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[duration]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[LoadRunner]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[sample]]></category>
		<category><![CDATA[test]]></category>
		<category><![CDATA[testing]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[tricks]]></category>
		<category><![CDATA[vbscript]]></category>

		<guid isPermaLink="false">http://www.asi-test.com/ASI/?p=825</guid>
		<description><![CDATA[QuickTest Pro Tips &#38; Tricks: This article compliments the post &#8220;QTP Performance Testing for a Single User&#8221; found on my website.  During the process of logging how long a process takes, you may know that you have some processing time that you do not want to take into account.  You may have some &#8220;wait&#8221; statements [...]]]></description>
			<content:encoded><![CDATA[<p>QuickTest Pro Tips &amp; Tricks: This article compliments the post &#8220;<a title="&quot;QTP Performance Testing for a Single User&quot;" href="http://www.asi-test.com/ASI/qtp-performance-testing/">QTP Performance Testing for a Single User</a>&#8221; found on my website.  During the process of logging how long a process takes, you may know that you have some processing time that you do not want to take into account.  You may have some &#8220;wait&#8221; statements in your test script to create some delays for the automation script or potentially a side process that you don&#8217;t want to include in the overall timing.  In this case you would want to use the function &#8220;AddWastedTime&#8221; to your test script. <span id="more-825"></span> This will enable you to either specify a specific amount of time that you want logged as &#8220;Wasted Time&#8221; or you can use the &#8220;MercuryTimers&#8221; to record how long a section of code takes and that is the time you wanted recorded as the &#8220;Wasted Time&#8221;.  Here&#8217;s a simple example of using the &#8220;AddWastedTime&#8221; with the &#8220;Start/End Transaction&#8221; functions and the &#8220;MercuryTimers&#8221;.</p>
<p><img class="aligncenter size-full wp-image-826" title="Example Code1" src="http://www.asi-test.com/ASI/wp-content/uploads/2012/01/Example-Code1.png" alt="QuickTest Pro AddWastedTime function" width="590" height="611" /></p>
<p>Let&#8217;s breakdown this simple script, I have three transaction times being recorded &#8211; &#8220;trans1&#8243;, &#8220;trans2&#8243; and &#8220;trans3&#8243;.  &#8220;trans1&#8243; encapulates &#8220;trans2&#8243;, and &#8220;trans3&#8243; logs its own time at the end of the script.</p>
<p><img class="aligncenter size-full wp-image-827" title="Example Code2" src="http://www.asi-test.com/ASI/wp-content/uploads/2012/01/Example-Code2.png" alt="QuickTest Pro AddWastedTime function" width="590" height="611" /></p>
<p>The timers and duration times breakdown as follows:</p>
<p>&#8220;trans2&#8243; &#8211; this transaction actually completes before the &#8220;trans1&#8243; because it is contained within the &#8220;trans1&#8243; wrapper (nested within the &#8220;trans1&#8243; code), so if we look at the results for &#8220;trans2&#8243; you will see that it contains a &#8220;wait 3&#8243; statement and an &#8220;AddWastedTime&#8221; of 1000 milliseconds (which is 1 second).  In looking at the test results report you can see that the &#8220;Total Duration&#8221; time is 3.0300 seconds (the 3 seconds from the &#8220;wait&#8221; statement and a slight delay for the execution of the statements themselves) and it also logs the &#8220;Wasted Time&#8221; of 1 second.</p>
<p><img class="aligncenter size-full wp-image-829" title="trans2results" src="http://www.asi-test.com/ASI/wp-content/uploads/2012/01/trans2results.png" alt="QuickTest Pro AddWastedTime function Test Results" width="593" height="524" /></p>
<p>&#8220;trans1&#8243; &#8211; this has a total duration time of approximately 12 seconds.  Simply add up the &#8220;wait&#8221; statements contained within the &#8220;trans1&#8243; transaction wrapper and add a slight delay for the execution of the statements themselves.  As you can see in this image the &#8220;Total Duration&#8221; time is 12.1080 seconds.  Now the &#8220;Wasted Time&#8221; is all the &#8220;AddWastedTime&#8221; statements contained within the &#8220;trans1&#8243; wrapper, so this includes the &#8220;Services.AddWastedTime MercuryTimers(&#8220;timer1&#8243;).Stop&#8221; statement (which is a dynamic statement based on the &#8220;MercuryTimers(timer1)&#8221; wrapper around a subset of code (the &#8220;wait 4&#8243; statement in this case &#8211; however this would normally be a real chunk of code)) and the &#8220;Services.AddWastedTime 1000&#8243; which is a hardcoded value where we are saying that &#8220;we want to reduce the time by 1 second&#8221;.  Added together this is 5 seconds with a slight delay for the execution of the statements themselves &#8211; which as you can see in the test results report is 5.0190 seconds of &#8220;Wasted Time&#8221;.</p>
<p><img class="aligncenter size-full wp-image-828" title="trans1results" src="http://www.asi-test.com/ASI/wp-content/uploads/2012/01/trans1results.png" alt="QuickTest Pro AddWastedTime function Test Results" width="593" height="524" /></p>
<p>&#8220;trans3&#8243; &#8211; Finally we have the last transaction time being recorded and notice it is outside of the &#8220;trans1&#8243; wrapper.  So this is self-contained code at the end of the script and logs its own time which in this case is a hardcoded 1 second using the &#8220;Services.AddWastedTime 1000&#8243; statement.  Notice the timers from above do not affect this timer.</p>
<p><img class="aligncenter size-full wp-image-830" title="trans3results" src="http://www.asi-test.com/ASI/wp-content/uploads/2012/01/trans3results.png" alt="QuickTest Pro AddWastedTime function Test Results" width="593" height="524" /></p>
<p>As you can see the &#8220;Wasted Time&#8221; is logged in the Test Results for a normal QTP test process, and realize it is also integrated with LoadRunner and the Business Process Monitor.</p>
<div class="al2fb_like_button"><div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#appId=282419851791791&amp;xfbml=1" type="text/javascript"></script>
<fb:like href="http://www.asi-test.com/ASI/qtp-addwastedtime-function/" send="true" layout="button_count" show_faces="true" width="450" action="like" font="arial" colorscheme="light" ref="AL2FB"></fb:like></div>]]></content:encoded>
			<wfw:commentRss>http://www.asi-test.com/ASI/qtp-addwastedtime-function/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>VBScript InputBox function</title>
		<link>http://www.asi-test.com/ASI/vbscript-inputbox-function/</link>
		<comments>http://www.asi-test.com/ASI/vbscript-inputbox-function/#comments</comments>
		<pubDate>Thu, 05 Jan 2012 18:23:42 +0000</pubDate>
		<dc:creator>Shawn</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[QuickTest Pro]]></category>
		<category><![CDATA[Sample Code]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[example]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[inputbox]]></category>
		<category><![CDATA[sample]]></category>
		<category><![CDATA[vbscript]]></category>

		<guid isPermaLink="false">http://www.asi-test.com/ASI/?p=816</guid>
		<description><![CDATA[QuickTest Pro Tips &#38; Tricks: You can spawn an Edit Box from within your QuickTest Pro test script using the &#8220;InputBox&#8221; VBScript function.  This function will open up an Edit box where you can type in a value.  The help syntax is as follows: Be aware that there are Pros and Cons to using this function [...]]]></description>
			<content:encoded><![CDATA[<p><strong>QuickTest Pro Tips &amp; Tricks:</strong> You can spawn an Edit Box from within your QuickTest Pro test script using the &#8220;<strong>InputBox</strong>&#8221; VBScript function.  This function will open up an Edit box where you can type in a value.  The help syntax is as follows: <span id="more-816"></span></p>
<p><img class="aligncenter size-full wp-image-820" title="HelpSyntax" src="http://www.asi-test.com/ASI/wp-content/uploads/2012/01/HelpSyntax.png" alt="VBScript InputBox Help Syntax" width="600" height="623" /></p>
<p>Be aware that there are <em><span style="text-decoration: underline;">Pros</span> and <span style="text-decoration: underline;">Cons</span></em> to using this function in a QuickTest Pro automation script.</p>
<p><span style="text-decoration: underline;"><strong>Pro:</strong></span> Using this function you can define an Edit box to appear that you can prompt for a value from the user that you can then use in your test script.  The function has several parameters but the most common parameters used are the &#8220;prompt&#8221; (which is the only required parameter), title and default (which is the default value to automatically pre-populate if you want).  The other parameters are used less often.  The value that is entered is then passed back to the script as a return value and can be captured in a variable to be used within your test script.  Here is an example of using it to retrieve a security code during test execution.</p>
<p><img class="aligncenter size-full wp-image-817" title="VBScript Input Box example" src="http://www.asi-test.com/ASI/wp-content/uploads/2012/01/Example1.png" alt="VBScript Input Box example" width="626" height="722" /></p>
<p>Notice in this image how the statement generates this edit box.  You can then enter a value in the edit field to be passed back to the script like in this image.  Notice the value entered into the edit field, it will be passed back as the return value and in this example it will get stored in the variable &#8220;vReturnValue&#8221; based off the example in this image.</p>
<p><img class="aligncenter size-full wp-image-818" title="VBScript Input Box example with value" src="http://www.asi-test.com/ASI/wp-content/uploads/2012/01/Example2.png" alt="VBScript Input Box example with value" width="626" height="722" /></p>
<p>Notice in this final image, the InputBox statement has been executed and we are now paused on the wait statement so that we can examine the variables.  In looking at the variable in the Debug Viewer, notice how the variable has the value that was entered in the edit box.</p>
<p><img class="aligncenter size-full wp-image-819" title="VBScript Input Box example with return value" src="http://www.asi-test.com/ASI/wp-content/uploads/2012/01/Example3.png" alt="VBScript Input Box example with return value" width="626" height="437" /></p>
<p><span style="text-decoration: underline;"><strong>Con:</strong></span> The con to using this function in a QuickTest Pro automation script is that it requires interaction from a user.  The biggest goal that you are always trying to achieve with test automation is to get &#8220;long term unattended testing&#8221; which means your script needs to be able to execute without any user interaction.  This function requires a response from a user and will just sit there forever until it gets a response.  So be careful on using this.  If you really want to use this function then I would recommend putting it at the very beginning of any automated process so that you could enter in all the values immediately and then be able to walk away from the process and let it run independently from you.  However my recommendation on better options for getting a value for your automation is to have this value retrieved from one of these options, retrieve it from:<br />
- a variable or constant from within your test script<br />
- from a text file that the script opens and reads from<br />
- from an environment variable<br />
- or from a parameter passed in from another script</p>
<div class="al2fb_like_button"><div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#appId=282419851791791&amp;xfbml=1" type="text/javascript"></script>
<fb:like href="http://www.asi-test.com/ASI/vbscript-inputbox-function/" send="true" layout="button_count" show_faces="true" width="450" action="like" font="arial" colorscheme="light" ref="AL2FB"></fb:like></div>]]></content:encoded>
			<wfw:commentRss>http://www.asi-test.com/ASI/vbscript-inputbox-function/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>QTP Performance Testing for a Single User</title>
		<link>http://www.asi-test.com/ASI/qtp-performance-testing/</link>
		<comments>http://www.asi-test.com/ASI/qtp-performance-testing/#comments</comments>
		<pubDate>Sat, 24 Dec 2011 18:01:02 +0000</pubDate>
		<dc:creator>Shawn</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[QuickTest Pro]]></category>
		<category><![CDATA[Sample Code]]></category>
		<category><![CDATA[Software Testing]]></category>
		<category><![CDATA[automation]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[LoadRunner]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[sample]]></category>
		<category><![CDATA[test]]></category>
		<category><![CDATA[testing]]></category>
		<category><![CDATA[timers]]></category>
		<category><![CDATA[transaction]]></category>
		<category><![CDATA[variable]]></category>
		<category><![CDATA[vbscript]]></category>

		<guid isPermaLink="false">http://www.asi-test.com/ASI/?p=802</guid>
		<description><![CDATA[Performance testing can be done with QTP, but in a limited scope &#8211; only from a single user standpoint, for functional testing.  Years ago when the &#8220;QTP VUser&#8221; for LoadRunner was introduced they incorporated the &#8220;start_transaction&#8221; &#38; &#8220;end_transaction&#8221; functions.  These are used by LoadRunner for tracking performance timings for load testing, but you can also [...]]]></description>
			<content:encoded><![CDATA[<p>Performance testing can be done with QTP, but in a limited scope &#8211; only from a single user standpoint, for functional testing.  Years ago when the &#8220;QTP VUser&#8221; for LoadRunner was introduced they incorporated the &#8220;start_transaction&#8221; &amp; &#8220;end_transaction&#8221; functions.  These are used by LoadRunner for tracking performance timings for load testing, but you can also use them in a regular QTP test script for functional testing. <span id="more-802"></span>  These statements have been updated to &#8220;Services.StartTransaction &#8220;&lt;transaction name&gt;&#8221; &#8221; and &#8220;Services.EndTransaction &#8220;&lt;same transaction name&gt;&#8221; &#8220;.</p>
<p style="text-align: center;"><img class="size-full wp-image-809 aligncenter" title="StepGenerator" src="http://www.asi-test.com/ASI/wp-content/uploads/2011/12/StepGenerator1.png" alt="QTP Step Generator for StartTransaction" width="356" height="491" /></p>
<p>These statements will log the duration time to the Test Results Report, which will tell you how long the &#8220;process&#8221; that resides between the two statements took to execute.  Typically what you would do is wrap a submission or transaction process to see how long it is taking; like submitting an order or new user profile.  In using the QTP training application we will time the submission of the order, so find the &#8220;Insert Order&#8221; button statement and your synchronization statement to know when the insert process has completed. </p>
<p><img class="aligncenter size-full wp-image-805" title="Test Script" src="http://www.asi-test.com/ASI/wp-content/uploads/2011/12/Script1.png" alt="QTP Test Script" width="592" height="535" /></p>
<p>So just before the &#8220;Insert Order&#8221; button you would put a Services.StartTransaction &#8220;InsertOrder&#8221; statement and once you are synchronized on the success of the submission of the order you will have an Services.EndTransaction &#8220;InsertOrder&#8221; statement (placed right after the sychronization statement).</p>
<p><img class="aligncenter size-full wp-image-806" title="Script with Transaction statements" src="http://www.asi-test.com/ASI/wp-content/uploads/2011/12/Script2.png" alt="QTP Test Script with Transaction statements" width="592" height="501" /></p>
<p>This will tell you how long it took to insert a new order and you can pass or fail this test step based on your functional requirements as to how long is an acceptable timeframe.  These statements will log the results to the Test Results Report directly and appear like this:</p>
<p><img class="aligncenter size-full wp-image-803" title="QTP Test Results" src="http://www.asi-test.com/ASI/wp-content/uploads/2011/12/Results1.png" alt="QTP Test Results for Transaction statements" width="631" height="615" /></p>
<p>The disadvantage of this statement is that it only logs the results to the Test Results Report, so you don&#8217;t have the actual time within the test script in order to code your own logic on passing or failing the statement.  People complained about this for many years and finally they came out with a new function prior to the sale of &#8220;Mercury Interactive&#8221; to &#8220;HP&#8221;, so the function name actually has the old company name contained in it.  The functions are &#8220;MercuryTimers(&#8220;&lt;timer name&gt;&#8221;).Start&#8221; and &#8220;MercuryTimers(&#8220;&lt;timer name&gt;&#8221;).Stop&#8221;.  The Stop function returns the duration time as a return code so you can use it within your test script.  You would use this function the same as the StartTransaction statements; identify were in the test script you want the statements and then type these statements in (note that using the Step Generator will produce the wrong syntax so it is best to just manually type the statement in your test script in the Expert View.</p>
<p><img class="aligncenter size-full wp-image-807" title="ScriptTimers" src="http://www.asi-test.com/ASI/wp-content/uploads/2011/12/ScriptTimers.png" alt="QTP Test Script showing the use of the Timers functions" width="592" height="541" /></p>
<p>Notice that I added a &#8220;msgbox&#8221; statement to display the duration time so that you can see how it is returned as a return value into a variable and can be used in the test script.  Notice that the time is returned in milliseconds.</p>
<p><img class="aligncenter size-full wp-image-811" title="Timing Run" src="http://www.asi-test.com/ASI/wp-content/uploads/2011/12/TimingRun1.png" alt="QTP Test Script using Timers and displaying the returned time value" width="603" height="721" /></p>
<p>The odd thing is that when Mercury added this function to QTP in order to provide you with the duration time as a return code within the script, they didn&#8217;t keep the feature of also logging it to the Test Results Report.  Notice in this image that there is no reference to the fact that the &#8220;MercuryTimers&#8221; function was executed. </p>
<p><img class="aligncenter size-full wp-image-810" title="Timing Report" src="http://www.asi-test.com/ASI/wp-content/uploads/2011/12/TimingReport.png" alt="QTP Test Results Report showing no log of the Timers function" width="631" height="615" /></p>
<p>So if you want to log the time to the Test Results Report (which I highly recommend so that you have a log of the duration time) then you will want to add your own &#8220;Reporter.ReportEvent&#8221; statement.</p>
<p><img class="aligncenter size-full wp-image-808" title="Script Timers" src="http://www.asi-test.com/ASI/wp-content/uploads/2011/12/ScriptTimers2.png" alt="QTP Test Script using Timers in a conditional statement" width="595" height="541" /></p>
<p>And then the report will have entries for each timing and because I used a conditional statement to verify the duration time against the functional requirement of taking less than 6 seconds, I can then pass and fail the statement automatically.</p>
<p><img class="aligncenter size-full wp-image-804" title="Results Timer" src="http://www.asi-test.com/ASI/wp-content/uploads/2011/12/Results2Timer.png" alt="QTP Test Results showing the log of the timers value using the Reporter.ReportEvent statements" width="631" height="486" /></p>
<div class="al2fb_like_button"><div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#appId=282419851791791&amp;xfbml=1" type="text/javascript"></script>
<fb:like href="http://www.asi-test.com/ASI/qtp-performance-testing/" send="true" layout="button_count" show_faces="true" width="450" action="like" font="arial" colorscheme="light" ref="AL2FB"></fb:like></div>]]></content:encoded>
			<wfw:commentRss>http://www.asi-test.com/ASI/qtp-performance-testing/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Changing Test Settings During Test Execution</title>
		<link>http://www.asi-test.com/ASI/changing-test-settings/</link>
		<comments>http://www.asi-test.com/ASI/changing-test-settings/#comments</comments>
		<pubDate>Sun, 06 Nov 2011 18:15:06 +0000</pubDate>
		<dc:creator>Shawn</dc:creator>
				<category><![CDATA[ASI General]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[QuickTest Pro]]></category>
		<category><![CDATA[Sample Code]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[automation]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[iteration]]></category>
		<category><![CDATA[mode]]></category>
		<category><![CDATA[object]]></category>
		<category><![CDATA[sample]]></category>
		<category><![CDATA[settings]]></category>
		<category><![CDATA[sync]]></category>
		<category><![CDATA[synchronization]]></category>
		<category><![CDATA[test]]></category>
		<category><![CDATA[timeout]]></category>

		<guid isPermaLink="false">http://www.asi-test.com/ASI/?p=756</guid>
		<description><![CDATA[QTP Coding Tip: There are a variety of test setting in QuickTest Pro, and you can change the Test Settings in QuickTest Pro from within your test script during test execution if you have a need to.  Some examples are as follows. Changing Object Synchronization Timeout from within a QTP script: oldTimeout=Setting("DefaultTimeOut") Setting("DefaultTimeOut")="19000" currTimeout=Setting("DefaultTimeOut") msgbox [...]]]></description>
			<content:encoded><![CDATA[<p>QTP Coding Tip: There are a variety of test setting in QuickTest Pro, and you can change the Test Settings in QuickTest Pro from within your test script during test execution if you have a need to.  Some examples are as follows.</p>
<p>Changing Object Synchronization Timeout from within a QTP script: <span id="more-756"></span></p>
<table width="680" border="2" align="center" bgcolor="silver">
<tbody>
<tr>
<td><code><span style="color: #000000;">oldTimeout=Setting("DefaultTimeOut")<br />
Setting("DefaultTimeOut")="19000"<br />
currTimeout=Setting("DefaultTimeOut")<br />
msgbox ("old timeout="&amp; oldTimeout&amp;" and the current timeout is: "&amp;currTimeout)</span><br />
</code></td>
</tr>
</tbody>
</table>
<p>To figure out the setting name of other items that you can change, simply open the Test &gt; Settings window and click the Generate script button. This will produce a text file that can be used to launch your QTP instance from a script (basically using the QTP API). We are not going to execute the script but use it to get the proper setting names for the various settings that we can change from within our test script. Open the file in notepad and look at the names. The file should look similar to this:</p>
<table width="680" border="2" align="center" bgcolor="silver">
<tbody>
<tr>
<td><code><span style="color: #000000;">Dim App 'As Application</span><br />
<span style="color: #000000;">Set App = CreateObject("QuickTest.Application")</span><br />
<span style="color: #000000;">App.Launch</span><br />
<span style="color: #000000;">App.Visible = True</span><br />
<span style="color: #000000;">App.Test.Settings.Launchers("Web").Active = True</span><br />
<span style="color: #000000;">App.Test.Settings.Launchers("Web").Browser = "IE"</span><br />
<span style="color: #000000;">App.Test.Settings.Launchers("Web").Address = "http://www.asi-test.com"</span><br />
<span style="color: #000000;">App.Test.Settings.Launchers("Web").CloseOnExit = False</span><br />
<span style="color: #000000;">App.Test.Settings.Launchers("Windows Applications").Active = True</span><br />
<span style="color: #000000;">App.Test.Settings.Launchers("Windows Applications").Applications.RemoveAll</span><br />
<span style="color: #000000;">App.Test.Settings.Launchers("Windows Applications").RecordOnQTDescendants = True</span><br />
<span style="color: #000000;">App.Test.Settings.Launchers("Windows Applications").RecordOnExplorerDescendants = False</span><br />
<span style="color: #000000;">App.Test.Settings.Launchers("Windows Applications").RecordOnSpecifiedApplications = True</span><br />
<span style="color: #000000;">App.Test.Settings.Run.IterationMode = "rngAll"</span><br />
<span style="color: #000000;">App.Test.Settings.Run.StartIteration = 1</span><br />
<span style="color: #000000;">App.Test.Settings.Run.EndIteration = 1</span><br />
<span style="color: #000000;">App.Test.Settings.Run.ObjectSyncTimeOut = 20000</span><br />
<span style="color: #000000;">App.Test.Settings.Run.DisableSmartIdentification = False</span><br />
<span style="color: #000000;">App.Test.Settings.Run.OnError = "Dialog"</span><br />
<span style="color: #000000;">App.Test.Settings.Resources.DataTablePath = ""</span><br />
<span style="color: #000000;">App.Test.Settings.Resources.Libraries.RemoveAll</span><br />
<span style="color: #000000;">App.Test.Settings.Resources.Libraries.Add("ASIFuncLib.qfl")</span><br />
<span style="color: #000000;">App.Test.Settings.Web.BrowserNavigationTimeout = 60000</span><br />
<span style="color: #000000;">App.Test.Settings.Web.ActiveScreenAccess.UserName = ""</span><br />
<span style="color: #000000;">App.Test.Settings.Web.ActiveScreenAccess.Password = ""</span><br />
<span style="color: #000000;">''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''</span><br />
<span style="color: #000000;">' System Local Monitoring settings</span><br />
<span style="color: #000000;">''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''</span><br />
<span style="color: #000000;">App.Test.Settings.LocalSystemMonitor.Enable = false</span><br />
<span style="color: #000000;">''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''</span><br />
<span style="color: #000000;">' Log Tracking settings</span><br />
<span style="color: #000000;">''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''</span><br />
<span style="color: #000000;">With App.Test.Settings.LogTracking</span><br />
<span style="color: #000000;">.IncludeInResults = False</span><br />
<span style="color: #000000;">.Port = 18081</span><br />
<span style="color: #000000;">.IP = "127.10.10.1"</span><br />
<span style="color: #000000;">.MinTriggerLevel = "ERROR"</span><br />
<span style="color: #000000;">.EnableAutoConfig = False</span><br />
<span style="color: #000000;">.RecoverConfigAfterRun = False</span><br />
<span style="color: #000000;">.ConfigFile = ""</span><br />
<span style="color: #000000;">.MinConfigLevel = "WARN"</span><br />
<span style="color: #000000;">End With</span><br />
</code></td>
</tr>
</tbody>
</table>
<p>Other examples of changing settings include:</p>
<p>Changing Object Sync Timeout:</p>
<table width="680" border="2" align="center" bgcolor="silver">
<tbody>
<tr>
<td><code><span style="color: #000000;">oldTimeout=Setting("ObjectSyncTimeOut")<br />
Setting("ObjectSyncTimeOut")="19000"<br />
currTimeout=Setting("ObjectSyncTimeOut")<br />
msgbox ("old timeout="&amp; oldTimeout&amp;" and the current timeout is: "&amp;currTimeout)</span><br />
</code></td>
</tr>
</tbody>
</table>
<p>Changing the Test Iteration Mode:</p>
<table width="680" border="2" align="center" bgcolor="silver">
<tbody>
<tr>
<td><code><span style="color: #000000;">oldRunRange=Setting("IterationMode")<br />
Setting("IterationMode")="rngAll"<br />
currRunRange=Setting("IterationMode")<br />
msgbox ("old run range="&amp; oldRunRange &amp;" and the current run range is: "&amp;currRunRange)</span><br />
</code></td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<div class="al2fb_like_button"><div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#appId=282419851791791&amp;xfbml=1" type="text/javascript"></script>
<fb:like href="http://www.asi-test.com/ASI/changing-test-settings/" send="true" layout="button_count" show_faces="true" width="450" action="like" font="arial" colorscheme="light" ref="AL2FB"></fb:like></div>]]></content:encoded>
			<wfw:commentRss>http://www.asi-test.com/ASI/changing-test-settings/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>VBScript Procedures in QTP</title>
		<link>http://www.asi-test.com/ASI/vbscript-procedures-in-qtp/</link>
		<comments>http://www.asi-test.com/ASI/vbscript-procedures-in-qtp/#comments</comments>
		<pubDate>Thu, 29 Sep 2011 14:31:29 +0000</pubDate>
		<dc:creator>Shawn</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[QuickTest Pro]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[procedure]]></category>
		<category><![CDATA[subroutine]]></category>
		<category><![CDATA[vbscript]]></category>

		<guid isPermaLink="false">http://www.asi-test.com/ASI/?p=703</guid>
		<description><![CDATA[Tips &#38; Tricks Series &#8211; VBScript Procedures Overview If you are using QuickTest Pro, then QTP uses VBScript as the programming language and there are basically two types of procedures in VBScript - Functions and Subroutines.  The main difference between them is  that a Function performs some actions and returns a value while a subroutine is used [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;">Tips &amp; Tricks Series &#8211; VBScript Procedures Overview</p>
<p>If you are using QuickTest Pro, then QTP uses VBScript as the programming language and there are basically two types of procedures in VBScript - Functions and Subroutines.  The main difference between them is <span id="more-703"></span> that a Function performs some actions and returns a value while a subroutine is used to perform some actions but does not return a value. </p>
<p>There is also a concept of private versus public.  If you create a Function or Subroutine at the top of your test script in QTP, then it is private and only that script can call the procedure(s) and use it.  If you add it to a Function Library and add the Function Library reference to the Resources tab in the Test Settings window in QTP, then all the scripts/actions in the test suite (including all called action &amp; reusable actions) can call all the procedures stored in that Function Library (thus it is considered public).</p>
<div class="al2fb_like_button"><div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#appId=282419851791791&amp;xfbml=1" type="text/javascript"></script>
<fb:like href="http://www.asi-test.com/ASI/vbscript-procedures-in-qtp/" send="true" layout="button_count" show_faces="true" width="450" action="like" font="arial" colorscheme="light" ref="AL2FB"></fb:like></div>]]></content:encoded>
			<wfw:commentRss>http://www.asi-test.com/ASI/vbscript-procedures-in-qtp/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Learn QuickTest Pro v10 Online</title>
		<link>http://www.asi-test.com/ASI/learn-quicktest-pro-v10-online/</link>
		<comments>http://www.asi-test.com/ASI/learn-quicktest-pro-v10-online/#comments</comments>
		<pubDate>Wed, 31 Aug 2011 13:00:46 +0000</pubDate>
		<dc:creator>Shawn</dc:creator>
				<category><![CDATA[ASI General]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[QuickTest Pro]]></category>
		<category><![CDATA[Sample Code]]></category>
		<category><![CDATA[Software Testing]]></category>
		<category><![CDATA[Training]]></category>
		<category><![CDATA[automation]]></category>
		<category><![CDATA[checkpoint]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[learn]]></category>
		<category><![CDATA[manual]]></category>
		<category><![CDATA[online]]></category>
		<category><![CDATA[test]]></category>
		<category><![CDATA[vbscript]]></category>

		<guid isPermaLink="false">http://www.asi-test.com/ASI/?p=425</guid>
		<description><![CDATA[QuickTest Pro version 10 Online Training - On Sale for $50!  Includes 12 lessons consisting of 179 online pages of training material!  Begin your learning experience online now; work at your own pace, at home, on the road or where it is convenient for you, and on your own time schedule.  The QuickTest Pro v10 Basics course [...]]]></description>
			<content:encoded><![CDATA[<p><strong><em>Q<span style="text-decoration: underline;">uickTest Pro version 10 Online Training - On Sale for $50!</span></em></strong>  Includes 12 lessons consisting of 179 online pages of training material!  Begin your learning experience online now; work at your own pace, at home, on the road or where it is convenient for you, and on your own time schedule.  The QuickTest Pro v10 Basics course is developed with eLearning presentations containing robust feature explanations, images and some videos showing you exactly how to perform the features without guessing. <span id="more-425"></span>  Online training is great because of the flexibility it provides you!  As a consultant this gives you skills that are in demand and you will make back the cost of the class on your first day of a new consulting engagement.  If you are unemployed this is a worthwhile investment that can give you the edge in an interview and provide you a skillset that is extremely marketable and desirable by companies looking for highly skilled testers.  This can be a small investment for a great new opportunity!</p>
<p>  Online training is great because you can work at your own pace, whenever it is convenient for you.  You can do this work during down-time at work, over your lunch break, at home, or even at your kids sports practice if a wireless connection is available (we&#8217;ve had parents tell us how their kids hockey rink has wireless and so they would bring their laptop to the practice and go over some of the lessons during the practice). </p>
<p>  We have customers from around the world to include the entire United States, Canada, Europe, New Zealand and Australia.  What makes my training so popular is that I have 17 years of experience implementing the product line in real-world scenarios.  So I&#8217;m not some tech writer or an instructor who has never actually used the tool.  I have implemented solutions for some of the biggest corporations with incredible success. Click here for <a href="http://www.asi-test.com/Docs/Company_Reference_List.pdf" target="_blank">PDF file of Company Reference List</a></p>
<p><strong><span style="text-decoration: underline;">Course Details:</span></strong> This lesson includes over 12 lessons consisting of 179 online training pages of material for only $50.  The Lessons covered in this class are:</p>
<ol>
<ol>
<li>Introduction</li>
<li>Record &amp; Playback</li>
<li>Object Repository</li>
<li>Standard Checkpoints</li>
<li>Regular Expressions</li>
<li>Bitmap Checkpoints</li>
<li>Text Checkpoints</li>
<li>Database Checkpoints</li>
<li>Parameterization</li>
<li>Data Driven Testing</li>
<li>Output Values</li>
<li>Actions</li>
</ol>
</ol>
<p><a href="http://www.asi-test.com/ASI/products/">Read more about this class on our &#8220;Products&#8221; page.</a></p>
<div class="al2fb_like_button"><div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#appId=282419851791791&amp;xfbml=1" type="text/javascript"></script>
<fb:like href="http://www.asi-test.com/ASI/learn-quicktest-pro-v10-online/" send="true" layout="button_count" show_faces="true" width="450" action="like" font="arial" colorscheme="light" ref="AL2FB"></fb:like></div>]]></content:encoded>
			<wfw:commentRss>http://www.asi-test.com/ASI/learn-quicktest-pro-v10-online/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>VBScript: Overflow error using CInt function</title>
		<link>http://www.asi-test.com/ASI/vbscript-cint-overflow-error/</link>
		<comments>http://www.asi-test.com/ASI/vbscript-cint-overflow-error/#comments</comments>
		<pubDate>Thu, 25 Aug 2011 17:18:05 +0000</pubDate>
		<dc:creator>Shawn</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[QuickTest Pro]]></category>
		<category><![CDATA[Sample Code]]></category>
		<category><![CDATA[array]]></category>
		<category><![CDATA[automation]]></category>
		<category><![CDATA[cint]]></category>
		<category><![CDATA[clng]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[learn]]></category>
		<category><![CDATA[overflow]]></category>
		<category><![CDATA[sample]]></category>
		<category><![CDATA[Training]]></category>
		<category><![CDATA[variable]]></category>
		<category><![CDATA[vbscript]]></category>

		<guid isPermaLink="false">http://www.asi-test.com/ASI/?p=598</guid>
		<description><![CDATA[Tips &#38; Tricks Series &#8211; Overflow error Ever get an &#8220;Overflow error&#8221; when using the CInt function?  You might encounter this error when you are doing some programming in your test script and doing some data manipulations or calculations.  Let&#8217;s review an example of a situation that could cause this to happen &#8211; a classic [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;">Tips &amp; Tricks Series &#8211; Overflow error</p>
<p>Ever get an &#8220;Overflow error&#8221; when using the CInt function?  You might encounter this error when you are doing some programming in your test script and doing some data manipulations or calculations.  Let&#8217;s review an example of a situation that could cause this to happen &#8211; a classic example would be if you were processing a file where a number could be rather large. <span id="more-598"></span>  Here is a code snippet where the batch size of a data extract was retrieved and generated the Overflow error:</p>
<p><a href="http://www.asi-test.com/ASI/wp-content/uploads/2011/08/ExampleError.jpg"><img class="size-full wp-image-599 alignnone" title="Example VBScript CInt Error in QuickTest Pro" src="http://www.asi-test.com/ASI/wp-content/uploads/2011/08/ExampleError.jpg" alt="Example VBScript CInt Error in QuickTest Pro" width="587" height="517" /></a></p>
<p>&nbsp;</p>
<p>First thing is that in VBScript it only has one data type called Variant.  This can contain either a numeric or string in it and by default it will be a string if there are any other characters in the original value (which is very common).  There are sub-types available to use that you can convert a string or Variant to; they can be one of these:</p>
<table border="1">
<tbody>
<tr>
<td>Subtype</td>
<td>Description</td>
</tr>
<tr>
<td>Empty</td>
<td>Variant is uninitialized. Value is 0 for numeric variables or a zero-length string (&#8220;&#8221;) for string variables.</td>
</tr>
<tr>
<td>Null</td>
<td>Variant intentionally contains no valid data.</td>
</tr>
<tr>
<td>Boolean</td>
<td>Contains either True or False.</td>
</tr>
<tr>
<td>Byte</td>
<td>Contains integer in the range 0 to 255.</td>
</tr>
<tr>
<td>Integer</td>
<td>Contains integer in the range -32,768 to 32,767.</td>
</tr>
<tr>
<td>Currency</td>
<td>-922,337,203,685,477.5808 to 922,337,203,685,477.5807.</td>
</tr>
<tr>
<td>Long</td>
<td>Contains integer in the range -2,147,483,648 to 2,147,483,647.</td>
</tr>
<tr>
<td>Single</td>
<td>Contains a single-precision, floating-point number in the range -3.402823E38 to -1.401298E-45 for negative values; 1.401298E-45 to 3.402823E38 for positive values.</td>
</tr>
<tr>
<td>Double</td>
<td>Contains a double-precision, floating-point number in the range -1.79769313486232E308 to -4.94065645841247E-324 for negative values; 4.94065645841247E-324 to 1.79769313486232E308 for positive values.</td>
</tr>
<tr>
<td>Date (Time)</td>
<td>Contains a number that represents a date between January 1, 100 to December 31, 9999.</td>
</tr>
<tr>
<td>String</td>
<td>Contains a variable-length string that can be up to approximately 2 billion characters in length.</td>
</tr>
<tr>
<td>Object</td>
<td>Contains an object.</td>
</tr>
<tr>
<td>Error</td>
<td>Contains an error number.</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p>Typically what you want to do in order to either add numbers together or compare two numbers in a conditional statement is to convert the variable to a numeric integer.  The way to do that is using the CInt() function.  However if you notice in the table above, an Integer is in the range of -32,768 to 32,767.  The problem is if you are working with an integer that is larger than 32,767.  Like in this example, if you look at the bottom in the Debug Viewer you will see that the Batch Size is actually 56,989 (which is not a surprise when dealing with data extracts).  So this is what is throwing the error because if you look above the error at the test script, you will see on line 103 that CInt is being used.  But if you know that a data element could be large, then use CLng() instead.  This will convert it to a Long which then accepts a range of -2,147,483,648 to 2,147,483,647 and works fine for our situation.</p>
<p>Now if you look at this second image, notice how line 103 now uses CLng and how we have paused on the next line, there is no error and the batch size is correct at 56,989 and notice the type is now &#8220;Long&#8221; to the right of the value.</p>
<p><a href="http://www.asi-test.com/ASI/wp-content/uploads/2011/08/CLngFix.jpg"><img class="size-full wp-image-600 alignnone" title="VBScript CLng Fix to CInt error in QuickTest Pro" src="http://www.asi-test.com/ASI/wp-content/uploads/2011/08/CLngFix.jpg" alt="VBScript CLng Fix to CInt error in QuickTest Pro" width="587" height="516" /></a></p>
<div class="al2fb_like_button"><div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#appId=282419851791791&amp;xfbml=1" type="text/javascript"></script>
<fb:like href="http://www.asi-test.com/ASI/vbscript-cint-overflow-error/" send="true" layout="button_count" show_faces="true" width="450" action="like" font="arial" colorscheme="light" ref="AL2FB"></fb:like></div>]]></content:encoded>
			<wfw:commentRss>http://www.asi-test.com/ASI/vbscript-cint-overflow-error/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>VBScript Date Formats</title>
		<link>http://www.asi-test.com/ASI/vbscript-date-formats/</link>
		<comments>http://www.asi-test.com/ASI/vbscript-date-formats/#comments</comments>
		<pubDate>Tue, 16 Aug 2011 02:11:59 +0000</pubDate>
		<dc:creator>Shawn</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[QuickTest Pro]]></category>
		<category><![CDATA[Sample Code]]></category>
		<category><![CDATA[automation]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[date]]></category>
		<category><![CDATA[format]]></category>
		<category><![CDATA[sample]]></category>
		<category><![CDATA[time]]></category>
		<category><![CDATA[vbscript]]></category>

		<guid isPermaLink="false">http://www.asi-test.com/ASI/?p=550</guid>
		<description><![CDATA[Using a built-in VBScript Date function, you can easily get the current date (or another date using a formula) in a variety of common formats without having to worry about trying to write your own function to format the date into a specific layout.  This can save you a ton of time.  The function is  &#8221;FormatDateTime&#8221; [...]]]></description>
			<content:encoded><![CDATA[<p>Using a built-in VBScript Date function, you can easily get the current date (or another date using a formula) in a variety of common formats without having to worry about trying to write your own function to format the date into a specific layout.  This can save you a ton of time.  The function is <span id="more-550"></span> &#8221;FormatDateTime&#8221; and it takes two parameters (the first one is required and the second parameter is optional).  The syntax is:</p>
<p><strong>FormatDateTime (date[,<em>format]</em>)</strong></p>
<p>Parameter Description <br />
      <em><strong>date     </strong></em>     Required.  Any valid date expression (like Date() or Now()) <br />
      <em><strong>format   </strong></em> Optional.   A value that specifies the date/time format to use.  The values are numerics and they have the following definitions:</p>
<p style="padding-left: 60px;">0 = vbGeneralDate &#8211; Default (or just don&#8217;t put anything in). Returns the date in the format: mm/dd/yy and time if specified in the format: hh:mm:ss PM/AM.<br />
1 = vbLongDate &#8211; Returns the date in the format: weekday, month day, year<br />
2 = vbShortDate &#8211; Returns the date in the format: mm/dd/yy<br />
3 = vbLongTime &#8211; Returns the time in the format: hh:mm:ss PM/AM<br />
4 = vbShortTime &#8211; Return the time in the format: hh:mm<br />
 </p>
<p>Here is an example using the function in QuickTest Pro, assigning each format to a separate variable and displaying the values in the Debug Viewer for you to see.</p>
<p> <img class="alignleft size-full wp-image-551" title="DateFormats" src="http://www.asi-test.com/ASI/wp-content/uploads/2011/08/DateFormats.jpg" alt="Demonstrating the VBScript function FormatDateTime" width="589" height="503" /></p>
<p>This is a really useful function and can save you a ton of time from having to write your own function.  Notice that using the &#8220;Date&#8221; function within this function, I can easily grab a date in the past (like yesterday by specifying &#8220;Date()-1&#8243; and return it in a specific format for use in my script.  This is great for when you need to perform date verifications in your test script.  Notice in this image that yesterday was returned in three different formats.</p>
<p> <a href="http://www.asi-test.com/ASI/wp-content/uploads/2011/08/DateFormats2_Yesterday.jpg"><img class="alignleft size-full wp-image-552" title="DateFormats2_Yesterday" src="http://www.asi-test.com/ASI/wp-content/uploads/2011/08/DateFormats2_Yesterday.jpg" alt="Demonstrating bringing back yesterday's date in various formats" width="588" height="502" /></a></p>
<div class="al2fb_like_button"><div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#appId=282419851791791&amp;xfbml=1" type="text/javascript"></script>
<fb:like href="http://www.asi-test.com/ASI/vbscript-date-formats/" send="true" layout="button_count" show_faces="true" width="450" action="like" font="arial" colorscheme="light" ref="AL2FB"></fb:like></div>]]></content:encoded>
			<wfw:commentRss>http://www.asi-test.com/ASI/vbscript-date-formats/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Redim a multi-dimensional array</title>
		<link>http://www.asi-test.com/ASI/redim-multidimensional-array/</link>
		<comments>http://www.asi-test.com/ASI/redim-multidimensional-array/#comments</comments>
		<pubDate>Mon, 25 Jul 2011 11:59:20 +0000</pubDate>
		<dc:creator>Shawn</dc:creator>
				<category><![CDATA[ASI General]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[QuickTest Pro]]></category>
		<category><![CDATA[Sample Code]]></category>
		<category><![CDATA[array]]></category>
		<category><![CDATA[automation]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[dimensions]]></category>
		<category><![CDATA[multi-dimensional]]></category>
		<category><![CDATA[multiple]]></category>
		<category><![CDATA[redim]]></category>
		<category><![CDATA[vbscript]]></category>

		<guid isPermaLink="false">http://www.asi-test.com/ASI/?p=485</guid>
		<description><![CDATA[Did you know that when it comes to redimensionalizing a multi-dimensional array in VBScript, you can only redimensionalize the last element (which is the columns) not the first element (which is the rows)?  This is true and can be rather annoying and limiting in scope.  Unfortunately you are stuck dealing with it so what this [...]]]></description>
			<content:encoded><![CDATA[<p>Did you know that when it comes to redimensionalizing a multi-dimensional array in VBScript, you can only redimensionalize the last element (which is the columns) not the first element (which is the rows)?  This is true and can be rather annoying and limiting in scope.  Unfortunately you are stuck dealing with it so what this means is that you have to either plan out how large you think the array is, or adjust your structure accordingly. <span id="more-485"></span> What I find is that this is backwards from what I&#8217;m used to in other languages and causes me to have to adjust my vision of the array.  I usually think of the arrays as being similar to tables in a database where the rows are the dynamic elements (various data records) and the columns are the common data elements I&#8217;m tracking; which is also how the data table in QuickTest Pro is structured.  For example if we think of profile data I would envision it being like this:</p>
<p style="text-align: center;"><img class="size-full wp-image-486 aligncenter" title="TableProfileData" src="http://www.asi-test.com/ASI/wp-content/uploads/2011/07/1TableProfileData.jpg" alt="Data table containing profile data" width="539" height="103" /></p>
<p>But this doesn&#8217;t work if you are populating an array on the fly with data. In this example the data is the rows and this is what you would want to grow; but you can&#8217;t resize the row element. So what you really want to do is reverse your layout to make the rows be the fields you are tracking and make the columns your &#8220;individual records of data&#8221; like in this image (ignore the first column in the image as this is just a label so you know what I&#8217;m talking about; it&#8217;s not really part of the actual array):</p>
<p style="text-align: center;"> <img class="size-full wp-image-487 aligncenter" title="2TableReverseArray" src="http://www.asi-test.com/ASI/wp-content/uploads/2011/07/2TableReverseArray.jpg" alt="Data table with column/elements reversed for the array" width="535" height="183" /></p>
<p>Now keep in mind that this is only an issue when you have to redim an existing multi-dimensional array. However if you know the size of a multi-dimensional array then I would stick to the normal array layout where the rows are data records and the columns are the field elements.</p>
<p>The code that controls this would look similar to something like this:</p>
<table width="450" border="2" align="center" bgcolor="silver">
<tbody>
<tr>
<td><code><span style="color: black; font-size: small;">Dim arrProfileData()<br />
ReDim Preserve arrProfileData(7,1)<br />
arrProfileData(0,0)="Joe"<br />
arrProfileData(0,1)="Mary"<br />
arrProfileData(1,0)="Tester"<br />
arrProfileData(1,1)="Jones"<br />
ReDim Preserve arrProfileData(7,4)<br />
arrProfileData(0,2)="Billy"<br />
...etc</span></code></td>
</tr>
</tbody>
</table>
<p>**Note this doesn&#8217;t apply to a single-dimensional array. That you can redim any time since it is dealing with only one element.</p>
<div class="al2fb_like_button"><div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#appId=282419851791791&amp;xfbml=1" type="text/javascript"></script>
<fb:like href="http://www.asi-test.com/ASI/redim-multidimensional-array/" send="true" layout="button_count" show_faces="true" width="450" action="like" font="arial" colorscheme="light" ref="AL2FB"></fb:like></div>]]></content:encoded>
			<wfw:commentRss>http://www.asi-test.com/ASI/redim-multidimensional-array/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

