<?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/"
	xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule">

<channel>
	<title>Automation Beyond &#187; How to</title>
	<atom:link href="http://automation-beyond.com/category/programming/code-examples/feed/" rel="self" type="application/rss+xml" />
	<link>http://automation-beyond.com</link>
	<description>An engineering approach to Software Testing and Test Automation</description>
	<lastBuildDate>Fri, 20 Apr 2012 13:30:04 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
<creativeCommons:license>http://creativecommons.org/licenses/by-nc-nd/3.0/</creativeCommons:license>		<item>
		<title>TestComplete Forms &#8211; Using Custom Events</title>
		<link>http://automation-beyond.com/2012/04/17/testcomplete-custom-events/</link>
		<comments>http://automation-beyond.com/2012/04/17/testcomplete-custom-events/#comments</comments>
		<pubDate>Tue, 17 Apr 2012 10:14:48 +0000</pubDate>
		<dc:creator>Albert Gareev</dc:creator>
				<category><![CDATA[How to]]></category>
		<category><![CDATA[Routines]]></category>
		<category><![CDATA[Source code]]></category>
		<category><![CDATA[2. Testing]]></category>
		<category><![CDATA[3. Automation]]></category>
		<category><![CDATA[automated]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[Configure]]></category>
		<category><![CDATA[controls]]></category>
		<category><![CDATA[Custom]]></category>
		<category><![CDATA[Dialog]]></category>
		<category><![CDATA[dynamically]]></category>
		<category><![CDATA[event]]></category>
		<category><![CDATA[Example]]></category>
		<category><![CDATA[form]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[GUI]]></category>
		<category><![CDATA[Input]]></category>
		<category><![CDATA[interface]]></category>
		<category><![CDATA[onchange]]></category>
		<category><![CDATA[parameter]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[source]]></category>
		<category><![CDATA[test]]></category>
		<category><![CDATA[testcomplete]]></category>
		<category><![CDATA[VBScript]]></category>

		<guid isPermaLink="false">http://automation-beyond.com/?p=5052</guid>
		<description><![CDATA[Parent page: Using GUI Forms in TestComplete Even though automation scripts are intended to drive the application under test there are cases when communication with tester is required. With TestComplete, we have a vast arsenal of predefined GUI controls for that (and those, acquainted with Delphi, will be pleasantly surprised by the way it’s organized). [...]]]></description>
			<content:encoded><![CDATA[
<div class="topsy_widget_data topsy_theme_blue" style="float: right;margin-left: 0.75em; background: url(data:,%7B%20%22url%22%3A%20%22http%253A%252F%252Fautomation-beyond.com%252F2012%252F04%252F17%252Ftestcomplete-custom-events%252F%22%2C%20%22shorturl%22%3A%20%22http%3A%2F%2Fbit.ly%2FJwqw8D%22%2C%20%22style%22%3A%20%22big%22%2C%20%22title%22%3A%20%22TestComplete%20Forms%20-%20Using%20Custom%20Events%22%20%7D);"></div>
<p>Parent page: <a href="http://automation-beyond.com/chapters/tutorials/gui-forms-tc/" target="_blank">Using GUI Forms in TestComplete</a></p>
<p>Even though automation scripts are intended to drive the application under test there are cases when communication with tester is required. With TestComplete, we have a vast arsenal of predefined GUI controls for that (and those, acquainted with Delphi, will be pleasantly surprised by the way it’s organized).</p>
<p>Today’s post provides an example of creating and using dialog with custom event handlers &#8211; whenever script user provides input, event handler may be used to provide a customized response.<br />
In the scope of the exercise let&#8217;s use the following task.</p>
<ul>
<li>Setup form prompts to choose an environment where test plan is to be run</li>
<li>User can choose one of predefined environments: DEV, SIT, UAT</li>
<li>Receives a response as a url of the environment</li>
<li>User can leave suggested by default test data file or can type filepath directly</li>
</ul>
<p>&nbsp;</p>
<h4>Preparing Modal Form</h4>
<p>We begin with a <a href="http://automation-beyond.com/2012/04/09/adding-gui-forms-in-testcomplete-project/" target="_blank">sample form</a>.</p>
<p><div style="position: relative; z-index:1;"><script type="text/javascript"><!--
google_ad_client = "pub-4470793787913935";
/* Banner 468x60 */
google_ad_slot = "8933038987";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div></p>
<h4>Add Edit Controls, Buttons, and Labels</h4>
<p><img class="alignnone size-full wp-image-5055" title="SetupForm" src="http://automation-beyond.com/wp/wp-content/uploads/2012/04/SetupForm.png" alt="" width="262" height="318" /></p>
<h4>Set Object Properties</h4>
<h5>Form</h5>
<ul>
<li>Name – object name to use in the code; ‘Security’ in my example</li>
<li>Caption – title of the window when the form is displayed</li>
</ul>
<h5>Label controls</h5>
<ul>
<li>Caption – displayed text</li>
</ul>
<h5>Edit Box Control</h5>
<ul>
<li>Name – object name to use in the code; ‘ShowUrl’ in my example</li>
<li>Text - initial value</li>
<li>ReadOnly = True &#8211; because user can&#8217;t input Url directly</li>
</ul>
<h5>Combo Box Control</h5>
<ul>
<li>Name – object name to use in the code; ‘Environment’/&#8217;TestData&#8217; in my example</li>
<li>Properties.Items &#8211; items to select; &#8216;DEV&#8217;, &#8216;SIT&#8217;, &#8216;UAT&#8217; in my example</li>
<li>ItemIndex = 0 &#8211; initial selection</li>
<li>Properties.DropDownListStyle = lsFixedList &#8211; for Environment combobox</li>
<li>Properties.DropDownListStyle = lsEditList &#8211; for TestData combobox</li>
</ul>
<h5>Buttons</h5>
<ul>
<li>Caption – displayed text; ‘OK’/&#8217;Cancel’ in my example</li>
<li>Cancel = True – for ‘Cancel’ button</li>
<li>ModalResult = mrCancel &#8211; for ‘Cancel’ button</li>
<li>Default = True – for ‘OK’ button</li>
<li>ModalResult = mrOK &#8211; for ‘OK’ button</li>
</ul>
<p>&nbsp;</p>
<h4>Set Event Handler</h4>
<h5>Properties</h5>
<p><img class="alignnone size-full wp-image-5059" style="border: black 1px solid;" title="Events" src="http://automation-beyond.com/wp/wp-content/uploads/2012/04/Events.png" alt="" width="631" height="374" /></p>
<h5>Path</h5>
<p><a href="http://automation-beyond.com/wp/wp-content/uploads/2012/04/Handler.png"><img class="alignnone size-full wp-image-5060" title="Handler" src="http://automation-beyond.com/wp/wp-content/uploads/2012/04/Handler.png" alt="" width="500" height="470" /></a></p>
<h5>Code</h5>
<pre class="brush: vb; title: ;">

Public Sub Setup_Environment_OnChange(Sender)
  Dim sEnvironment

  sEnvironment = UserForms.Setup.Environment.Text

  Select Case sEnvironment
    Case &quot;DEV&quot;
      UserForms.Setup.ShowUrl.Text = &quot;http://dev/&quot;
      UserForms.Setup.TestData.Text = &quot;W:\Test Suite\Data\DEV.xlsx&quot;
    Case &quot;SIT&quot;
      UserForms.Setup.ShowUrl.Text = &quot;http://sit/&quot;
      UserForms.Setup.TestData.Text = &quot;W:\Test Suite\Data\SIT.xlsx&quot;
    Case &quot;UAT&quot;
      UserForms.Setup.ShowUrl.Text = &quot;http://uat/&quot;
      UserForms.Setup.TestData.Text = &quot;W:\Test Suite\Data\UAT.xlsx&quot;
  End Select

End Sub
</pre>
<h4>Example</h4>
<p><script type="text/javascript"><!--
google_ad_client = "pub-4470793787913935";
/* 4 links text line */
google_ad_slot = "5367351963";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>
<pre class="brush: vb; title: ;">
Public Function Form1()
  Dim objDlg
  Dim sEnvironment, sTestData
  Dim Result

  'Get object's instance
  Set objDlg = UserForms.Setup

  'Execute
  Result = objDlg.ShowModal

  If Result = mrOK Then
    'retrieve the selected input
    sEnvironment = objDlg.Environment.Text
    sTestData = objDlg.TestData.Text
  Else
    'Respond
    MsgBox &quot;Execution cancelled&quot;, vbOKOnly
    'exit function or finalize execution
  End If

End Function
</pre>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://automation-beyond.com/2009/08/24/great-plains-automation/" rel="bookmark" class="crp_title">MS Dynamics Great Plains: availability for Test Automation</a></li><li><a href="http://automation-beyond.com/2009/08/26/dynamics-great-plains-gui/" rel="bookmark" class="crp_title">MS Dynamics Great Plains: GUI Platform (automation perspective)</a></li><li><a href="http://automation-beyond.com/2012/04/09/adding-gui-forms-in-testcomplete-project/" rel="bookmark" class="crp_title">Adding GUI forms in TestComplete project</a></li><li><a href="http://automation-beyond.com/2010/09/07/anti-sleep-function2/" rel="bookmark" class="crp_title">Anti sleep function (TestComplete, VBScript, LLPlayer)</a></li><li><a href="http://automation-beyond.com/2007/04/10/links-dot-net-objects/" rel="bookmark" class="crp_title">Link-a-log: Dot NET objects</a></li></ul></div>
]]></content:encoded>
			<wfw:commentRss>http://automation-beyond.com/2012/04/17/testcomplete-custom-events/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>TestComplete – &#8220;UserName/Password&#8221; Form</title>
		<link>http://automation-beyond.com/2012/04/16/testcomplete-username-password-form/</link>
		<comments>http://automation-beyond.com/2012/04/16/testcomplete-username-password-form/#comments</comments>
		<pubDate>Mon, 16 Apr 2012 10:34:35 +0000</pubDate>
		<dc:creator>Albert Gareev</dc:creator>
				<category><![CDATA[How to]]></category>
		<category><![CDATA[Routines]]></category>
		<category><![CDATA[Source code]]></category>
		<category><![CDATA[2. Testing]]></category>
		<category><![CDATA[3. Automation]]></category>
		<category><![CDATA[automated]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[Configure]]></category>
		<category><![CDATA[Custom]]></category>
		<category><![CDATA[Dialog]]></category>
		<category><![CDATA[dynamically]]></category>
		<category><![CDATA[Example]]></category>
		<category><![CDATA[form]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[GUI]]></category>
		<category><![CDATA[Input]]></category>
		<category><![CDATA[interface]]></category>
		<category><![CDATA[not store]]></category>
		<category><![CDATA[parameter]]></category>
		<category><![CDATA[password]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[source]]></category>
		<category><![CDATA[test]]></category>
		<category><![CDATA[testcomplete]]></category>
		<category><![CDATA[username]]></category>
		<category><![CDATA[VBScript]]></category>

		<guid isPermaLink="false">http://automation-beyond.com/?p=5041</guid>
		<description><![CDATA[Parent page: Using GUI Forms in TestComplete Even though automation scripts are intended to drive the application under test there are cases when communication with tester is required. With TestComplete, we have a vast arsenal of predefined GUI controls for that (and those, acquainted with Delphi, will be pleasantly surprised by the way it’s organized). [...]]]></description>
			<content:encoded><![CDATA[
<div class="topsy_widget_data topsy_theme_blue" style="float: right;margin-left: 0.75em; background: url(data:,%7B%20%22url%22%3A%20%22http%253A%252F%252Fautomation-beyond.com%252F2012%252F04%252F16%252Ftestcomplete-username-password-form%252F%22%2C%20%22shorturl%22%3A%20%22http%3A%2F%2Fbit.ly%2FHYWCcF%22%2C%20%22style%22%3A%20%22big%22%2C%20%22title%22%3A%20%22TestComplete%20%E2%80%93%20%5C%22UserName%2FPassword%5C%22%20Form%22%20%7D);"></div>
<p>Parent page: <a href="http://automation-beyond.com/chapters/tutorials/gui-forms-tc/" target="_blank">Using GUI Forms in TestComplete</a></p>
<p>Even though automation scripts are intended to drive the application under test there are cases when communication with tester is required. With TestComplete, we have a vast arsenal of predefined GUI controls for that (and those, acquainted with Delphi, will be pleasantly surprised by the way it’s organized).</p>
<p>Today&#8217;s post provides an example of creating and using ‘Username/Password’ dialog.<br />
But, first, a couple of words why automation scripts would need one.</p>
<p>No, this is not an authorization to run the scripts. This is for the scripts.<br />
Maybe you need to connect to the database. Or run the scripts with administrator&#8217;s permission. Or it&#8217;s just a security requirement from your stakeholders.</p>
<p>Whatever it is, you better not store such sensitive data in a file or the source code. Make them exist only during run-time.</p>
<h4>Preparing Modal Form</h4>
<p>We begin with a <a href="http://automation-beyond.com/2012/04/09/adding-gui-forms-in-testcomplete-project/" target="_blank">sample form</a>.</p>
<p><div style="position: relative; z-index:1;"><script type="text/javascript"><!--
google_ad_client = "pub-4470793787913935";
/* Banner 468x60 */
google_ad_slot = "8933038987";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div></p>
<h4>Add Edit Controls, Buttons, and Labels</h4>
<p><img class="alignnone size-full wp-image-5046" style="border: black 1px solid;" title="AuthForm" src="http://automation-beyond.com/wp/wp-content/uploads/2012/04/AuthForm.png" alt="" width="409" height="342" /></p>
<h4>Set Object Properties</h4>
<h5>Form</h5>
<ul>
<li>Name &#8211; object name to use in the code; &#8216;Security&#8217; in my example</li>
<li>Caption &#8211; title of the window when the form is displayed</li>
</ul>
<h5>Label controls</h5>
<ul>
<li>Caption &#8211; displayed text</li>
</ul>
<h5>Edit Box Controls</h5>
<ul>
<li>Name &#8211; object name to use in the code; &#8216;EditUsername&#8217;/'EditPassword&#8217; in my example</li>
<li>EditPassword.Properties.EchoMode = eemPassword &#8211; to mask password characters</li>
</ul>
<h5>Buttons</h5>
<ul>
<li>Caption &#8211; displayed text; &#8216;OK&#8217;/'Cancel&#8217; in my example</li>
<li>Cancel = True &#8211; for &#8216;Cancel&#8217; button</li>
<li>ModalResult = mrCancel - for &#8216;Cancel&#8217; button</li>
<li>Default = True &#8211; for &#8216;OK&#8217; button</li>
<li>ModalResult = mrOK - for &#8216;OK&#8217; button</li>
</ul>
<h4>Example</h4>
<p><script type="text/javascript"><!--
google_ad_client = "pub-4470793787913935";
/* 4 links text line */
google_ad_slot = "5367351963";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>
<pre class="brush: vb; title: ;">
  Dim objDlg
  Dim sUsername, sPassword
  Dim Result

  'Get object's instance
  Set objDlg = UserForms.Security

  'Execute
  Result = objDlg.ShowModal

  If Result = mrOK Then
    'retrieve the input
    sUsername = objDlg.EditUsername.Text
    sPassword = objDlg.EditPassword.Text
  Else
    'Respond
    MsgBox &quot;Execution cancelled&quot;, vbOKOnly
    'exit function or finalize execution
  End If
</pre>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://automation-beyond.com/2008/10/10/on-functional-decomposition/" rel="bookmark" class="crp_title">On Functional Decomposition</a></li><li><a href="http://automation-beyond.com/2007/01/22/on-hard-coding-of-test-data-2/" rel="bookmark" class="crp_title">On hard-coding of test data (2)</a></li><li><a href="http://automation-beyond.com/2007/01/20/on-hard-coding-of-test-data-1/" rel="bookmark" class="crp_title">On hard-coding of test data (1)</a></li><li><a href="http://automation-beyond.com/2009/01/23/associaterecords/" rel="bookmark" class="crp_title">AssociateRecords (QTP, TestComplete, VBScript)</a></li><li><a href="http://automation-beyond.com/2012/04/09/adding-gui-forms-in-testcomplete-project/" rel="bookmark" class="crp_title">Adding GUI forms in TestComplete project</a></li></ul></div>
]]></content:encoded>
			<wfw:commentRss>http://automation-beyond.com/2012/04/16/testcomplete-username-password-form/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>TestComplete &#8211; Using &#8216;File Open&#8217; Dialog</title>
		<link>http://automation-beyond.com/2012/04/10/testcomplete-using-file-open-dialog/</link>
		<comments>http://automation-beyond.com/2012/04/10/testcomplete-using-file-open-dialog/#comments</comments>
		<pubDate>Tue, 10 Apr 2012 10:41:36 +0000</pubDate>
		<dc:creator>Albert Gareev</dc:creator>
				<category><![CDATA[How to]]></category>
		<category><![CDATA[Routines]]></category>
		<category><![CDATA[Source code]]></category>
		<category><![CDATA[2. Testing]]></category>
		<category><![CDATA[3. Automation]]></category>
		<category><![CDATA[automated]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[Configure]]></category>
		<category><![CDATA[Custom]]></category>
		<category><![CDATA[Dialog]]></category>
		<category><![CDATA[Example]]></category>
		<category><![CDATA[file]]></category>
		<category><![CDATA[form]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[GUI]]></category>
		<category><![CDATA[Input]]></category>
		<category><![CDATA[interface]]></category>
		<category><![CDATA[open]]></category>
		<category><![CDATA[parameter]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[source]]></category>
		<category><![CDATA[test]]></category>
		<category><![CDATA[testcomplete]]></category>
		<category><![CDATA[VBScript]]></category>

		<guid isPermaLink="false">http://automation-beyond.com/?p=5014</guid>
		<description><![CDATA[Parent page: Using GUI Forms in TestComplete Even though automation scripts are intended to drive the application under test there are cases when communication with tester is required. With TestComplete, we have a vast arsenal of predefined GUI controls for that (and those, acquainted with Delphi, will be pleasantly surprised by the way it’s organized). [...]]]></description>
			<content:encoded><![CDATA[
<div class="topsy_widget_data topsy_theme_blue" style="float: right;margin-left: 0.75em; background: url(data:,%7B%20%22url%22%3A%20%22http%253A%252F%252Fautomation-beyond.com%252F2012%252F04%252F10%252Ftestcomplete-using-file-open-dialog%252F%22%2C%20%22shorturl%22%3A%20%22http%3A%2F%2Fbit.ly%2FIeZnv4%22%2C%20%22style%22%3A%20%22big%22%2C%20%22title%22%3A%20%22TestComplete%20-%20Using%20%27File%20Open%27%20Dialog%22%20%7D);"></div>
<p>Parent page: <a href="http://automation-beyond.com/chapters/tutorials/gui-forms-tc/" target="_blank">Using GUI Forms in TestComplete</a></p>
<p>Even though automation scripts are intended to drive the application under test there are cases when communication with tester is required. With TestComplete, we have a vast arsenal of predefined GUI controls for that (and those, acquainted with Delphi, will be pleasantly surprised by the way it’s organized).</p>
<p>The second post in the series provides an example of using &#8216;File Open&#8217; dialog.</p>
<p>We begin with a <a href="http://automation-beyond.com/2012/04/09/adding-gui-forms-in-testcomplete-project/" target="_blank">sample form</a>.</p>
<h4>Add &#8216;TOpenDialog&#8217; Icon</h4>
<p><img class="alignnone size-full wp-image-5016" style="border: black 1px solid;" title="FormAddDialog" src="http://automation-beyond.com/wp/wp-content/uploads/2012/03/FormAddDialog.png" alt="" width="516" height="366" /></p>
<p><div style="position: relative; z-index:1;"><script type="text/javascript"><!--
google_ad_client = "pub-4470793787913935";
/* Banner 468x60 */
google_ad_slot = "8933038987";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div></p>
<h4>Set Dialog Properties</h4>
<p><img class="alignnone size-full wp-image-5017" style="border: black 1px solid;" title="DialogProperties" src="http://automation-beyond.com/wp/wp-content/uploads/2012/03/DialogProperties.png" alt="" width="409" height="663" /></p>
<p>The property names are straight-forward, so I cover only main ones.</p>
<ul>
<li>Name &#8211; object name to use in the code;</li>
<li>InitialDir &#8211; folder to begin browsing from;</li>
<li>Filter &#8211; to specify what filetypes to display;</li>
<li>FileName &#8211; will contain the full pathname of the file upon successful selection;</li>
<li>Options\ofPathMustExist &#8211; set <strong>True</strong> if selection accepts only existing files;</li>
<li>Options\ofFileMustExist - set <strong>True</strong> if selection accepts only existing files;</li>
</ul>
<p>These properties can be set in the Property Editor or directly in the code at run-time as in the example below.</p>
<h4>Example</h4>
<p><script type="text/javascript"><!--
google_ad_client = "pub-4470793787913935";
/* 4 links text line */
google_ad_slot = "5367351963";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>
<pre class="brush: vb; title: ;">
'Get object's instance
Set objDlg = UserForms.PlanOpenDlg
'Assign path
objDlg.OpenDialog.InitialDir = &quot;C:\FakePath\Test Plans&quot;
'Set filter
objDlg.OpenDialog.Filter = &quot;XML Test Plans (*.xml)|*.XML&quot;
'Execute as modal and get the status
If objDlg.OpenDialog.Execute Then
  'retrieve the selected file
  sTestPlan = objDlg.OpenDialog.FileName
Else
  'Respond
  MsgBox &quot;Execution cancelled&quot;, vbOKOnly
  'exit function or finalize execution
End If
</pre>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://automation-beyond.com/2010/10/26/how-to-save-as/" rel="bookmark" class="crp_title">How to &#8220;Save As&#8221; text template</a></li><li><a href="http://automation-beyond.com/2010/08/24/testcomplete-gui-extensibility/" rel="bookmark" class="crp_title">TestComplete GUI extensibility with Object Mapping</a></li><li><a href="http://automation-beyond.com/2009/11/19/using-built-in-and-system-dialogs-in-qtp/" rel="bookmark" class="crp_title">Using built-in and system dialogs in QTP</a></li><li><a href="http://automation-beyond.com/2010/04/08/using-locked-excel-workbook/" rel="bookmark" class="crp_title">How to use test data from a locked Excel Workbook (QTP, VBScript)</a></li><li><a href="http://automation-beyond.com/2009/10/17/how-to-open-excel-workbook-qtp-vbscript/" rel="bookmark" class="crp_title">How to open Excel workbook (QTP, VBScript)</a></li></ul></div>
]]></content:encoded>
			<wfw:commentRss>http://automation-beyond.com/2012/04/10/testcomplete-using-file-open-dialog/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adding GUI forms in TestComplete project</title>
		<link>http://automation-beyond.com/2012/04/09/adding-gui-forms-in-testcomplete-project/</link>
		<comments>http://automation-beyond.com/2012/04/09/adding-gui-forms-in-testcomplete-project/#comments</comments>
		<pubDate>Mon, 09 Apr 2012 10:43:59 +0000</pubDate>
		<dc:creator>Albert Gareev</dc:creator>
				<category><![CDATA[How to]]></category>
		<category><![CDATA[Routines]]></category>
		<category><![CDATA[Source code]]></category>
		<category><![CDATA[2. Testing]]></category>
		<category><![CDATA[3. Automation]]></category>
		<category><![CDATA[automated]]></category>
		<category><![CDATA[Configure]]></category>
		<category><![CDATA[Custom]]></category>
		<category><![CDATA[Dialog]]></category>
		<category><![CDATA[Example]]></category>
		<category><![CDATA[form]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[GUI]]></category>
		<category><![CDATA[Input]]></category>
		<category><![CDATA[interface]]></category>
		<category><![CDATA[parameter]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[test]]></category>
		<category><![CDATA[testcomplete]]></category>
		<category><![CDATA[VBScript]]></category>

		<guid isPermaLink="false">http://automation-beyond.com/?p=4994</guid>
		<description><![CDATA[Parent page: Using GUI Forms in TestComplete Even though automation scripts are intended to drive the application under test there are cases when communication with tester is required. With TestComplete, we have a vast arsenal of predefined GUI controls for that (and those, acquainted with Delphi, will be pleasantly surprised by the way it&#8217;s organized). [...]]]></description>
			<content:encoded><![CDATA[
<div class="topsy_widget_data topsy_theme_blue" style="float: right;margin-left: 0.75em; background: url(data:,%7B%20%22url%22%3A%20%22http%253A%252F%252Fautomation-beyond.com%252F2012%252F04%252F09%252Fadding-gui-forms-in-testcomplete-project%252F%22%2C%20%22shorturl%22%3A%20%22http%3A%2F%2Fbit.ly%2FHmqykl%22%2C%20%22style%22%3A%20%22big%22%2C%20%22title%22%3A%20%22Adding%20GUI%20forms%20in%20TestComplete%20project%22%20%7D);"></div>
<p>Parent page: <a href="http://automation-beyond.com/chapters/tutorials/gui-forms-tc/" target="_blank">Using GUI Forms in TestComplete</a></p>
<p>Even though automation scripts are intended to drive the application under test there are cases when communication with tester is required. With TestComplete, we have a vast arsenal of predefined GUI controls for that (and those, acquainted with Delphi, will be pleasantly surprised by the way it&#8217;s organized).</p>
<p>Today&#8217;s post walks through the main preparation steps.</p>
<h4>Add New Project Item</h4>
<p><img class="alignnone size-full wp-image-4997" style="border: black 1px solid;" title="AddNewItem" src="http://automation-beyond.com/wp/wp-content/uploads/2012/02/AddNewItem.png" alt="" width="585" height="313" /></p>
<h4>Select Project Item Type &#8211; &#8216;User Forms&#8217;</h4>
<p><img class="alignnone size-full wp-image-4998" style="border: black 1px solid;" title="CreateProjectItem" src="http://automation-beyond.com/wp/wp-content/uploads/2012/02/CreateProjectItem.png" alt="" width="522" height="348" /></p>
<h4>Add New Item into &#8216;User Forms&#8217;</h4>
<p><img class="alignnone size-full wp-image-4999" style="border: black 1px solid;" title="AddNewForm" src="http://automation-beyond.com/wp/wp-content/uploads/2012/02/AddNewForm.png" alt="" width="574" height="412" /></p>
<h4>Add New Item into &#8216;User Forms&#8217; &#8211; Create a New Form</h4>
<p><img class="alignnone size-full wp-image-5000" style="border: black 1px solid;" title="CreateNewForm" src="http://automation-beyond.com/wp/wp-content/uploads/2012/02/CreateNewForm.png" alt="" width="519" height="382" /></p>
<p><div style="position: relative; z-index:1;"><script type="text/javascript"><!--
google_ad_client = "pub-4470793787913935";
/* Banner 468x60 */
google_ad_slot = "8933038987";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div></p>
<h4>You end up in the Form Editor</h4>
<p><img class="alignnone size-full wp-image-5012" style="border: black 1px solid;" title="FormView" src="http://automation-beyond.com/wp/wp-content/uploads/2012/03/FormView.png" alt="" width="597" height="721" /></p>
<p><script type="text/javascript"><!--
google_ad_client = "pub-4470793787913935";
/* 4 links text line */
google_ad_slot = "5367351963";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>
<p>Note that you can add GUI controls from 4 main categories:</p>
<ul>
<li>&#8216;Editors&#8217;</li>
<li>&#8216;Helpers&#8217;</li>
<li>&#8216;Extra&#8217;</li>
<li>&#8216;Dialogs&#8217;</li>
<li>&#8216;Buttons&#8217;</li>
</ul>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://automation-beyond.com/2012/04/16/testcomplete-username-password-form/" rel="bookmark" class="crp_title">TestComplete – &#8220;UserName/Password&#8221; Form</a></li><li><a href="http://automation-beyond.com/2012/04/10/testcomplete-using-file-open-dialog/" rel="bookmark" class="crp_title">TestComplete &#8211; Using &#8216;File Open&#8217; Dialog</a></li><li><a href="http://automation-beyond.com/2012/04/17/testcomplete-custom-events/" rel="bookmark" class="crp_title">TestComplete Forms &#8211; Using Custom Events</a></li><li><a href="http://automation-beyond.com/2007/04/10/links-dot-net-objects/" rel="bookmark" class="crp_title">Link-a-log: Dot NET objects</a></li><li><a href="http://automation-beyond.com/2009/08/24/great-plains-automation/" rel="bookmark" class="crp_title">MS Dynamics Great Plains: availability for Test Automation</a></li></ul></div>
]]></content:encoded>
			<wfw:commentRss>http://automation-beyond.com/2012/04/09/adding-gui-forms-in-testcomplete-project/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to select random list item (QTP, VBScript)</title>
		<link>http://automation-beyond.com/2011/11/24/how-to-select-random-list-item/</link>
		<comments>http://automation-beyond.com/2011/11/24/how-to-select-random-list-item/#comments</comments>
		<pubDate>Thu, 24 Nov 2011 10:36:55 +0000</pubDate>
		<dc:creator>Albert Gareev</dc:creator>
				<category><![CDATA[How to]]></category>
		<category><![CDATA[Source code]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[Example]]></category>
		<category><![CDATA[How]]></category>
		<category><![CDATA[item]]></category>
		<category><![CDATA[list]]></category>
		<category><![CDATA[pick]]></category>
		<category><![CDATA[QTP]]></category>
		<category><![CDATA[random]]></category>
		<category><![CDATA[rnd]]></category>
		<category><![CDATA[sample]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[select]]></category>
		<category><![CDATA[snippet]]></category>
		<category><![CDATA[source]]></category>
		<category><![CDATA[to]]></category>
		<category><![CDATA[VBScript]]></category>
		<category><![CDATA[WebList]]></category>

		<guid isPermaLink="false">http://automation-beyond.com/?p=4723</guid>
		<description><![CDATA[Description  Get object reference. Get total number of items in the list. Generate an index within the given range. Select item by index. Implementation Dim objPage, objList Dim boolRC Dim intItemsCount, intRndItem 'Assumptions: ' &#34;Google Advanced Search&#34; page is up ' &#34;Results per page&#34; WebList exists and enabled 'Get page object Set objPage = Browser(&#34;CreationTime:=0&#34;).Page(&#34;title:=Google Advanced Search&#34;) [...]]]></description>
			<content:encoded><![CDATA[
<div class="topsy_widget_data topsy_theme_blue" style="float: right;margin-left: 0.75em; background: url(data:,%7B%20%22url%22%3A%20%22http%253A%252F%252Fautomation-beyond.com%252F2011%252F11%252F24%252Fhow-to-select-random-list-item%252F%22%2C%20%22shorturl%22%3A%20%22http%3A%2F%2Fbit.ly%2Fu8ZG6A%22%2C%20%22style%22%3A%20%22big%22%2C%20%22title%22%3A%20%22How%20to%20select%20random%20list%20item%20%28QTP%2C%20VBScript%29%22%20%7D);"></div>
<p><div style="position: relative; z-index:1;"><script type="text/javascript"><!--
google_ad_client = "pub-4470793787913935";
/* Banner 468x60 */
google_ad_slot = "8933038987";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div></p>
<h4>Description </h4>
<p>Get object reference. Get total number of items in the list. Generate an index within the given range. Select item by index.</p>
<h4>Implementation</h4>
<p><script type="text/javascript"><!--
google_ad_client = "pub-4470793787913935";
/* 4 links text line */
google_ad_slot = "5367351963";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>
<pre class="brush: vb; title: ;">

Dim objPage, objList
Dim boolRC
Dim intItemsCount, intRndItem

'Assumptions:
' &quot;Google Advanced Search&quot; page is up
' &quot;Results per page&quot; WebList exists and enabled

'Get page object
Set objPage = Browser(&quot;CreationTime:=0&quot;).Page(&quot;title:=Google Advanced Search&quot;)
boolRC = objPage.Exist(0)
If Not boolRC Then
 ExitTest
End If

'Get list object
Set objList = objPage.WebList(&quot;name:=num&quot;)
boolRC = objList.Exist(0)
If Not boolRC Then
 ExitTest
End If

'Get number of list items
intItemsCount = objList.GetROProperty(&quot;items count&quot;)
'Create random index
Randomize
intRndItem = CInt(Rnd*intItemsCount)
'Select the item
'Note: selection by index is zero-based
objList.Select &quot;#&quot; &amp; intRndItem
</pre>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://automation-beyond.com/2007/12/23/custom-lists-winrunner/" rel="bookmark" class="crp_title">Custom lists: Select Multi / Select All with WinRunner</a></li><li><a href="http://automation-beyond.com/2007/11/15/test-log-messages/" rel="bookmark" class="crp_title">Test Log Messages</a></li><li><a href="http://automation-beyond.com/2011/07/19/xmlnode2dictionary/" rel="bookmark" class="crp_title">XMLNode2Dictionary (QTP, TestComplete, VBScript)</a></li><li><a href="http://automation-beyond.com/2009/09/23/gp-automation-vbscript-limitation/" rel="bookmark" class="crp_title">GP/QTP Automation: Overcoming VBScript limitation with Excel macros</a></li><li><a href="http://automation-beyond.com/2010/03/04/manually-get-dexterity-gui-field-names/" rel="bookmark" class="crp_title">How to manually get Dexterity GUI field names</a></li></ul></div>
]]></content:encoded>
			<wfw:commentRss>http://automation-beyond.com/2011/11/24/how-to-select-random-list-item/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to find last modified file (TestComplete, QTP, VBScript)</title>
		<link>http://automation-beyond.com/2011/07/26/how-to-find-last-modified-file/</link>
		<comments>http://automation-beyond.com/2011/07/26/how-to-find-last-modified-file/#comments</comments>
		<pubDate>Tue, 26 Jul 2011 10:20:02 +0000</pubDate>
		<dc:creator>Albert Gareev</dc:creator>
				<category><![CDATA[File System Operations]]></category>
		<category><![CDATA[How to]]></category>
		<category><![CDATA[Source code]]></category>
		<category><![CDATA[3. Automation]]></category>
		<category><![CDATA[answer]]></category>
		<category><![CDATA[Attribute]]></category>
		<category><![CDATA[check]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[date]]></category>
		<category><![CDATA[DateCreated]]></category>
		<category><![CDATA[DateLastAccessed]]></category>
		<category><![CDATA[DateLastModified]]></category>
		<category><![CDATA[Example]]></category>
		<category><![CDATA[file]]></category>
		<category><![CDATA[filename unknown]]></category>
		<category><![CDATA[FileSystemObject]]></category>
		<category><![CDATA[FSO]]></category>
		<category><![CDATA[last]]></category>
		<category><![CDATA[modified]]></category>
		<category><![CDATA[most]]></category>
		<category><![CDATA[number]]></category>
		<category><![CDATA[property]]></category>
		<category><![CDATA[QTP]]></category>
		<category><![CDATA[question]]></category>
		<category><![CDATA[recent]]></category>
		<category><![CDATA[testcomplete]]></category>
		<category><![CDATA[time]]></category>
		<category><![CDATA[VBScript]]></category>

		<guid isPermaLink="false">http://automation-beyond.com/?p=3759</guid>
		<description><![CDATA[Reference page: Service Functions – System (QTP, VBScript) Description  Check folder exists &#8211; check folder has files. Iterate through collection of files and keep reference of the most recently modified file (its DateLastModified property is always the highest number). The remaining reference is the one that you need. In case of errors the function returns [...]]]></description>
			<content:encoded><![CDATA[
<div class="topsy_widget_data topsy_theme_blue" style="float: right;margin-left: 0.75em; background: url(data:,%7B%20%22url%22%3A%20%22http%253A%252F%252Fautomation-beyond.com%252F2011%252F07%252F26%252Fhow-to-find-last-modified-file%252F%22%2C%20%22shorturl%22%3A%20%22http%3A%2F%2Fbit.ly%2FnDgvOC%22%2C%20%22style%22%3A%20%22big%22%2C%20%22title%22%3A%20%22How%20to%20find%20last%20modified%20file%20%28TestComplete%2C%20QTP%2C%20VBScript%29%22%20%7D);"></div>
<p><div style="position: relative; z-index:1;"><script type="text/javascript"><!--
google_ad_client = "pub-4470793787913935";
/* Banner 468x60 */
google_ad_slot = "8933038987";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div></p>
<p>Reference page: <a title="Service Functions – System (QTP, VBScript)" href="http://automation-beyond.com/2009/12/05/service-functions-system/" target="_blank">Service Functions – System (QTP, VBScript)</a></p>
<h4>Description </h4>
<p>Check folder exists &#8211; check folder has files. Iterate through collection of files and keep reference of the most recently modified file (its <em>DateLastModified</em> property is always the highest number). The remaining reference is the one that you need. In case of errors the function returns <em>Nothing</em>. </p>
<p>Note. In some cases, you may want to use <em>DateCreated</em> or <em>DateLastAccessed</em> properties.</p>
<h4>Implementation</h4>
<p><script type="text/javascript"><!--
google_ad_client = "pub-4470793787913935";
/* 4 links text line */
google_ad_slot = "5367351963";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>
<pre class="brush: vb; title: ;">

Public Function GetLastModifiedFile(ByVal sFolderPath)
  Dim FSO, objFolder, objFile
  Dim objFileResult, longDateTime
  Dim boolRC
 
  Set FSO = CreateObject(&quot;Scripting.FileSystemObject&quot;)
  boolRC = FSO.FolderExists(sFolderPath)
  If Not boolRC Then
    Set FSO = Nothing
    Set GetLastModifiedFile = Nothing
    Exit Function
  End If

  Set objFolder = FSO.GetFolder(sFolderPath)
  If objFolder.Files.Count = 0 Then
    Set FSO = Nothing
    Set objFolder = Nothing
    Set GetLastModifiedFile = Nothing
    Exit Function
  End If
 
  Set objFileResult = Nothing
  longDateTime = CDate(0)
 
  For Each objFile in objFolder.Files
 
    If objFile.DateLastModified &gt; longDateTime Then
      Set objFileResult = objFile
      longDateTime = objFile.DateLastModified
    End If
   
  Next
 
  Set FSO = Nothing
  Set objFolder = Nothing
  Set GetLastModifiedFile = objFileResult

End Function
</pre>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://automation-beyond.com/2010/01/12/service-functions-excel/" rel="bookmark" class="crp_title">Service Functions – Excel (QTP, TestComplete, VBScript)</a></li><li><a href="http://automation-beyond.com/2008/11/10/minor-major-defect/" rel="bookmark" class="crp_title">Minor defect as a symptom of a major defect</a></li><li><a href="http://automation-beyond.com/2008/06/13/createxmldomfromfile/" rel="bookmark" class="crp_title">CreateXMLDOMFromFile (QTP, TestComplete, VBScript)</a></li><li><a href="http://automation-beyond.com/2008/06/30/service-functions-msxmldom/" rel="bookmark" class="crp_title">Service Functions &#8211; MSXMLDOM (QTP, TestComplete, VBScript)</a></li><li><a href="http://automation-beyond.com/2010/11/10/testcomplete-find-child/" rel="bookmark" class="crp_title">TestComplete &#8211; Find Child or Find Yourself?</a></li></ul></div>
]]></content:encoded>
			<wfw:commentRss>http://automation-beyond.com/2011/07/26/how-to-find-last-modified-file/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How to &#8220;Save As&#8221; text template</title>
		<link>http://automation-beyond.com/2010/10/26/how-to-save-as/</link>
		<comments>http://automation-beyond.com/2010/10/26/how-to-save-as/#comments</comments>
		<pubDate>Tue, 26 Oct 2010 12:23:09 +0000</pubDate>
		<dc:creator>Albert Gareev</dc:creator>
				<category><![CDATA[How to]]></category>
		<category><![CDATA[Source code]]></category>
		<category><![CDATA[Text Data]]></category>
		<category><![CDATA[add]]></category>
		<category><![CDATA[as]]></category>
		<category><![CDATA[copy]]></category>
		<category><![CDATA[file]]></category>
		<category><![CDATA[FileSystemObject]]></category>
		<category><![CDATA[QTP]]></category>
		<category><![CDATA[rename]]></category>
		<category><![CDATA[save]]></category>
		<category><![CDATA[save as]]></category>
		<category><![CDATA[template]]></category>
		<category><![CDATA[testcomplete]]></category>
		<category><![CDATA[text]]></category>
		<category><![CDATA[use]]></category>
		<category><![CDATA[VBScript]]></category>

		<guid isPermaLink="false">http://automation-beyond.com/?p=3688</guid>
		<description><![CDATA[Parent page: Service Functions – System (QTP, VBScript) Question I need to modify text file template (add a few lines) and &#8220;Save as&#8221;. Answer One of the typical challenges that people face while trying to automate work tasks, is &#8220;procedure &#8211; result&#8221; confusion. Here, the end result* is confused with a way** to do the [...]]]></description>
			<content:encoded><![CDATA[
<div class="topsy_widget_data topsy_theme_blue" style="float: right;margin-left: 0.75em; background: url(data:,%7B%20%22url%22%3A%20%22http%253A%252F%252Fautomation-beyond.com%252F2010%252F10%252F26%252Fhow-to-save-as%252F%22%2C%20%22style%22%3A%20%22big%22%2C%20%22title%22%3A%20%22How%20to%20%5C%22Save%20As%5C%22%20text%20template%22%20%7D);"></div>
<p>Parent page: <a title="Service Functions – System (QTP, VBScript)" href="http://automation-beyond.com/2009/12/05/service-functions-system/" target="_blank">Service Functions – System (QTP, VBScript)</a></p>
<p><div style="position: relative; z-index:1;"><script type="text/javascript"><!--
google_ad_client = "pub-4470793787913935";
/* Banner 468x60 */
google_ad_slot = "8933038987";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div></p>
<h3>Question</h3>
<blockquote><p>I need to modify text file template (add a few lines) and &#8220;Save as&#8221;.</p></blockquote>
<h4>Answer</h4>
<p>One of the typical challenges that people face while trying to automate work tasks, is &#8220;procedure &#8211; result&#8221; confusion. Here, the end result* is confused with a way** to do the task.</p>
<h4>* What is wanted</h4>
<p>Text file with required contents is stored under defined name in required location.</p>
<h4>** How it&#8217;s done manually</h4>
<p>Open text file template in a text editor &#8211; add required text &#8211; save as new file (select path to store, type in new name).</p>
<h4>How to automate</h4>
<p>First of all, <a href="http://automation-beyond.com/2009/10/24/how-to-check-if-file-exists/" target="_blank">check</a> that file exists. Create a copy of the template file. If you are not sure that new name and/or location is valid, use <a href="http://automation-beyond.com/2008/12/04/winrunner2qtp-4/" target="_blank">error handling</a>. Open text file for appending and add required text. Close file to get it saved.</p>
<p>Note. Sample code below is equally suitable for QTP and TestComplete. </p>
<h4>Implementation</h4>
<p><script type="text/javascript"><!--
google_ad_client = "pub-4470793787913935";
/* 4 links text line */
google_ad_slot = "5367351963";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>
<pre class="brush: vb; title: ;">

  Dim FSO
  Dim objFile, objTextStream
  Dim boolRC
 
  Set FSO = CreateObject(&quot;Scripting.FileSystemObject&quot;)

  Call FSO.CopyFile(&quot;C:\Temp\template.txt&quot;, &quot;C:\Temp\myblog.txt&quot;, True)   
  Set objTextStream = FSO.OpenTextFile(&quot;C:\Temp\myblog.txt&quot;, 8, True)
  objTextStream.WriteLine(&quot;http://automation-beyond.com/&quot;)
  objTextStream.Close()
 
  Set objTextStream = Nothing
  Set objFile = Nothing
  Set FSO = Nothing
</pre>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://automation-beyond.com/2009/12/05/service-functions-system/" rel="bookmark" class="crp_title">Service Functions – System (QTP, VBScript)</a></li><li><a href="http://automation-beyond.com/2011/03/14/xsl-using-sub-templates/" rel="bookmark" class="crp_title">XML/XSL Transformation: Using Sub-Templates</a></li><li><a href="http://automation-beyond.com/2010/01/14/how-to-call-excel-function/" rel="bookmark" class="crp_title">How to call Excel VBA function from QTP</a></li><li><a href="http://automation-beyond.com/2010/04/13/ad-scripting-fail-safe-trick/" rel="bookmark" class="crp_title">Active Directory Scripting &#8211; a little trick for fail-safe automation</a></li><li><a href="http://automation-beyond.com/2011/05/25/xsl-using-styles/" rel="bookmark" class="crp_title">XML/XSL Transformation: Using Styles</a></li></ul></div>
]]></content:encoded>
			<wfw:commentRss>http://automation-beyond.com/2010/10/26/how-to-save-as/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Quick questions &#8211; quick answers</title>
		<link>http://automation-beyond.com/2010/06/22/quick-questions-quick-answers/</link>
		<comments>http://automation-beyond.com/2010/06/22/quick-questions-quick-answers/#comments</comments>
		<pubDate>Tue, 22 Jun 2010 13:00:50 +0000</pubDate>
		<dc:creator>Albert Gareev</dc:creator>
				<category><![CDATA[How to]]></category>
		<category><![CDATA[Notes]]></category>
		<category><![CDATA[answers]]></category>
		<category><![CDATA[examples]]></category>
		<category><![CDATA[FAQ]]></category>
		<category><![CDATA[functions]]></category>
		<category><![CDATA[generic]]></category>
		<category><![CDATA[GUI]]></category>
		<category><![CDATA[object]]></category>
		<category><![CDATA[QTP]]></category>
		<category><![CDATA[questions]]></category>
		<category><![CDATA[Repository]]></category>
		<category><![CDATA[technical]]></category>
		<category><![CDATA[VBScript]]></category>

		<guid isPermaLink="false">http://automation-beyond.com/?p=2862</guid>
		<description><![CDATA[Quick Answers Quick answers to questions arrived into my blog recently. How to load GUI map in QTP during run-time? Use methods of RepositoriesCollection object: Find / Add / Remove. See sample code, read investigation results. What&#8217;s the name of add-in for MS Dynamics Great Plains automation? There is no specific add-in. You would need Dot [...]]]></description>
			<content:encoded><![CDATA[
<div class="topsy_widget_data topsy_theme_blue" style="float: right;margin-left: 0.75em; background: url(data:,%7B%20%22url%22%3A%20%22http%253A%252F%252Fautomation-beyond.com%252F2010%252F06%252F22%252Fquick-questions-quick-answers%252F%22%2C%20%22shorturl%22%3A%20%22http%3A%2F%2Fbit.ly%2FeatBA6%22%2C%20%22style%22%3A%20%22big%22%2C%20%22title%22%3A%20%22Quick%20questions%20-%20quick%20answers%22%20%7D);"></div>
<h3>Quick Answers</h3>
<p>Quick answers to questions arrived into my blog recently.</p>
<p><div style="position: relative; z-index:1;"><script type="text/javascript"><!--
google_ad_client = "pub-4470793787913935";
/* Banner 468x60 */
google_ad_slot = "8933038987";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div></p>
<h4>How to load GUI map in QTP during run-time?</h4>
<p>Use methods of <em>RepositoriesCollection</em> object: Find / Add / Remove. See <a href="http://automation-beyond.com/2008/04/15/gui-repositories-qtp/" target="_blank">sample code</a>, read <a href="http://automation-beyond.com/2010/03/18/qtp-performance-test/" target="_blank">investigation results</a>.</p>
<h4>What&#8217;s the name of add-in for MS Dynamics Great Plains automation?</h4>
<p>There is no specific add-in. You would need Dot NET and Visual Age add-ins to <a href="http://automation-beyond.com/chapters/projects/gp-automation/" target="_blank">create your own</a>.</p>
<h4>How to restore/resize minimized browser window?</h4>
<p>You need to retrieve handle of a browser window, then operate the window with standard functions. <a href="http://automation-beyond.com/2009/06/25/overload-vbscript/" target="_blank">See sample code</a> (<em>Objective 1</em> chapter in the article).</p>
<h4>How to copy folder with subfolders and files on it?</h4>
<p>You can use XCopy.exe or other command line tool. <a href="http://automation-beyond.com/2010/05/03/creating-folder-structure-from-template/" target="_blank">See sample code</a>.</p>
<p><script type="text/javascript"><!--
google_ad_client = "pub-4470793787913935";
/* 4 links text line */
google_ad_slot = "5367351963";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>
<h4>How to create and edit Great Plains Dexterity macros?</h4>
<ol>
<li>Enable <em>Advanced</em> macro menu (will appear as <em>Tools/Macro/Advanced</em>) by setting <em>ShowAdvancedMacroMenu=TRUE</em> in Dexterity configuration file <em>Dex.ini</em>.</li>
<li>Use <em>Record</em> and <em>Pause</em> commands in <em>Advanced</em> macro menu to create your scripts. Scripts are saved as <em>*.mac</em> files. You can edit source code manually in any text editor.</li>
<li>Refer to <a href="http://automation-beyond.com/2009/11/12/ms-dynamics-great-plains-macros/" target="_blank">documentation</a> page to see descriptions for macro commands and operators.</li>
</ol>
<p> </p>
<h4>How to enable execution log for  Great Plains Dexterity scripts?</h4>
<p>Use <em>logging</em> command. Example: <em>Logging file ‘:c:GP/Log/maclog.txt’</em><br />
Note non Windows-like syntax.</p>
<h4>How to use data from the manually opened Excel file in automation script ?</h4>
<p>Manually opened Excel workbook is locked. Editing test data while test execution scripts try using then might mess-up test results. But you can try waiting for a short period of time, then duplicating the file, if uninterruptible execution is required. <a href="http://automation-beyond.com/2010/04/08/using-locked-excel-workbook/" target="_blank">See sample code</a>.</p>
<h4>What is Dictionary object in QTP?</h4>
<p><a href="http://msdn.microsoft.com/en-us/library/x4k5wbx4(VS.85).aspx" target="_blank">Dictionary</a> is a standard Microsoft object that stores data in <em>key, item</em> pairs.</p>
<ul>
<li>You can use Dictionary object as an associative array</li>
<li>You can use Dictionary object as a dynamic array</li>
<li>You can use Dictionary object to support <a href="http://automation-beyond.com/2009/05/24/qtp-vbscript/" target="_blank">optional and default parameters</a> for VBScript functions</li>
<li>You can use Dictionary object to implement <a href="http://automation-beyond.com/2010/06/10/excel-data-2-dictionary/" target="_blank">local / global data model</a> in your scripts</li>
<li>You can use Dictionary object as a container for parameters you pass in/out in <a href="http://automation-beyond.com/2010/05/27/qtp-actions-review/" target="_blank">QTP Actions</a></li>
</ul>
<p> </p>
<p>and here&#8217;s the related <a href="http://automation-beyond.com/2009/01/09/service-functions-dictionary/" target="_blank">function library</a>.</p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://automation-beyond.com/2010/07/01/now-on-quick-testing-tips/" rel="bookmark" class="crp_title">Now on Quick Testing Tips</a></li><li><a href="http://automation-beyond.com/2011/02/22/wta-07-questioning-the-mission/" rel="bookmark" class="crp_title">WTA07: Questioning the Mission</a></li><li><a href="http://automation-beyond.com/2010/11/16/wta01-testing-is-learning/" rel="bookmark" class="crp_title">WTA01: Testing is Learning</a></li><li><a href="http://automation-beyond.com/2007/08/10/links-xml/" rel="bookmark" class="crp_title">Link-a-log: XML/XSL/XPath</a></li><li><a href="http://automation-beyond.com/2010/09/20/on-stackoverflow-1/" rel="bookmark" class="crp_title">&#8220;How do you write your QTP Tests?&#8221; (StackOverflow question)</a></li></ul></div>
]]></content:encoded>
			<wfw:commentRss>http://automation-beyond.com/2010/06/22/quick-questions-quick-answers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to use Dictionary object for storing Excel data row (QTP, VBScript)</title>
		<link>http://automation-beyond.com/2010/06/10/excel-data-2-dictionary/</link>
		<comments>http://automation-beyond.com/2010/06/10/excel-data-2-dictionary/#comments</comments>
		<pubDate>Thu, 10 Jun 2010 12:57:28 +0000</pubDate>
		<dc:creator>Albert Gareev</dc:creator>
				<category><![CDATA[How to]]></category>
		<category><![CDATA[MS Excel Data]]></category>
		<category><![CDATA[answer]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[dictionary]]></category>
		<category><![CDATA[Example]]></category>
		<category><![CDATA[Excel]]></category>
		<category><![CDATA[objDictionary]]></category>
		<category><![CDATA[QTP]]></category>
		<category><![CDATA[question]]></category>
		<category><![CDATA[source]]></category>
		<category><![CDATA[VBScript]]></category>

		<guid isPermaLink="false">http://automation-beyond.com/?p=2864</guid>
		<description><![CDATA[Parent page: Service Functions – Excel (QTP, VBScript) Answers Description Connect to Excel through COM - Open workbook - Open worksheet &#8211; map cell values to column names. Notes. Heading and trailing space characters are removed To make mapping not case sensitive index is brought to lower case If your spreadsheet allows column name duplication you need to enhance [...]]]></description>
			<content:encoded><![CDATA[
<div class="topsy_widget_data topsy_theme_blue" style="float: right;margin-left: 0.75em; background: url(data:,%7B%20%22url%22%3A%20%22http%253A%252F%252Fautomation-beyond.com%252F2010%252F06%252F10%252Fexcel-data-2-dictionary%252F%22%2C%20%22style%22%3A%20%22big%22%2C%20%22title%22%3A%20%22How%20to%20use%20Dictionary%20object%20for%20storing%20Excel%20data%20row%20%28QTP%2C%20VBScript%29%22%20%7D);"></div>
<p><div style="position: relative; z-index:1;"><script type="text/javascript"><!--
google_ad_client = "pub-4470793787913935";
/* Banner 468x60 */
google_ad_slot = "8933038987";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div><br />
Parent page: <a title="Service Functions – Excel (QTP, VBScript)" href="http://automation-beyond.com/2010/01/12/service-functions-excel/" target="_blank">Service Functions – Excel (QTP, VBScript)</a></p>
<h3>Answers</h3>
<p><strong>Description</strong></p>
<p>Connect to Excel through COM - Open workbook - Open worksheet &#8211; map cell values to column names.<br />
Notes.</p>
<ul>
<li>Heading and trailing space characters are removed</li>
<li>To make mapping not case sensitive index is brought to lower case</li>
<li>If your spreadsheet allows column name duplication you need to enhance the presented code by adding unique index to duplicated column names (i.e. &#8220;Name, Name_1, Name_2&#8243;)</li>
</ul>
<p> </p>
<p><script type="text/javascript"><!--
google_ad_client = "pub-4470793787913935";
/* 4 links text line */
google_ad_slot = "5367351963";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>
<pre class="brush: vb; title: ;">
'Assumptions:
'Excel file exists
'Workbook is open (XLBook)
'Sheet exists
Set objDataRow = CreateObject(&quot;Scripting.Dictionary&quot;)
'
sSheetIndex = 1
intTargetRow = 123
'
Set objUsedRange = XLBook.Worksheets(sSheetIndex).UsedRange()
'
For Iter = 1 To objUsedRange.Columns.Count
   sCellName = LCase(Trim(objUsedRange.Cells(1,Iter)))
   sCellValue = Trim(objUsedRange.Cells(intTargetRow,Iter))
   objDataRow.Item(sCellName) = sCellValue
   End If
Next
</pre>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://automation-beyond.com/2010/01/12/service-functions-excel/" rel="bookmark" class="crp_title">Service Functions – Excel (QTP, TestComplete, VBScript)</a></li><li><a href="http://automation-beyond.com/2009/01/09/service-functions-dictionary/" rel="bookmark" class="crp_title">Service Functions – Dictionary (QTP, TestComplete, VBScript)</a></li><li><a href="http://automation-beyond.com/2010/06/22/quick-questions-quick-answers/" rel="bookmark" class="crp_title">Quick questions &#8211; quick answers</a></li><li><a href="http://automation-beyond.com/2008/09/15/winrunner2qtp-2/" rel="bookmark" class="crp_title">WinRunner to QTP migration notes (2)</a></li><li><a href="http://automation-beyond.com/2009/05/23/excel-vbscript-2/" rel="bookmark" class="crp_title">Mapping Excel col names (QTP, VBScript)</a></li></ul></div>
]]></content:encoded>
			<wfw:commentRss>http://automation-beyond.com/2010/06/10/excel-data-2-dictionary/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What&#8217;s the deal about QTP Actions?</title>
		<link>http://automation-beyond.com/2010/05/27/qtp-actions-review/</link>
		<comments>http://automation-beyond.com/2010/05/27/qtp-actions-review/#comments</comments>
		<pubDate>Thu, 27 May 2010 13:08:12 +0000</pubDate>
		<dc:creator>Albert Gareev</dc:creator>
				<category><![CDATA[How to]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Action]]></category>
		<category><![CDATA[answer]]></category>
		<category><![CDATA[argument]]></category>
		<category><![CDATA[defaulting]]></category>
		<category><![CDATA[description]]></category>
		<category><![CDATA[Example]]></category>
		<category><![CDATA[exchange]]></category>
		<category><![CDATA[Framework]]></category>
		<category><![CDATA[object]]></category>
		<category><![CDATA[overloading]]></category>
		<category><![CDATA[parameter]]></category>
		<category><![CDATA[Parameters]]></category>
		<category><![CDATA[pass]]></category>
		<category><![CDATA[QTP]]></category>
		<category><![CDATA[question]]></category>
		<category><![CDATA[result]]></category>
		<category><![CDATA[return]]></category>
		<category><![CDATA[review]]></category>
		<category><![CDATA[send]]></category>
		<category><![CDATA[VBScript]]></category>
		<category><![CDATA[what is Action]]></category>

		<guid isPermaLink="false">http://automation-beyond.com/?p=2304</guid>
		<description><![CDATA[QTP Action at a glance      &#8220;Happy Path&#8221; Test Flow    The screenprint above demonstrates sample &#8220;Test&#8221; Flow designed using QTP Actions. &#8220;Happy Path&#8221; testing, or conformance testing, or checking can be characterized by 2 attributes: it is scripted, and it ignores everything that is out of scope. Scripted here does not mean a program [...]]]></description>
			<content:encoded><![CDATA[
<div class="topsy_widget_data topsy_theme_blue" style="float: right;margin-left: 0.75em; background: url(data:,%7B%20%22url%22%3A%20%22http%253A%252F%252Fautomation-beyond.com%252F2010%252F05%252F27%252Fqtp-actions-review%252F%22%2C%20%22style%22%3A%20%22big%22%2C%20%22title%22%3A%20%22What%27s%20the%20deal%20about%20QTP%20Actions%3F%22%20%7D);"></div>
<h3 style="text-align: center;">QTP Action at a glance</h3>
<p><div style="position: relative; z-index:1;"><script type="text/javascript"><!--
google_ad_client = "pub-4470793787913935";
/* Banner 468x60 */
google_ad_slot = "8933038987";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>    </p>
<h4 style="text-align: center;">&#8220;Happy Path&#8221; Test Flow</h4>
<p><a href="http://automation-beyond.com/wp/wp-content/uploads/2010/05/ActionTree.jpg"></a><a href="http://automation-beyond.com/wp/wp-content/uploads/2010/05/ActionTree.jpg"></a> <a href="http://automation-beyond.com/wp/wp-content/uploads/2010/05/ActionTree.jpg"><img class="alignnone size-full wp-image-2316" style="border: black 1px solid;" title="ActionTree" src="http://automation-beyond.com/wp/wp-content/uploads/2010/05/ActionTree.jpg" alt="" width="450" height="223" /></a> </p>
<p>The screenprint above demonstrates sample &#8220;Test&#8221; Flow designed using QTP Actions.<br />
&#8220;Happy Path&#8221; testing, or conformance testing, or checking can be characterized by 2 attributes: it is scripted, and it ignores everything that is out of scope. Scripted here does not mean a program written in scripting language. It means a predefined sequence of actions to perform. </p>
<h4 style="text-align: center;">Action-centric design</h4>
<p style="text-align: center;"><a href="http://automation-beyond.com/wp/wp-content/uploads/2010/05/ActionCentric.jpg"><img class="alignnone size-full wp-image-2308" style="border: black 1px solid;" title="ActionCentric" src="http://automation-beyond.com/wp/wp-content/uploads/2010/05/ActionCentric.jpg" alt="" width="533" height="414" /></a>    </p>
<p><script type="text/javascript"><!--
google_ad_client = "pub-4470793787913935";
/* 4 links text line */
google_ad_slot = "5367351963";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>    </p>
<p>Test Action is not only a sequence of steps to perform. They have to be supported with GUI mapping information to recognize objects and test data to use.<br />
QTP provides first in a form of Object Repository component. Each Action is provided with one or more components of this type. Default, automatically attached component is called &#8220;Local&#8221; repository. All GUI objects, captured during recording operations, are stored there. Additional components, that saved in separate files (*.TSR), can be attached to a number of Actions; they are named shared repositories. Attached shared repository appears in the list under its file&#8217;s name (&#8220;Login.tsr&#8221; in the example).<br />
Even if the all object references are written in Descriptive Programming notation, Local Repository remains attached to Action.<br />
QTP provides a built-in Data Model that comes in forms of a workbook (DataTable object) and XML structure (Environment object). These objects are global, i.e. accessible from any Action. In addition, QTP automatically creates a worksheet for each new Action created. This worksheet, named after the Action, is associated with it. That creates a convenience of automatically loading Test Data, associated with Actions. </p>
<h4 style="text-align: center;">Declaration and calling mechanism</h4>
<p style="text-align: left;">As QTP Actions are not regular sub-routines, like functions and subs, they have to be declared; that includes requirement to specify arguments that can be passed into Actions.  </p>
<p><a href="http://automation-beyond.com/wp/wp-content/uploads/2010/05/ActionParameters.jpg"><img class="alignnone size-full wp-image-2314" title="ActionParameters" src="http://automation-beyond.com/wp/wp-content/uploads/2010/05/ActionParameters.jpg" alt="" width="470" height="446" /></a>  </p>
<p style="text-align: left;">User can specify arguments by type, or leave it as variant (&#8220;Any&#8221; item in Type selection list). Value of an argument can be defaulted, i.e. if it was omitted in the calling statement the Action will receive the default value. This mechanism represents a limited overloading capacity. (<a href="http://automation-beyond.com/2009/06/25/overload-vbscript/" target="_blank">Read more</a> about custom implementation of overloading and defaulting with VBScript.)  </p>
<p style="text-align: left;">Inside Actions, parameters are accessed through <em>Parameter</em> object.  </p>
<p style="text-align: center;"><a href="http://automation-beyond.com/wp/wp-content/uploads/2010/05/ActionCode.jpg"><img class="alignnone size-full wp-image-2318" style="border: black 1px solid;" title="ActionCode" src="http://automation-beyond.com/wp/wp-content/uploads/2010/05/ActionCode.jpg" alt="" width="462" height="213" /></a>  </p>
<p style="text-align: left;"><em>Parameter</em> object is similar to <em>Dictionary</em> object, but does not support <em>Count</em> property, and methods like <em>Items()</em> or <em>Keys()</em> .  </p>
<p style="text-align: left;">Last but not least: <em>ExitAction</em> statement allows returning only a constant value.  </p>
<h3 style="text-align: center;">Applicability Notes</h3>
<p style="text-align: left;">The built-in QTP framework is designed for non-programmers trying to implement &#8220;Happy Path&#8221; testing. For that purpose, it fits perfectly. It takes care of initialization and finalization steps, provides ready-to-go structure for test scripts, automatically loads/unloads data associated with the tests, provides rich checking functionalities. It represents evolution of <a href="http://automation-beyond.com/2009/05/31/test-automation-practices-recordplayback-enhanced/" target="_blank">Enhanced Record/Playback</a> approach.  </p>
<p style="text-align: left;">It is applicable at its best for the following scenarios:  </p>
<p style="text-align: left;">
<ul>
<li>small application or application with small independent functionalities that are not cross-tested;</li>
<li>simple GUI that experiences no fluctuations from build to build;</li>
<li>straight and simple business logic, with no or minimal number of pop-up dialogs;</li>
<li>extremely simple test logic, implementing positive, &#8220;happy path&#8221; test cases, with no branching or looping;</li>
<li style="text-align: left;">static dataset, or extremely small number of test data, hard-coded in QTP worksheets.</li>
</ul>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://automation-beyond.com/2011/10/24/wta20-flying-solo-no-big-deal/" rel="bookmark" class="crp_title">WTA20: Flying Solo No Big Deal</a></li><li><a href="http://automation-beyond.com/2010/12/01/bugs-go-hard-copy/" rel="bookmark" class="crp_title">Bugs go hard-copy</a></li><li><a href="http://automation-beyond.com/2010/06/22/quick-questions-quick-answers/" rel="bookmark" class="crp_title">Quick questions &#8211; quick answers</a></li><li><a href="http://automation-beyond.com/2010/10/15/notes-on-debrief/" rel="bookmark" class="crp_title">Notes on Testing Challenge debrief</a></li><li><a href="http://automation-beyond.com/2007/09/17/telling-testing-story/" rel="bookmark" class="crp_title">Telling testing story</a></li></ul></div>
]]></content:encoded>
			<wfw:commentRss>http://automation-beyond.com/2010/05/27/qtp-actions-review/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

