<?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>XX</title>
	<atom:link href="http://www.automationrepository.com/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.automationrepository.com/wordpress</link>
	<description>
asas</description>
	<lastBuildDate>Thu, 09 Jun 2016 10:53:40 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
	<item>
		<title>UFT 12.53 &#8211; New Features</title>
		<link>https://www.automationrepository.com/wordpress/2016/06/uft-12-53-new-features/</link>
					<comments>https://www.automationrepository.com/wordpress/2016/06/uft-12-53-new-features/#respond</comments>
		
		<dc:creator><![CDATA[Anish Pillai]]></dc:creator>
		<pubDate>Thu, 09 Jun 2016 10:50:16 +0000</pubDate>
				<category><![CDATA[QTP Basic Stuff]]></category>
		<guid isPermaLink="false">http://www.automationrepository.com/?p=2291</guid>

					<description><![CDATA[<p>Sometime back, we had published an article on how to download UFT 12.52 from HP website. Looks like HP has now released a new version of the tool &#8211; UFT 12.53. In this post, we will list down the new features that have been added to UFT 12.53. If you are using some older version &#8230; <a href="https://www.automationrepository.com/wordpress/2016/06/uft-12-53-new-features/">Read more <span class="meta-nav">&#8594;</span></a></p>
<p>The post <a rel="nofollow" href="https://www.automationrepository.com/wordpress/2016/06/uft-12-53-new-features/">UFT 12.53 &#8211; New Features</a> appeared first on <a rel="nofollow" href="https://www.automationrepository.com/wordpress">XX</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Sometime back, we had published an article on <a href="http://www.automationrepository.com/2016/05/download-uft-qtp-12-52-trial-version-from-hp/" target="_blank">how to download UFT 12.52 from HP website</a>. Looks like HP has now released a new version of the tool &#8211; UFT 12.53. In this post, we will list down the new features that have been added to UFT 12.53.<span id="more-2291"></span></p>
<p>If you are using some older version of UFT or QTP in your projects, then it would be good to have a look through this article so that you get to know the new features that are available with UFT 12.53. There is a good chance that you might find some features which are useful in your project, thereby helping you decide if you want to switch to the newer version of the tool.</p>
<p>Let&#8217;s now have a look at the new features in UFT 12.53 &#8211;</p>
<p><img fetchpriority="high" decoding="async" class="aligncenter" src="https://www.automationrepository.com/wordpress/wp-content/uploads/ar/uft-12-53-new-features.PNG" alt="UFT 12.53 - New Features" width="556" height="378" /></p>
<h2>Enhanced Mobile testing</h2>
<p>This version of UFT supports enhanced functionality for both native and hybrid mobile apps. Now, you can:</p>
<ul>
<li>a) Configure devices and applications for your tests directly from the new Mobile Center wizard</li>
<li>b) Test non-packaged apps. This means you no longer need to package apps to upload them to Mobile Center</li>
<li>c) Test mobile web apps using the device&#8217;s native browser &#8211; Safari for iOS devices, and Chrome for Android devices</li>
</ul>
<p>&nbsp;</p>
<h2>New Docker activities for API tests</h2>
<p>UFT now provides new Docker activities which enable you to perform remote actions on your containerized Docker applications.Use these new activities to:</p>
<ul>
<li>a) Download an image of the Docker container that contains your application</li>
<li>b) Run an image containing the application</li>
<li>c) Stop the container currently running the test</li>
</ul>
<p>You can also test the application from the Docker container using standard UFT activities</p>
<p>&nbsp;</p>
<h2>OData protocol support for API tests</h2>
<p>Now you can use UFT to test your OData REST services:</p>
<ul>
<li>a) Import the OData service as a REST service. You can import a service from a file or from a URL</li>
<li>b) Construct a test using the service&#8217;s resources and methods</li>
</ul>
<p>UFT runs the test just the same as any other REST service test</p>
<p>&nbsp;</p>
<h2>Configure Chrome Emulator devices</h2>
<p>You can now configure and add devices for your Chrome Emulator by manually editing the Chrome emulator configuration XML</p>
<p>&nbsp;</p>
<h2>Run UFT tests from Amazon Web Services Marketplace</h2>
<p>Now you can use AWS to access a system that contains the latest version of UFT pre-installed on multiple combinations of operation systems and browsers. Doing this also enables you to pay per use of UFT as needed</p>
<p>&nbsp;</p>
<h2>Support for Chromium Embedded Framework controls</h2>
<p>You can now use UFT to test applications containing Chrome embedded controls, including Java CEF and Adobe CEP</p>
<p>&nbsp;</p>
<h2>Synthetic data generation for BPT tests</h2>
<p>Now you can use the BPT Test Combinations Generator to create synthetic data for your test runs instead of creating all possible parameter values manually. In the Test Combinations Generator, select a parameter to automatically generate its values. Then select the parameter type and format. UFT uses built-in dictionaries to automatically populate the list of possible values with the generated data</p>
<p>&nbsp;</p>
<h2>UI Automation updates</h2>
<p>UFT&#8217;s UI Automation support enables UFT to recognize objects in any application that has implemented the Microsoft Windows UI Automation Framework. This is especially helpful when UFT&#8217;s current technology support is not sufficient for your testing needs. In UFT 12.53, support has been added for:</p>
<ul>
<li>a) Switching between regular Spy and Learn modes while spying and learning objects instead of selecting a mode beforehand</li>
<li>b) Setting the default Spy and Learn mode to UI Automation</li>
<li>c) Enhancing your tests using new UI Automation test object methods, native methods, and object identification properties</li>
</ul>
<p>&nbsp;</p>
<h2>Web Accessibility toolkit updates</h2>
<p>UFT supports the Web Accessibility toolkit to recognize objects that use the HTML role property. The Web Accessibility toolkit is used to create digital content that is accessible to people with disabilities. In UFT 12.53, Web Accessibility toolkit support has been added for:</p>
<ul>
<li>a) All Web 2.0 toolkits</li>
<li>b) Web-based add-ins</li>
<li>c) Testing Mobile browsers</li>
<li>d) Testing the Chrome emulator</li>
</ul>
<p>Additionally, new test object methods and properties have been added so you can give greater depth to your tests.</p>
<p>&nbsp;</p>
<h2>New technology and framework support</h2>
<p>This version of UFT includes the following new supported technologies and frameworks:</p>
<ul>
<li>a) Updated support for the latest versions of Firefox and Chrome</li>
<li>b) Angular JS 1.2/1.4</li>
<li>c) Autopass License Server version 9.1</li>
<li>d) DevExpress WPF (via the UI Automation Add-in)</li>
<li>e) Hummingbird 14 Terminal Emulator</li>
<li>f) Infragistics WPF and WinForms (via the UI Automation Add-in)</li>
<li>g) Microfocus WebToHost 6.70 Terminal Emulator</li>
<li>h) Microfocus WebToHost 6.80 Terminal Emulator</li>
<li>i) MS Dynamix AX 2012 (via the UI Automation Add-in)</li>
<li>j) NWBC 5.0/6.0</li>
<li>k) QT5 QTQuick (via the UI Automation Add-in)</li>
<li>l) QT 5.3 widgets compiled by Visual Studio</li>
<li>m) SAP Ariba</li>
<li>n) SAP Concur</li>
<li>o) SAP FieldGlass</li>
<li>p) SAP GUI 7.40</li>
<li>q) TCPLink 3.50-01</li>
</ul>
<p>This was all about the new features that you will find in UFT 12.53. Did you find anything useful which will make you switch to the latest version of UFT?</p>
<p style="border: 1px solid #C38EC7; padding: 3mm; background: #EBDDE2;">If you want to download the latest version of UFT, then please check out this link &#8211; <a title="Download UFT 12.53" href="http://www.automationrepository.com/2016/05/download-uft-qtp-12-52-trial-version-from-hp/">Download UFT 12.53</a></p>
<div style="font-family: Verdana,sans-serif; border: 1px solid #C8B560; padding: 3mm; background: #FFF8C6; text-align: center;">
<p><strong>If you enjoyed this article, you can join our blog to get new articles delivered directly in your inbox.</strong></p>
<form style="text-align: center;" action="http://feedburner.google.com/fb/a/mailverify" method="post" target="popupwindow"><input style="width: 160px; height: 20px;" type="text" value="Enter Your Email Address" /> <input name="uri" type="hidden" value="automationrepository/feeds" /> <input name="loc" type="hidden" value="en_US" /> <input type="submit" value="Join Us" /></p>
<p style="text-align: justify;">
</form>
</div>
<p>The post <a rel="nofollow" href="https://www.automationrepository.com/wordpress/2016/06/uft-12-53-new-features/">UFT 12.53 &#8211; New Features</a> appeared first on <a rel="nofollow" href="https://www.automationrepository.com/wordpress">XX</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.automationrepository.com/wordpress/2016/06/uft-12-53-new-features/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>UFT Batch Run &#8211; Prevent Windows from getting locked during Script Execution</title>
		<link>https://www.automationrepository.com/wordpress/2016/05/qtp-uft-batch-run-prevent-windows-from-getting-locked/</link>
					<comments>https://www.automationrepository.com/wordpress/2016/05/qtp-uft-batch-run-prevent-windows-from-getting-locked/#respond</comments>
		
		<dc:creator><![CDATA[Anish Pillai]]></dc:creator>
		<pubDate>Sat, 28 May 2016 12:28:56 +0000</pubDate>
				<category><![CDATA[QTP Basic Stuff]]></category>
		<category><![CDATA[QTP Concepts]]></category>
		<guid isPermaLink="false">http://www.automationrepository.com/?p=2268</guid>

					<description><![CDATA[<p>We had previously talked about a method whereby you can use Windows Media Player to prevent Windows from getting locked while your QTP/UFT batch run is in progress. Here are few more alternative methods you can use to make this work &#160; 1. Use VBScript SendKeys to simulate keypress at regular intervals Copy the below &#8230; <a href="https://www.automationrepository.com/wordpress/2016/05/qtp-uft-batch-run-prevent-windows-from-getting-locked/">Read more <span class="meta-nav">&#8594;</span></a></p>
<p>The post <a rel="nofollow" href="https://www.automationrepository.com/wordpress/2016/05/qtp-uft-batch-run-prevent-windows-from-getting-locked/">UFT Batch Run &#8211; Prevent Windows from getting locked during Script Execution</a> appeared first on <a rel="nofollow" href="https://www.automationrepository.com/wordpress">XX</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>We had previously talked about a method whereby you can <a href="http://www.automationrepository.com/2013/07/prevent-windows-lock-during-qtp-batch-run/" target="_blank">use Windows Media Player to prevent Windows from getting locked</a> while your QTP/UFT batch run is in progress. Here are few more alternative methods you can use to make this work<span id="more-2268"></span></p>
<p>&nbsp;</p>
<h3>1. Use VBScript SendKeys to simulate keypress at regular intervals</h3>
<p>Copy the below code in a text file and save it with a .vbs extension</p>
<pre class="brush: vb; title: ; notranslate">
Dim durationInMins
Set obj = CreateObject(&quot;WScript.Shell&quot;)

'Capture the input from user
durationInMins = InputBox (&quot;Enter time (in minutes) for which machine needs to remain unlocked&quot; &amp;amp; vbCrLf &amp;amp; vbCrLf &amp;amp; &quot;Enter 0 for indefinite time&quot;,&quot;Enter Duration&quot;)

If durationInMins &amp;gt; 0 Then
	'Run For loop for the duration specified by the user
	For i=1 to durationInMins
		WScript.Sleep (60*1000)
		obj.SendKeys (&quot;{CAPSLOCK 2}&quot;)
	Next
ElseIf durationInMins = 0 Then
	'Run indefinite Do loop
	Do
		WScript.Sleep (60*1000)
		obj.SendKeys (&quot;{CAPSLOCK 2}&quot;)
	Loop
End If
</pre>
<p>When you open this VBScript file in your machine, it will display a popup where you will need to specify the time (in minutes) for which Windows needs to remain unlocked. Enter 0 if you want this utility to run indefinitely. Entering a specific time limit rather than 0 is useful in scenarios where you don&#8217;t want the machine to keep running unnecessarily.</p>
<p>For example, consider a scenario where you want to execute a nightly batch run. And you know, by previous experience, that the UFT would take around 2-3 hours to complete the batch execution. In such a case, it will be good to specify the time in the alert box as 180 or 200, so that the machine comes to normal mode after this time duration and gets locked or shutdown.</p>
<p><strong>How this code works</strong></p>
<p>This code simply uses VBScript SendKeys method to simulate keyboard key press every one minute; thereby preventing windows from getting locked. Here we are using CAPS LOCK key to simulate the key press, using the code &#8211; <strong>SendKeys (&#8220;{CAPSLOCK 2}&#8221;)</strong>.</p>
<p>You would have noticed the number 2 next to CAPSLOCK. This means that the CAPSLOCK key is pressed twice in very quick succession. This makes sure that CAPSLOCK remains in the same state and doesn&#8217;t interfere in your work in any way.</p>
<p>There are many other flavors of this code, in which people use different keys such as SCROLLLOCK, NUMLOCK, F15 etc. All these work fine without any issues and you can use any of these if you would want to modify the code.</p>
<p>&nbsp;</p>
<h3>2. Using 3rd party software</h3>
<p>There are many 3rd party software (many with source code), which simulate keypress or mouse movements to keep your machine unlocked. Couple of them which I have used in the past are &#8211;</p>
<p><a href="https://mousejiggler.codeplex.com/" target="_blank">Mouse Jiggler</a> &#8211; This software works by jiggling the mouse pointer back and forth</p>
<p><a href="http://www.zhornsoftware.co.uk/caffeine/" target="_blank">Caffeine</a> &#8211; Another useful utility which simulates F15 keypress to prevent windows getting locked</p>
<p>&nbsp;</p>
<h3>3. Plug and Use USB devices</h3>
<p>While searching on the internet, I came across these USB devices which create constant mouse activity so your computer won&#8217;t go idle. You can search on Amazon if you want to have a look at these USB devices.</p>
<p>These were all the different methods that I have heard of and tried (except Pt 3 &#8211; Plug and Use USB devices) on my own. You can even integrate these utilities with your <a href="http://www.automationrepository.com/qtp-framework/" target="_blank">UFT/QTP frameworks</a> to provide more power to your automation frameworks.</p>
<p>Have you used any other piece of code or utility, which is not covered here? Let us know about it in the comments section.</p>
<p>&nbsp;</p>
<div style="font-family: Verdana,sans-serif; border: 1px solid #C8B560; padding: 3mm; background: #FFF8C6; text-align: center;">
<p><strong>If you enjoyed this article, you can join our blog to get new articles delivered directly in your inbox.</strong></p>
<form style="text-align: center;" action="http://feedburner.google.com/fb/a/mailverify" method="post" target="popupwindow"><input style="width: 160px; height: 20px;" type="text" value="Enter Your Email Address" /> <input name="uri" type="hidden" value="automationrepository/feeds" /> <input name="loc" type="hidden" value="en_US" /> <input type="submit" value="Join Us" /></p>
<p style="text-align: justify;">
</form>
</div>
<p>The post <a rel="nofollow" href="https://www.automationrepository.com/wordpress/2016/05/qtp-uft-batch-run-prevent-windows-from-getting-locked/">UFT Batch Run &#8211; Prevent Windows from getting locked during Script Execution</a> appeared first on <a rel="nofollow" href="https://www.automationrepository.com/wordpress">XX</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.automationrepository.com/wordpress/2016/05/qtp-uft-batch-run-prevent-windows-from-getting-locked/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Download UFT Latest Version (v12.53) from HP</title>
		<link>https://www.automationrepository.com/wordpress/2016/05/download-uft-qtp/</link>
					<comments>https://www.automationrepository.com/wordpress/2016/05/download-uft-qtp/#comments</comments>
		
		<dc:creator><![CDATA[Anish Pillai]]></dc:creator>
		<pubDate>Sun, 22 May 2016 11:57:02 +0000</pubDate>
				<category><![CDATA[QTP Basic Stuff]]></category>
		<category><![CDATA[QTP Concepts]]></category>
		<category><![CDATA[Download UFT]]></category>
		<category><![CDATA[HP UFT 12.52]]></category>
		<guid isPermaLink="false">http://www.automationrepository.com/?p=2247</guid>

					<description><![CDATA[<p>The latest version of HP UFT 12.52 (Unified Functional Testing), formerly QuickTest Professional (QTP), can be downloaded from HP website. As with the previous versions of UFT, the trial version is available for use for 30 days. UFT 12.52 Installation Packages HP provides the following 2 installation packages for UFT 12.52 &#8211; a) Full Installation &#8230; <a href="https://www.automationrepository.com/wordpress/2016/05/download-uft-qtp/">Read more <span class="meta-nav">&#8594;</span></a></p>
<p>The post <a rel="nofollow" href="https://www.automationrepository.com/wordpress/2016/05/download-uft-qtp/">Download UFT Latest Version (v12.53) from HP</a> appeared first on <a rel="nofollow" href="https://www.automationrepository.com/wordpress">XX</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>The latest version of HP UFT 12.52 (Unified Functional Testing), formerly QuickTest Professional (QTP), can be downloaded from HP website. As with the previous versions of UFT, the trial version is available for use for 30 days.<span id="more-2247"></span></p>
<h3>UFT 12.52 Installation Packages</h3>
<p>HP provides the following 2 installation packages for UFT 12.52 &#8211;</p>
<p><strong>a) Full Installation Package (Size 2.3 GB)</strong> which contains &#8211;<br />
&#8211; UFT Add-in for ALM<br />
&#8211; Run Results Viewer<br />
&#8211; License Server Setup<br />
&#8211; Setup programs for Extensibility Accelerator, the Extensibility SDKs, and the Web 2.0 add-ins</p>
<p><strong>b) Compressed UFT Installation Package (Size 916 MB)</strong> which installs the same features as the UFT installation setup program but does not include options to perform independent installations of the Unified Functional Testing Add-in for the ALM, the Run Results Viewer, Extensibility SDKs, or the License Server.</p>
<h3>Steps to Download UFT 12.52 from HP website</h3>
<p><strong>1) </strong>Open <a title="Download UFT 12.52 (Formerly QTP)" href="http://www8.hp.com/au/en/software-solutions/unified-functional-automated-testing/" target="_blank">UFT 12.52 download link</a>. You will see a page as shown in the below screenshot.</p>
<p><img decoding="async" class=" " title="UFT 12.52 Download link" src="https://www.automationrepository.com/wordpress/wp-content/uploads/ar/download-uft-12-5-landing-page.PNG" alt="UFT 12.52 Download - Landing Page" width="1183" height="591" /><br />
<strong>2) </strong>Scroll down a bit where you will see the &#8216;Download Now&#8217; button.</p>
<p><img decoding="async" class=" " title="UFT 12.52 - Download Now" src="https://www.automationrepository.com/wordpress/wp-content/uploads/ar/uft-12-5-download-now-button.PNG" alt="UFT 12.52 - Download Now" width="973" height="447" /><br />
<strong>3) </strong>Click on &#8216;Download Now&#8217; button. You will be taken to the sign-up page.</p>
<p><img loading="lazy" decoding="async" class=" " title="UFT 12.52 Download - Sign up form" src="https://www.automationrepository.com/wordpress/wp-content/uploads/ar/uft-12-5-download-sign-up-form.PNG" alt="UFT 12.52 Download - Sign up form" width="838" height="611" /><br />
<strong>4) </strong>Fill up the form and click on &#8216;Sign Up&#8217; button. You will see the below message.</p>
<p><img loading="lazy" decoding="async" class="aligncenter" title="UFT 12.52 - Sign up Complete" src="https://www.automationrepository.com/wordpress/wp-content/uploads/ar/uft-12-5-signup-complete.PNG" alt="UFT 12.52 - Sign up Complete" width="941" height="423" /><br />
<strong>5) </strong>Open your email account and search for the email from HP. Click on &#8216;Confirm Email&#8217; link. Your email will be confirmed and you will be navigated to HP Enterprise login page</p>
<p><img loading="lazy" decoding="async" class="aligncenter" title="UFT 12.52 Download - HPE Login Page" src="https://www.automationrepository.com/wordpress/wp-content/uploads/ar/uft-12-5-login-page.PNG" alt="UFT 12.52 Download - HPE Login Page" width="430" height="535" /><br />
<strong>6) </strong>Login with your account details. You will see that UFT has been added to your product lists.<br />
<img loading="lazy" decoding="async" class="aligncenter" title="UFT 12.52 Download - My Account" src="https://www.automationrepository.com/wordpress/wp-content/uploads/ar/uft-12-52-my-account.PNG" alt="UFT 12.52 Download - My Account" width="1020" height="246" /><br />
<strong>7) </strong>Click on &#8216;Download&#8217; button. You will now be taken to a new page which gives you two different UFT packages &#8211; a) Full package &amp; b) Compressed package<br />
<img loading="lazy" decoding="async" class="aligncenter" title="UFT 12.52 - Installation Packages" src="https://www.automationrepository.com/wordpress/wp-content/uploads/ar/uft-12-52-installation-packages.png" alt="UFT 12.52 - Installation Packages" width="900" height="550" /></p>
<p><strong>8) </strong>Click on any of the above links to start the download process on your machine.<br />
<img loading="lazy" decoding="async" class="aligncenter" title="UFT 12.52 - Download Confirmation" src="https://www.automationrepository.com/wordpress/wp-content/uploads/ar/uft-12-52-download-confirmation.png" alt="UFT 12.52 - Download Confirmation" width="588" height="391" /></p>
<p><strong>In case you face any issues while downloading UFT 12.52, please feel free to contact us using email or using the comments section.</strong></p>
<p>&nbsp;</p>
<div style="border: 1px solid #C8B560; padding: 3mm; background: #FFF8C6; text-align: center;">
<p><strong>Interested in more new articles on HP UFT 12.52? </strong>Join our blog to get new articles delivered directly in your inbox.</p>
<form style="text-align: center;" action="http://feedburner.google.com/fb/a/mailverify" method="post" target="popupwindow"><input style="width: 160px; height: 20px;" type="text" value="Enter Your Email Address" /> <input name="uri" type="hidden" value="automationrepository/feeds" /> <input name="loc" type="hidden" value="en_US" /> <input type="submit" value="Join Us" /></p>
<p style="text-align: justify;">
</form>
</div>
<p style="border: 1px solid #C38EC7; padding: 3mm; background: #EBDDE2;">For more QTP Tutorials, you can visit our <strong><a title="QTP Tutorials" href="http://www.automationrepository.com/tutorials-for-qtp-beginners/" target="_blank">QTP Tutorials</a></strong> page. You can also visit our <a title="Download" href="http://www.automationrepository.com/download/"><strong>Download</strong></a> Page to view all the downloadable content.</p>
<p>The post <a rel="nofollow" href="https://www.automationrepository.com/wordpress/2016/05/download-uft-qtp/">Download UFT Latest Version (v12.53) from HP</a> appeared first on <a rel="nofollow" href="https://www.automationrepository.com/wordpress">XX</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.automationrepository.com/wordpress/2016/05/download-uft-qtp/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
			</item>
		<item>
		<title>Designing Hybrid Framework in QTP &#8211; Part 4 [Final Part]</title>
		<link>https://www.automationrepository.com/wordpress/2013/09/designing-hybrid-framework-in-qtp-part-4/</link>
					<comments>https://www.automationrepository.com/wordpress/2013/09/designing-hybrid-framework-in-qtp-part-4/#comments</comments>
		
		<dc:creator><![CDATA[Anish Pillai]]></dc:creator>
		<pubDate>Mon, 30 Sep 2013 18:06:39 +0000</pubDate>
				<category><![CDATA[QTP Framework]]></category>
		<category><![CDATA[QTP Hybrid Framework]]></category>
		<guid isPermaLink="false">http://www.automationrepository.com/?p=2214</guid>

					<description><![CDATA[<p>We started the &#8216;Hybrid Framework in QTP&#8216; series with an article that covered the basics of hybrid framework in QTP. This series of posts would be concluded here in this 5th and final part where we will cover some of the remaining topics about the hybrid framework. We will also provide the sample framework code &#8230; <a href="https://www.automationrepository.com/wordpress/2013/09/designing-hybrid-framework-in-qtp-part-4/">Read more <span class="meta-nav">&#8594;</span></a></p>
<p>The post <a rel="nofollow" href="https://www.automationrepository.com/wordpress/2013/09/designing-hybrid-framework-in-qtp-part-4/">Designing Hybrid Framework in QTP &#8211; Part 4 [Final Part]</a> appeared first on <a rel="nofollow" href="https://www.automationrepository.com/wordpress">XX</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>We started the &#8216;<strong><a title="Hybrid Framework in QTP – The Basics" href="http://www.automationrepository.com/2013/07/qtp-hybrid-framework-the-basics/">Hybrid Framework in QTP</a></strong>&#8216; series with an article that covered the basics of hybrid framework in QTP. This series of posts would be concluded here in this 5th and final part where we will cover some of the remaining topics about the hybrid framework. We will also provide the sample framework code<span id="more-2214"></span> at the end of this article, which you will be able to download and modify as per your needs.</p>
<p><span><br />
</span></p>
<h3>A bit of background</h3>
<p>Before getting into the details with this article, we will first have a brief look at the topics that we had covered in the previous article of the hybrid framework series. This will help set up a background which we will then follow up with this article. If you would have read the last article on the hybrid framework (<a title="Designing Hybrid Framework in QTP – Part 3" href="http://www.automationrepository.com/2013/08/designing-hybrid-framework-in-qtp-part-3/">Designing Hybrid Framework in QTP – Part 3</a>), you might recollect that we had started that article with a framework which contained only 1 test case and had <a title="QTP Frameworks : Designing QTP Modular Framework from scratch" href="http://www.automationrepository.com/2012/04/qtp-framework-tutorial-using-qtp-modular-framework/" target="_blank">QTP modular framework</a> features implemented in it.<br />
<span><br />
</span><br />
We took the framework from that stage and added the capability of fetching data from excel sheets. Then we created the batch excel sheet and implemented the VBScript logic that will actually execute the test case in batch mode. When we finished that article, we had taken the hybrid framework to a point where we had implemented data handling and batch execution features to it.<br />
<span><br />
</span><br />
In this article also, we will do the same thing. We will pick up the framework from where we had left it and will add some more features to it. The end result will be a full fledged working hybrid framework which you would be able to download and use as a base for creating much more better frameworks in your projects. Let us now start with the list of topics that we will cover in this article.</p>
<p><span><br />
</span></p>
<h3>What&#8217;s in store for this article</h3>
<p>Following are the topics that you will read about in this article &#8211;</p>
<p><strong>1)</strong> Adding the remaining 2 test cases to the framework</p>
<p><strong>2)</strong> Implementing the 3-tier reporting structure</p>
<p><strong>3)</strong> Adding auto-email functionality to the framework</p>
<p><strong>4)</strong> Sample downloadable framework code</p>
<p><strong>5)</strong> Further suggestions for improving the framework</p>
<p><span><br />
</span></p>
<h3>Adding the remaining test cases to the framework</h3>
<p>Till now, the framework that we have created contains only one test case. When we covered the basic approach for creating a hybrid framework, we had mentioned that you start with a single test case and then add various framework features around it. Once most of the important features have been incorporated, then you should start adding the further test cases to the framework.<br />
<span><br />
</span><br />
Currently you have the hybrid framework at a stage where most of the important features (such as code modularity, data handling capability, batch execution) have been added to it. The features that you still have to add are 3-tier reporting and auto-email capabilities. Now both these features can be considered as good to have. They can&#8217;t be classified as core must have features. Even if you don&#8217;t implement these features, you will still have a basic hybrid framework to work with.<br />
<span><br />
</span><br />
So, going by the above logic, now is the time when you can add the remaining test cases to the framework. The below image shows the test cases that are to be added to the framework.</p>
<p><img loading="lazy" decoding="async" class="aligncenter" alt="Hybrid Framework in QTP - Test Case List" src="https://www.automationrepository.com/wordpress/wp-content/uploads/ar/hybrid-framework-in-qtp-test-cases-list-pt-4.png" width="390" height="110" /></p>
<p><span><br />
</span></p>
<h3>Approach to add the test cases to the framework</h3>
<p>When we started creating the hybrid framework from scratch, the first step that we performed as to add a test case to the framework. And the approach we had followed at that time was this &#8211;</p>
<p><img loading="lazy" decoding="async" class="aligncenter" alt="Hybrid Framework in QTP - First Test Case Flow" src="https://www.automationrepository.com/wordpress/wp-content/uploads/ar/hybrid-framework-in-qtp-test-case-flow-pt-4.png" width="490" height="346" /></p>
<p>The reason we followed this approach in the beginning was, because at that time, the hybrid framework was nothing but a collection of folders (as defined by our folder structure). We didn&#8217;t have reusable functions or any other code at that time with us. Hence, we had to create the first test case in linear fashion.<br />
<span><br />
</span><br />
But now, at this point, you have the reusable function libraries (both application independent and application specific functions) and various other capabilities built into the framework. So this time, you should not try to write the test case in linear fashion first and then convert it by adding functions to it. Now, while writing the test script, you should directly use the reusable functions wherever applicable.<br />
<span><br />
</span><br />
Once you added both of the remaining test cases, you would have 2 additional test scripts in your framework. As with the structure of the first test case, these additional test cases would look something like this &#8211;</p>
<p><strong>Test Case &#8211; TC02_CreateAndUpdateOrder</strong></p>
<pre class="brush: vb; title: ; notranslate">
fnLogin()
fnCreateOrder()
fnUpdateOrder()
fnCloseApplication()
</pre>
<p><em> </em><br />
<strong>Test Case &#8211; TC03_CreateAndDeleteOrder</strong></p>
<pre class="brush: vb; title: ; notranslate">
fnLogin()
fnCreateOrder()
fnDeleteOrder()
fnCloseApplication()
</pre>
<p>As you had done in case of the first test script, the code for these new functions (like fnUpdateOrder, fnDeleteOrder) should also be stored in the application specific function library.</p>
<p><span><br />
</span></p>
<h3>Executing the newly added test scripts</h3>
<p>Once you have added the new test scripts, the next step would be to see that these test scripts are working fine. First you should run both these newly added test scripts individually through QTP. Bu you shouldn&#8217;t stop here. There is another important point that needs to be checked. Since you have implemented the batch execution functionality, its only logical that you execute all these test cases in batch mode to verify that the code you have written for batch execution works fine for multiple test cases also.<br />
<span><br />
</span><br />
In order to check this, open your batch excel sheet. You would have noted that we have already added all the test cases in the batch excel sheet. But only the first test case is marked as &#8216;Yes&#8217;. Since you want to execute all the 3 test cases, set the value in &#8216;Execute&#8217; column to Yes for all the 3 rows. Save the excel sheet and click on Execute button. Check that the framework executes all the 3 test cases one after the other without any issues.</p>
<p><img loading="lazy" decoding="async" class="aligncenter" alt="Batch Execution of Test Scripts" src="https://www.automationrepository.com/wordpress/wp-content/uploads/ar/hybrid-framework-in-qtp-batch-execution-pt-4.png" width="543" height="166" /><br />
<span><br />
</span><br />
<span style="text-decoration: underline;"><strong>Important Note:</strong></span> Till now in this article, what we have done is &#8211; we took the framework with whatever features it had and then we added all the remaining test cases to it. And our plan is to add the remaining features (reporting, auto-email) in the framework after adding all the test cases. This approach works fine in this scenario because we have very few test cases. However, in real life circumstances you would have a lot of test cases that have to be automated.<br />
<span><br />
</span><br />
In such a situation, you shouldn&#8217;t just add all the test cases in one go and then later add more features to the framework (like the way we are doing it here). The ideal way to work then would be to add few test cases, then implement couple of features, then again add few more test cases followed by more features. This is a proper, balanced way which you should follow to improve the framework together with adding more test cases to it.</p>
<p><span><br />
</span></p>
<h3>Test Script Reporting &#8211; 2 Basic Rules</h3>
<p>When it comes to implementing the reporting features in your automation framework, there are 2 basic rules that you should always try to follow. These rules are &#8211;<br />
<span><br />
</span><br />
<strong>1) Never overwrite the test results:</strong> When you normally execute a test case multiple times, what QTP would do is that it would overwrite the previous results with the new ones. This should be fine when you are running a one-off test script randomly, but its a strict no when you actually execute your test scripts as a part of an automation framework.<br />
<span><br />
</span><br />
This becomes much more important when you execute lot of test scripts on a daily basis. There might be times when your client would want to see some sort of report or projections about the number of test cases getting executed or defects being reported on a daily basic. This information would not be available with you if you keep overwriting your test case results.<br />
<span><br />
</span><br />
One of the easiest ways you can use to &#8220;not overwrite your test results&#8221; is to append the test result file name with a unique random string. Having a unique random file name will ensure that your test results are never overwritten. And what would be a better way than using a date-time stamp as the unique, random string? Apart from providing a unique file name every time, date-time stamp provides you another advantage wherein you would find it easier to sort of the test results and number of test runs based upon dates.<br />
<span><br />
</span><br />
<strong>2) Provide test result reporting at different levels:</strong> This is another important feature that you should always try to incorporate in your framework. Consider a scenario where you have hundreds of test cases in your automated regression suite and you have only implemented QTP&#8217;s standard reporting format in your automation framework.<br />
<span><br />
</span><br />
Now, imagine that you test lead or project manager asks you the status of test run (with some basic information about which all scenarios have passed or failed). In such a situation, you cant just show the QTP result of each and every test case to your manager. He may not have time to go through all the details or may not be technically that good with QTP to understand the test results. A good solution in this situation would be to have all the test cases listed in an excel sheet with a &#8220;Passed&#8221; or &#8220;Failed&#8221; against each of the tests. This excel would act as a summarized report which would be easier for your manager to understand.<br />
<span><br />
</span><br />
Extend the above scenario further to assume that your program manager or client needs a report on the test runs. In most of the cases, these people work on a lot of different projects and hence they mostly don&#8217;t track the execution to the test case level. For them, its just the basic information (like total number of test cases executed/passed/failed and some general data around the number of defects) that matters.<br />
<span><br />
</span><br />
Hence, its important that your automation framework itself prepares all this data at different levels rather than you having to figure it out manually. So keeping in mind the importance of this reporting structure, we have decided to incorporate this 3-tier reporting mechanism in this automation framework. This 3-tier reporting architecture would contain reporting at the following levels &#8211;</p>
<p><img loading="lazy" decoding="async" class="aligncenter" alt="QTP Hybrid Framework - Reporting Architecture" src="https://www.automationrepository.com/wordpress/wp-content/uploads/ar/hybrid-framework-in-qtp-reporting-architecture-pt-4.png" width="600" height="212" /></p>
<p><span><br />
</span></p>
<h3>Implementing the 3-tier Reporting Structure</h3>
<p>In the previous section, you saw why its important to create a reporting structure that caters to different sets of audience. In this section, we will show how you can actually implement this reporting mechanism in your framework.<br />
<span><br />
</span><br />
<strong>1) <span style="text-decoration: underline;">QTP based Detailed Reports</span>:</strong> &#8216;QTP based Reports&#8217; is the default report where you have separate QTP result file for each test script run. QTP based detailed reports are the easiest to implement as they are automatically generated by QTP when you execute a test script. So in most of the cases, there&#8217;s nothing additional that you would need to do from your end to implement this. A normal QTP based result would look something like this &#8211;</p>
<p><img loading="lazy" decoding="async" class="aligncenter" alt="Hybrid Framework - QTP based Detailed Report" src="https://www.automationrepository.com/wordpress/wp-content/uploads/ar/hybrid-framework-qtp-based-detailed-result-pt-4.png" width="337" height="330" /><br />
<span><br />
</span><br />
So, when you use the batch excel sheet to execute the test scripts in batch mode, QTP will automatically generate the test results for you. The only thing that you have to do from your end is to provide the location where these results would be stored. Also, as discussed in the previous section, you would need to append the result file name with date-time stamp so that the file name is unique and the results never get overwritten. The logic that we will use to come up with the unique result location for a test case is this &#8211;</p>
<p><img loading="lazy" decoding="async" class="aligncenter" alt="QTP Hybrid Framework - Unique Location for Test Results" src="https://www.automationrepository.com/wordpress/wp-content/uploads/ar/hybrid-framework-in-qtp-unique-result-location-pt-4.png" width="602" height="109" /><br />
<span><br />
</span><br />
Since the code for batch execution is added in <strong>DriverScript.vbs</strong> file, you would need to make the following code changes in the file so that the QTP result for each test case gets stored in its appropriate location.</p>
<pre class="brush: vb; title: ; notranslate">
'Create the Run Results Options object
Set qtpResult = CreateObject(&quot;QuickTest.RunResultsOptions&quot;)
'Set the results location
sQTPResultsPath = sQTPResultsLocation &amp; sTestCaseName  &amp; &quot;_&quot; &amp; sDateTimeStamp
qtpResult.ResultsLocation = sQTPResultsPath
'Run the test
qtpTest.Run qtpResult
</pre>
<p>The above code would first set the result path to the folder location you specified. And then when the test script is executed, QTP would store the test run result directly to that folder location. This is all that you have to do to implement the &#8220;QTP based Detailed Reports&#8221; in your framework.<br />
<span><br />
</span><br />
<strong> 2.1) <span style="text-decoration: underline;">Excel based Summarized Reports (Design Part)</span>:</strong> The most basic Excel based Summarized Report is one where you have an excel sheet with just 3 columns &#8211; first column would store the test case name, the second one would contain the status of the test script run, and the third column will have a link that will point towards the detailed QTP based result for that test case. This basic excel based report will look like this &#8211;</p>
<p><img loading="lazy" decoding="async" class="aligncenter" alt="QTP Hybrid Framework - Excel based Summarized Report" src="https://www.automationrepository.com/wordpress/wp-content/uploads/ar/hybrid-framework-in-qtp-summarized-reports-3-columns-pt-4.png" width="554" height="108" /><br />
<span><br />
</span><br />
However, its a good practice to extend this excel based report to add some more columns to it. Some other frequently used columns that you can add here are &#8211; test case execution date, execution start time, end time and the total duration of execution. Other than these, there might be some other fields that you would need to add depending upon your project requirements. <strong>The format of the excel based summarized reports that we will use in this framework is shown below.</strong><br />
<em> </em><br />
<img loading="lazy" decoding="async" class="aligncenter" alt="QTP Hybrid Framework - Excel based Summarized Report (Extended)" src="https://www.automationrepository.com/wordpress/wp-content/uploads/ar/hybrid-framework-in-qtp-summarized-reports-extended-pt-4.png" width="629" height="118" /><br />
<span><br />
</span><br />
<strong>2.2) <span style="text-decoration: underline;">Excel based Summarized Reports (Coding Part)</span>:</strong> You would need to follow the below mentioned steps to implement the excel based summarized reports in your framework.</p>
<p><strong>Step a)</strong> The first step is the actual creation of this excel sheet. This is how it would work. Whenever you execute some test cases in batch mode, the automation framework would first create a blank result excel sheet. This blank excel sheet would just contain the headers and different columns (as mentioned in the above image). The framework would append a date-time stamp with this result sheet and save it in its intended location. Only after this excel file is created would the automation framework start executing the test cases. The code to create this blank excel result file is given below &#8211;</p>
<pre class="brush: vb; title: ; notranslate">
Set objExcel = CreateObject(&quot;Excel.Application&quot;)
objExcel.DisplayAlerts = False
Set objWorkbook = objExcel.Workbooks.Add()
'Set Header
objExcel.Cells(1, 1).Value = &quot;TestCase_Name&quot;
objExcel.Cells(1, 2).Value = &quot;Status&quot;
objExcel.Cells(1, 3).Value = &quot;Test Results Path&quot;
objExcel.Cells(1, 4).Value = &quot;Execution Date&quot;
objExcel.Cells(1, 5).Value = &quot;Start Time&quot;
objExcel.Cells(1, 6).Value = &quot;End Time&quot;
objExcel.Cells(1, 7).Value = &quot;Duration&quot;
'Save and close excel
objWorkbook.SaveAs(sBatchRunPath &amp; sTimeStamp &amp; &quot;.xls&quot;)
objExcel.Quit
Set objWorkbook = Nothing
Set objExcel = Nothing
</pre>
<p><em> </em><br />
<strong>Step b)</strong> Once the blank result sheet has been created, the next step would be to update this excel sheet as and when a test script is executed. For this, what the automation framework would do is that, every time it executes a test script, it will first capture all the necessary details about the test run. After this, the framework will open the result sheet and will update the result. Thereafter, it will close the result excel sheet. The code for this is given below.</p>
<pre class="brush: vb; title: ; notranslate">
'Open Result Sheet and update the result
Set objExcel = CreateObject(&quot;Excel.Application&quot;)
Set objWorkbook = objExcel.WorkBooks.Open(sBatchRunPath &amp; sTimeStamp &amp; &quot;.xls&quot;)
objExcel.DisplayAlerts = False
'Set the results
objExcel.Cells(iResultSheetRowCounter, 1).Value = TCName
objExcel.Cells(iResultSheetRowCounter, 2).Font.Bold = TRUE
objExcel.Cells(iResultSheetRowCounter, 2).Value = Status
'Color status
Select Case Status
	Case &quot;NA&quot;
		objExcel.Cells(iResultSheetRowCounter, 2).Font.Color = RGB(139, 137, 137)
	Case &quot;Passed&quot;
		objExcel.Cells(iResultSheetRowCounter, 2).Font.Color = RGB(0, 100, 0)
	Case &quot;Failed&quot;
		objExcel.Cells(iResultSheetRowCounter, 2).Font.Color = RGB(245, 0, 0)
	Case Else
		objExcel.Cells(iResultSheetRowCounter, 2).Font.Color = RGB(255, 255, 0)
End Select
objExcel.Cells(iResultSheetRowCounter, 3).Value = TestResultPath
objExcel.Cells(iResultSheetRowCounter, 4).Value = ExecutionDate
objExcel.Cells(iResultSheetRowCounter, 5).Value = StartTime
objExcel.Cells(iResultSheetRowCounter, 6).Value = EndTime
objExcel.Cells(iResultSheetRowCounter, 7).Value = Duration
'Save and close excel
objWorkbook.SaveAs(sBatchRunPath &amp; sTimeStamp &amp; &quot;.xls&quot;)
objExcel.Quit
Set objWorkbook = Nothing
Set objExcel = Nothing
</pre>
<p><em> </em><br />
<strong>Step c)</strong> The automation framework would perform the above step (step b) for all the test cases that are executed as a part of that batch. Once all the test cases are executed, QTP will stop the execution and you will be left with the summarized excel report that will contain the results for all the test cases executed as part of that batch.<br />
<span><br />
</span><br />
<strong>3) <span style="text-decoration: underline;">Email/SMS based Concise Reports</span>:</strong> The concise report that you would create will contain a very high level information about the test run result. It would just provide a quick summary about the number of test cases executed together with the passed/failed numbers. This concise report when sent as an email would look something like this &#8211;</p>
<p><img loading="lazy" decoding="async" class="aligncenter" alt="QTP Hybrid Framework - Email based Concise Report" src="https://www.automationrepository.com/wordpress/wp-content/uploads/ar/hybrid-framework-in-qtp-email-based-concise-report-pt-4.png" width="413" height="237" /><br />
<span><br />
</span><br />
This concise report would mostly be used while sending emails and SMSes. Since, we will only be dealing with sending emails in this framework, the coding part of the concise reports would be covered in the Email section.</p>
<p><span><br />
</span></p>
<h3>Adding auto-email functionality to the framework</h3>
<p>Whenever you execute a set of test cases in batch mode, the hybrid framework would provide you an option to send an email automatically to a set of recipients. This email would notify the recipients that the batch run has been completed. This email would also provide them, the information about the status of the batch run.<br />
<span><br />
</span><br />
Whenever you execute a set of test cases in batch mode, the automation framework will keep a track of the number of test cases executed/passed/failed by using some <a title="2 Different Ways to Create Global Variables in QTP" href="http://www.automationrepository.com/2011/10/global-variables-in-qtp/" target="_blank">global level variables</a>. These variables would be updated by the following code. You should be adding in the DriverScript.vbs file.</p>
<pre class="brush: vb; title: ; notranslate">
'Number of test cases executed till now
iTestCaseExecuting = iTestCaseExecuting + 1
'Find Run Status
sRunStatus = qtpTest.LastRunResults.Status
Select Case sRunStatus
	Case &quot;Passed&quot;    iTotalPassed = iTotalPassed + 1
	Case &quot;Failed&quot;	 iTotalFailed = iTotalFailed + 1
	Case Else	 iTotalOthers = iTotalOthers + 1
End Select
</pre>
<p><em> </em><br />
Once you have all the numbers ready, you can then use them in the email to send the concise report to the intended recipients. The code for sending the email is given below.</p>
<pre class="brush: vb; title: ; notranslate">
'Create an object of type Outlook
Set objOutlook = CreateObject(&quot;Outlook.Application&quot;)
Set myMail = objOutlook.CreateItem(0)
'Set the email properties
myMail.To = sEmailTo
myMail.CC = sEmailCc
myMail.BCC = sEmailBcc
myMail.Subject = sEmailSubject &amp; &quot; - &quot; &amp; Date
If sEmailBody = &quot;&quot; Then
  sMessage = &quot;Total Test Cases Executed - &quot; &amp; iTestCaseExecuting - 1
  sMessage = sMessage &amp; VbCrLf &amp; &quot;Passed - &quot; &amp; iTotalPassed
  sMessage = sMessage &amp; VbCrLf &amp; &quot;Failed - &quot; &amp; iTotalFailed
  sMessage = sMessage &amp; VbCrLf &amp; &quot;Others - &quot; &amp; iTotalOthers
  myMail.Body = sMessage
ElseIf sEmailBody &lt;&gt; &quot;&quot; Then
  myMail.Body = sEmailBody
End If
'Send the mail
myMail.Send
WScript.Sleep 2000
'Clear object reference
Set myMail = Nothing
Set objOutlook = Nothing
</pre>
<p><em> </em><br />
The above code assumes that you have Microsoft Office installed and configured on the machine from where you are executing the test scripts. In case you want to use GMail or Yahoo to send the emails, you can refer to this link which would provide you with the appropriate code for sending the emails (<a title="How to send emails using QTP from Gmail and Yahoo" href="http://www.automationrepository.com/2011/11/how-to-send-emails-using-qtp-from-gmail-and-yahoo/" target="_blank">How to send emails using QTP from GMail and Yahoo</a>).<br />
<span><br />
</span><br />
Once you have implemented the email functionality in the framework, run all the test cases in batch mode once again. Check that all the test cases are executed and you receive an email thereafter which correctly mentions the status of the test execution.</p>
<p><strong>With this, we come to the end of the coding part for the hybrid automation framework. Most of the important components that we had set out for in the beginning have been incorporated in the framework. You can download the entire framework code from the below link.</strong> The next section in this article will focus on some ideas that you can incorporate in this framework to make it even better.</p>
<p><span><br />
</span></p>
<p><center><a href="https://www.automationrepository.com/wordpress/download-code/QTP-Hybrid-Framework.zip"><img decoding="async" alt="" src="https://www.automationrepository.com/wordpress/wp-content/uploads/ar/blog_images/qtp-scripts-download.png" /></a></center><span><br />
</span></p>
<h3>Further suggestions for improvements/changes in the framework</h3>
<p>Whatever we have created till now in this and the last couple of articles, is a framework at a very basic level. The components that we have used in this framework &#8211; such as object level functions, data handling capabilities, batch execution features, email, reporting etc &#8211; are very common and you would find these in almost all good hybrid frameworks.<br />
<span><br />
</span><br />
As mentioned earlier also, the basic reason why we have used only the common components in the framework, is because we want to keep this framework as simple as possible, so that its easier for the beginners to understand all the concepts. However, this shouldn&#8217;t stop you from playing around with the code and improving it further by adding more features to it. In order to help you with this task, we have provided a list of suggestions that you can try to incorporate in this framework to make it more robust and better suited for your needs. This list of suggestions is given below &#8211;<br />
<span><br />
</span><br />
<strong>1) <span style="text-decoration: underline;">Why just Outlook for Email?</span></strong> Well, Microsoft Outlook is one of the most widely used email clients in corporate world, more so in the case of bigger companies. More often that not, you would find yourself using Outlook for sending emails. But there are many other companies that use GMail or some other email clients within their organizations. So, one suggestion to make your framework more robust, is to implement the logic for sending emails through other email clients also.<br />
<span><br />
</span><br />
The best way to do this would be to provide an option to your automation team to select the email client of their choice (the team should select the email client that&#8217;s configured on their machines). And based upon their selection, your automation framework should use that email client to send the emails.</p>
<p><img loading="lazy" decoding="async" class="aligncenter" alt="QTP Hybrid Framework - Multiple Email Clients" src="https://www.automationrepository.com/wordpress/wp-content/uploads/ar/qtp-hybrid-framework-multiple-email-clients.png" width="310" height="128" /><br />
<span><br />
</span><br />
<strong>2) <span style="text-decoration: underline;">Option to configure email externally without touching the code.</span></strong> Assume that you have created the hybrid framework that&#8217;s currently being used in your project. Since its you who has created it, you would be knowing all the details and all the code in the framework. But it would not be right to assume that every team member using the framework would have the same level of understanding and comfort with the code.<br />
<span><br />
</span><br />
Hence, one of the objectives of any automation framework is to provide a mechanism to make certain changes without actually touching the code. If such a feature is provided, users would be able to easily modify certain things without having to touch the code, thereby reducing the chances of accidentally breaking something in the framework.<br />
<span><br />
</span><br />
Configuring the email settings is a good example that can (or ideally should) be kept separate from the code. For example, rather that modifying the code to make changes in To, Cc or Body of the email, you can keep these things in an excel file and let the users directly modify the excel file. Your automation framework would simply read the excel file and send the emails based upon the data provided there. The below image would give you an idea about how this excel sheet would look like.</p>
<p><img loading="lazy" decoding="async" class="aligncenter" alt="QP Hybrid Framework - Email Configuration" src="https://www.automationrepository.com/wordpress/wp-content/uploads/ar/qtp-hybrid-framework-pt-4-email-configuration.png" width="600" height="397" /><br />
<span><br />
</span><br />
<strong>3) <span style="text-decoration: underline;">Intermediate status messages</span>.</strong> This is something that many of you would have actually faced while working on automation projects. Imagine a situation where you are executing an automated regression suite that contains a lot of test cases (say more than 100). Once you click on execute button, there is nothing much to do other than just stare at the screen to see how the test execution is progressing. We all know how boring this can get. :&#8211;)<br />
<span><br />
</span><br />
In such situations, you might go away from your desk for some time. For a coffee break or something else. When you return back, you see that the test cases are still getting executed, but now you might not have an idea about the number of test cases that are still remaining and hence the approximate amount of time the execution would go on for.<br />
<span><br />
</span><br />
In such a case, having an intermediate status message is very useful. This &#8216;intermediate status message&#8217;  might simply be an auto closing pop-up message box that gets displayed after every test case run. You can configure this pop-up message to display the basic information, such as the total number of test cases executed till now, total test cases passed/failed till now. This information would help you get an idea about how well the execution is proceeding and approximately how much more time would the execution proceed for. An example of such a pop-up message box and its code is given below.</p>
<p><img loading="lazy" decoding="async" class="aligncenter" alt="Intermediate Test Run Status" src="https://www.automationrepository.com/wordpress/wp-content/uploads/ar/hybrid-framework-intermediate-test-run-status.png" width="340" height="214" /><br />
<em> </em></p>
<pre class="brush: vb; title: ; notranslate">
'Prepare the message to be displayed
sMsg = &quot;Executing &quot; &amp; iTestCaseExecuting &amp; &quot; of &quot; &amp; iTotalTestCasesToBeExecuted &amp; &quot; Test Cases...&quot; &amp; VbCrLf
sMsg = sMsg &amp; &quot;Passed - &quot; &amp; iTotalPassed &amp; VbCrLf  &amp; &quot;Failed - &quot; &amp; iTotalFailed
sMsg = sMsg &amp;  VbCrLf  &amp; VbCrLf  &amp; &quot;(This message will close automatically in 5 seconds)&quot;
'Display the message for certain number of seconds
Set WshShell = CreateObject(&quot;Wscript.Shell&quot;)
WshShell.Popup sMsg, 5, &quot;Intermediate Test Run Status&quot;
Set WshShell = Nothing
</pre>
<p><em> </em><br />
<strong>4) <span style="text-decoration: underline;">Using VBA instead of VBScript for batch execution code.</span></strong> As part of this hybrid framework creation process, we have used VBScript to write the logic for batch execution. The only reason we did that was because we were more comfortable with VBScript than with VBA. But if you try to switch to VBA, it wouldn&#8217;t make any difference from framework&#8217;s functioning point of view. However, the plus point here would be that you would get to work on and learn something new, i.e. coding in VBA.<br />
<span><br />
</span><br />
<strong>5) <span style="text-decoration: underline;">Framework configuration through external means.</span></strong> This is an extension of the feature that we had covered above in point #2. Configuring the email options is not the only thing you can do without touching the code. There would be a lot of other things in the framework that you may want to configure by external means. The below image shows some more things that you can configure by using excel sheets as an external mechanism.</p>
<p><img loading="lazy" decoding="async" class="aligncenter" alt="External Framework Configuration Settings" src="https://www.automationrepository.com/wordpress/wp-content/uploads/ar/qtp-hybrid-framework-pt-4-external-framework-configuration.png" width="603" height="491" /><br />
<span><br />
</span><br />
<strong>6) <span style="text-decoration: underline;">Keeping all the folder locations at a single place</span>.</strong> If you would have observed, this automation framework works with a lot of different folders (like folders for test cases, data sheets, results etc). And all these folder locations have to be specified somewhere within the code so that the framework can access it as and when required. Currently, all these folder locations are scattered at multiple places within the framework. One good idea would be to keep all these locations in a single place, preferably in an XML file.<br />
<span><br />
</span><br />
The main advantage of this approach is that it would be easier for everyone to update the locations, as all of them would be available at a single place. If you want to follow this approach, you would have to include additional code in your framework that would read the XML file and extract all the folder locations from it. The below image shows you the sample structure of such an XML file.</p>
<p><img loading="lazy" decoding="async" class="aligncenter" alt="External XML File" src="https://www.automationrepository.com/wordpress/wp-content/uploads/ar/qtp-hybrid-framework-external-xml-file.png" width="628" height="381" /><br />
<span><br />
</span><br />
<strong>With this, we conclude the &#8216;Hybrid Framework in QTP&#8217; series. Hope you would have enjoyed reading these articles and would have got something useful to learn. Download the code and let us know if you face any issues while running it. You can pour in your thoughts about this article/series by using the comments section.</strong></p>
<p><span><br />
</span></p>
<div style="font-family: Verdana,sans-serif; border: 1px solid #C8B560; padding: 3mm; background: #FFF8C6; text-align: center;">
<p><strong>If you enjoyed this article, you can join our blog to get new articles delivered directly in your inbox.</strong></p>
<form style="text-align: center;" action="http://feedburner.google.com/fb/a/mailverify" method="post" target="popupwindow" onsubmit="window.open('http://feedburner.google.com/fb/a/mailverify?uri=automationrepository/feeds', 'popupwindow', 'scrollbars=yes,width=550,height=520');return true"><input style="width: 160px; height: 20px;" type="text" value="Enter Your Email Address" onfocus="if (this.value == 'Enter Your Email Address') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Enter Your Email Address';}" /> <input type="hidden" name="uri" value="automationrepository/feeds" /> <input type="hidden" name="loc" value="en_US" /> <input type="submit" value="Join Us" /></p>
<p style="text-align: justify;">
</form>
</div>
<p style="border: 1px solid #C38EC7; padding: 3mm; background: #EBDDE2;"><strong>Visit <a title="QTP Frameworks – An Introduction" href="http://www.automationrepository.com/2012/03/qtp-framework-types-an-introduction/">QTP Frameworks</a> Main Page for more articles on QTP Frameworks</strong>. You can also visit our <a title="QTP Tutorials" href="http://www.automationrepository.com/tutorials-for-qtp-beginners/" target="_blank">QTP Tutorials</a> page for detailed QTP Tutorials.</p>
<p>The post <a rel="nofollow" href="https://www.automationrepository.com/wordpress/2013/09/designing-hybrid-framework-in-qtp-part-4/">Designing Hybrid Framework in QTP &#8211; Part 4 [Final Part]</a> appeared first on <a rel="nofollow" href="https://www.automationrepository.com/wordpress">XX</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.automationrepository.com/wordpress/2013/09/designing-hybrid-framework-in-qtp-part-4/feed/</wfw:commentRss>
			<slash:comments>19</slash:comments>
		
		
			</item>
		<item>
		<title>Designing Hybrid Framework in QTP &#8211; Part 3</title>
		<link>https://www.automationrepository.com/wordpress/2013/08/designing-hybrid-framework-in-qtp-part-3/</link>
					<comments>https://www.automationrepository.com/wordpress/2013/08/designing-hybrid-framework-in-qtp-part-3/#comments</comments>
		
		<dc:creator><![CDATA[Anish Pillai]]></dc:creator>
		<pubDate>Wed, 07 Aug 2013 16:43:58 +0000</pubDate>
				<category><![CDATA[Advanced Concepts]]></category>
		<category><![CDATA[QTP Framework]]></category>
		<category><![CDATA[QTP Hybrid Framework]]></category>
		<guid isPermaLink="false">http://www.automationrepository.com/?p=2106</guid>

					<description><![CDATA[<p>In the previous article on Hybrid Framework in QTP, we started writing the code to create the Hybrid Framework. We created one test script (in linear fashion) and then implemented the features of QTP modular framework into it. In this article, we will take up the same framework and extend it further by adding more &#8230; <a href="https://www.automationrepository.com/wordpress/2013/08/designing-hybrid-framework-in-qtp-part-3/">Read more <span class="meta-nav">&#8594;</span></a></p>
<p>The post <a rel="nofollow" href="https://www.automationrepository.com/wordpress/2013/08/designing-hybrid-framework-in-qtp-part-3/">Designing Hybrid Framework in QTP &#8211; Part 3</a> appeared first on <a rel="nofollow" href="https://www.automationrepository.com/wordpress">XX</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>In the previous article on <a title="Designing Hybrid Framework in QTP – Part 2" href="http://www.automationrepository.com/2013/08/designing-hybrid-framework-in-qtp-part-2/" target="_blank">Hybrid Framework in QTP</a>, we started writing the code to create the Hybrid Framework. We created one test script (in linear fashion) and then implemented the features of QTP modular framework into it. In this article, we will take up the same framework and extend it further<span id="more-2106"></span> by adding more features to it. We will start by adding the capability to fetch the data from excel data sheets and then will implement the batch execution functionality to the framework.</p>
<p><span><br />
</span></p>
<h3>Topics covered in this article</h3>
<p>Following are the topics that we will cover in this article &#8211;</p>
<p><strong>a)</strong> Approach used to fetch data from excel sheets</p>
<p><strong>b)</strong> Structure of the excel sheet and the actual code to fetch the data</p>
<p><strong>c)</strong> Different ways to achieve batch execution with QTP</p>
<p><strong>d)</strong> Preparing the batch excel sheet</p>
<p><strong>e)</strong> Implementing the VBScript code to execute the test scripts from the batch sheet</p>
<p><span><br />
</span></p>
<h3>How would data be fetched from excel sheets</h3>
<p>Right now, the hybrid framework that you have with you doesn&#8217;t have the capability to fetch data from excel sheets. You have created custom functions (application independent functions) for all the QTP operations. And many of these custom functions have a parameter where you directly pass the data which you want to enter in the application. For example, the function fnSetValueInTextField takes whatever value you provide as an argument and then enters that value in the application. This is how it currently works &#8211;</p>
<p><img loading="lazy" decoding="async" class="aligncenter" alt="Hybrid Framework in QTP - Entering test data directly in application" src="https://www.automationrepository.com/wordpress/wp-content/uploads/ar/hybrid-framework-enter-test-data-in-application.png" width="537" height="334" /></p>
<p><em> </em><br />
But we don&#8217;t want our framework to work this way. What we want is that our data should be stored in excel sheets and the custom function should fetch the data from the excel sheet itself. So, our approach to fetch the data would be like this &#8211;</p>
<p><strong>1)</strong> The data will be stored in the excel sheet(s).</p>
<p><strong>2)</strong> Instead of passing the actual data in the custom function, we will pass the excel column header.</p>
<p><strong>3)</strong> The custom function will open the excel sheet and find out the test data with the help of the column header.</p>
<p><strong>4)</strong> The function will then set this data (obtained from the excel sheet) in the application.</p>
<p>The below image shows how this new concept would work &#8211;</p>
<p><img loading="lazy" decoding="async" class="aligncenter" alt="Hybrid Framework in QTP - Approach to fetch data from the excel sheets" src="https://www.automationrepository.com/wordpress/wp-content/uploads/ar/hybrid-framework-approach-to-fetch-data-from-excel-sheet.png" width="561" height="418" /></p>
<p><em> </em><br />
Now, there are various ways in which you can fetch data from excel sheets. And the method that we would use in this framework is this- <strong>we will not fetch the data directly from excel sheet. Our custom function will first import the data from excel sheet into QTP data table and then will fetch the actual test data from the data table.</strong> This is how it will look like &#8211;</p>
<p><img loading="lazy" decoding="async" class="aligncenter" alt="QTP Hybrid Framework - Different approaches to fetch data from excel sheet" src="https://www.automationrepository.com/wordpress/wp-content/uploads/ar/hybrid-framework-different-approaches-to-fetch-excel-data.png" width="647" height="485" /></p>
<p><em> </em><br />
For more details on the different ways to fetch data from the excel sheets, you can refer the articles on <a title="Data Driven Framework in QTP : The Complete Guide – Part 1" href="http://www.automationrepository.com/2012/05/qtp-data-driven-framework-design-with-examples/" target="_blank">QTP data driven framework</a>.</p>
<p><span><br />
</span></p>
<h3>Structure of the excel data sheets</h3>
<p>The structure of your data sheet plays a very important part in the overall flow of your framework. And this data sheet structure becomes much more important when you are dealing with a lot of test cases (say more than 50 test cases). Also, there would be many other situations (like test cases being data intensive) that decide the structure of your data sheets.</p>
<p><em> </em><br />
You would have to factor in all these criteria and select the data sheet format that best suites your project and your requirements. We have provided ample examples of different data sheet formats and how they are integrated with the code in data driven and keyword driven frameworks. You can refer those articles to get a better understanding of all those concepts in detail.</p>
<p><em> </em><br />
However, in this article, we will try to keep things as simple as possible. And since we are working with only 3 test cases in this framework, we will create the most basic data sheet format. So, the data sheet format/structure that we will be using is as follows &#8211;</p>
<p><strong>a)</strong> The framework will have 1 excel workbook as the data sheet.</p>
<p><strong>b)</strong> Each test case will have its own separate excel sheet within that workbook.</p>
<p><strong>c)</strong> So, this framework will use <strong>one excel workbook having three excel sheets</strong> (one sheet for each test case)</p>
<p><strong>d)</strong> The name of each sheet will be same as the test case name. Doing this is important because if you keep the same names for the test case and the data sheet, it will become easier for the automation framework to identify the correct data sheet based upon the test case name.</p>
<p>The below image shows how the data sheet would actually look like.</p>
<p><img loading="lazy" decoding="async" class="aligncenter" alt="QTP Hybrid Framework - Structure of excel data sheets" src="https://www.automationrepository.com/wordpress/wp-content/uploads/ar/qtp-hybrid-framework-structure-of-data-sheets.png" width="613" height="305" /></p>
<p>It is now time start working on the actual code that will fetch the data from the excel workbook.</p>
<p><span><br />
</span></p>
<h3>Actual code to fetch the data from the excel sheets</h3>
<p>Let us first see the approach that will be used to fetch the data from the excel sheet.</p>
<p><strong>1)</strong> You will create a separate function called <strong>fnFetchDataFromExcelSheet(). </strong>This is the function that will actually fetch the test data.</p>
<p><strong>2)</strong> This function will take an argument which will be the column header of the excel sheet.</p>
<p><strong>3)</strong> This function will be added inside other functions that actually set some value in the application. For example, you use <strong>fnSetValueInTextField()</strong> to enter some value in the application. So our function to fetch the data will be added inside fnSetValueInTextField() function.</p>
<p><strong>4)</strong> When you execute your test case, this function will get called. This function will first open the excel workbook and identify the sheet from which the data is to be fetched (the sheet will be identified from the test case name).</p>
<p><strong>5)</strong> It will then copy the entire data from the sheet and will load it into QTP data table.</p>
<p><strong>6)</strong> Once all the data is loaded into the QTP data table, this function will fetch the actual value by using the column header.</p>
<p><strong>7)</strong> Once the value is fetched, it will pass this data to the calling function (like fnSetValueInTextField) which will actually set the data in the application.<br />
<span><br />
</span><br />
To implement this code you have to follow the steps given below &#8211;</p>
<p><strong>1) </strong>Add the function that will fetch the data from the excel sheet in your function library. If you would have observed, this function is not application specific. It just fetches the data from the excel sheet. And hence, it has got nothing to do with your application. So, you have to save this function in the <strong>Generic_FunctionLibrary</strong> folder. The code for the function is given below &#8211;</p>
<pre class="brush: vb; title: ; notranslate">
'================================================================================
'Function name - fnFetchDataFromExcelSheet
'Description - This function retrieves the data from the excel sheet based upon the column name
'================================================================================
Function fnFetchDataFromExcelSheet(strColumnName)

	Dim sColValue

	'Initialize the return the value to &quot;empty&quot; string
	fnFetchDataFromExcelSheet = &quot;empty&quot;

	'Add a new blank sheet into the QTP data table
	'Excel data will be copied into this blank sheet
	DataTable.AddSheet(&quot;dtDataSheet&quot;)

	'Import the data from the excel sheet into the QTP data table
	DataTable.ImportSheet sExcelWorkbookPath, sSheetName, &quot;dtDataSheet&quot;

	'Find the value from the data table
	sColValue = DataTable.Value(strColumnName, &quot;dtDataSheet&quot;)

	'Return the value back to the calling function
	fnFetchDataFromExcelSheet = sColValue

	'Remove Reference
	DataTable.DeleteSheet(&quot;dtDataSheet&quot;)

End Function
'================================== End Function ==================================
</pre>
<p><em> </em><br />
<strong>2) </strong>This function uses 2 variables. <strong>sExcelWorkbookPath</strong> and <strong>sSheetName</strong>. These variables have to be defined somewhere. To do that, add the following code at the beginning generic function library (the same function library where you added the above function).</p>
<pre class="brush: vb; title: ; notranslate">
Dim sExcelWorkbookPath, sSheetName
sExcelWorkbookPath = &quot;C:\QTP-Hybrid-Framework\DataSheet\TestData.xls&quot;
</pre>
<p><em> </em><br />
<strong>3) </strong>For the above function to work, the test case name should be passed to the function. The code to retrieve the test case name should be added in the main test case. And after adding the code to the main test case, the modified test case will look like this &#8211;</p>
<pre class="brush: vb; title: ; notranslate">
'Get the test case name into a variable
sSheetName = Environment.Value(&quot;TestName&quot;)

fnLogin()
fnCreateOrder()
fnCloseApplication()
</pre>
<p><em> </em><br />
<strong>4) </strong>Now, your function to fetch the data has been implemented. So, the next step would be to add this function call in those functions that actually enter the data in the application. As an example, we have shown how function <strong>fnSetValueInTextField()</strong> will look like after you have added the code to it.</p>
<pre class="brush: vb; title: ; notranslate">
'================================
'Function name - fnSetValue
'Description - Set value in a text field
'================================
Function fnSetValue(objControl, strColumnName)

On Error Resume Next
Dim sReqdValue

'Get vale from Excel Sheet
sReqdValue = fnFetchValueFromExcelSheet(strColumnName)

'Perform Action
If sReqdValue &lt;&gt; &quot;empty&quot; Then
objControl.Set sReqdValue
Else
Reporter.ReportEvent micFail, &quot;Column - '&quot; &amp; strColumnName &amp; &quot;' Not Found in Data Sheet&quot;, &quot;Failed&quot;
End If

'Report out the result
If Err.Number = 0 Then
Reporter.ReportEvent micPass, &quot;Value - '&quot; &amp; sReqdValue &amp; &quot;' entered in Field - '&quot; &amp; objControl.ToString() &amp; &quot;'&quot;, &quot;Passed&quot;
End If

End Function
'================================
</pre>
<p><em> </em><br />
<strong>5)</strong> The function call for fetching the data from excel sheets has to be added in all the function that set value in the application. In the framework that we have created till now, there are couple of functions more that perform the set operation on the application. These functions are &#8211; <strong>fnTypeValueInActiveXField()</strong> and <strong>fnSelectDropDownValue()</strong>. So, you would have to modify these 2 functions in the same way you did for fnSetValueInTextField().</p>
<p><em> </em><br />
<strong>6)</strong> Once you have modified all the functions, run the test case once again to verify that it works fine. Try changing the data in the excel sheet and see that the function enters the changed data in the application when you execute the test case.<br />
<span><br />
</span><br />
<span style="text-decoration: underline;"><strong>Important Note:</strong></span> Till now, we have covered how you can implement excel data sheets in your hybrid framework. And to keep things simple, we have taken the simplest structure of excel data sheets &#8211; one excel workbook with multiple sheets. But in most of the hybrid frameworks that you will work on, the number of test cases will be quite big (say minimum 50 test cases). And in such a scenario, it is not advisable that you follow the data sheet structure that we have illustrated in this framework.</p>
<p><em> </em><br />
The best option would be to go through the <a title="QTP Framework Tutorials – Framework Types, Examples &amp; Sample Code" href="http://www.automationrepository.com/2012/03/qtp-framework-types-an-introduction/" target="_blank">data driven and keyword driven framework tutorials</a>. From there, you would need to select the format of data sheet that best suites your application and your requirement. The approach on how you fetch the data will remain the same (from excel sheet to QTP data table to application), but the actual code would change a bit.</p>
<p><span><br />
</span></p>
<h3>Adding batch execution features to your framework</h3>
<p>Batch execution is a very important feature and is a part of most of the good hybrid frameworks. In fact, if you have an automated test suite with a large number of test cases (be it any type of framework), having an efficient batch execution mechanism becomes a must. Before diving deeper into the details about how you can implement batch execution, let us first start with the basics and see what batch execution actually is.<br />
<span><br />
</span><br />
<span style="text-decoration: underline;"><strong>What is batch execution?</strong></span> Normally when you want to run a test script, you use the &#8220;Run&#8221; option provided by QTP. What it does is that, it will run the test script that is currently open in QTP. This &#8220;Run&#8221; option can execute only 1 test case at a time.</p>
<p><em> </em><br />
But what if you want to run a large number of test cases? Well, one option is that you open each test case one by one and click the Run option for all these test cases. This option can be tried if you have very few test cases with you. But if you have a large number of test cases, then this method is not at all a good option.</p>
<p><em> </em><br />
While dealing with a large number of test cases, you need a mechanism that can run your test cases effectively with minimum effort. And this is exactly what batch execution does for you. <strong>Batch execution is a mechanism that allows you to execute multiple number of test cases (a batch or set of test case) in one go.</strong> That is, with one click of a button, you can execute multiple test cases. And this is the reason why batch execution is sometimes referred to as one-click execution.</p>
<p><span><br />
</span></p>
<h3>Different ways to achieve batch execution with QTP</h3>
<p>One good thing about QTP is that it provides multiple ways for you to implement the batch execution features in your framework. Depending upon how complex your framework is or whether you use HP Quality Center to maintain your automation framework, you can use any of the batch execution implementations that suites your requirements.<br />
<span><br />
</span><br />
Furthermore, in all the batch execution methods that QTP supports, the basic premise (or approach) remains the same &#8211;</p>
<p><strong>a)</strong> You have to somehow create a list of test cases. This test case list is called the batch or the test set.</p>
<p><strong>b)</strong> From this list of test cases, you should be able to select the test cases that you want to execute. This selection can either be all the test cases or a subset of the test cases.</p>
<p><strong>c)</strong> There should be some execute button which, if you click, will run all the test cases that you have selected from the list.<br />
<span><br />
</span><br />
Below, we have listed down the different batch execution methods supported by QTP together with a brief description about each one of them.<br />
<span><br />
</span><br />
<strong>1) Using QTP&#8217;s Test Batch Runner tool:</strong> This is a feature/tool provided by QTP and can be found at Start &gt;&gt; All Programs &gt;&gt; HP Quick Test Professional &gt;&gt; Tools menu. Here you can add all the test cases to the batch and then click on the run button to execute the batch.</p>
<p><img loading="lazy" decoding="async" class="aligncenter" alt="QTP Test Batch Runner Tool" src="https://www.automationrepository.com/wordpress/wp-content/uploads/ar/qtp-test-batch-runner.png" width="537" height="302" /><br />
<span><br />
</span><br />
<strong>2) Using QC&#8217;s test set feature:</strong> If you are using Quality Center to store your hybrid framework, then you can create a test set in QC&#8217;s test lab. QC provides a run button, which when clicked will execute all the test cases added to that particular test set. This method of batch execution is also very helpful when you use QTP&#8217;s BPT framework.<br />
<span><br />
</span><br />
<strong> 3) Using QTP&#8217;s AOM capabilities:</strong> This is the most important method using which you can implement batch execution in your QTP framework. QTP AOM, also known as automation object model, is a feature using which QTP exposes its capabilities to the &#8220;outside world&#8221; in the form of properties and functions. Here, &#8220;outside world&#8221; refers to different programming/scripting languages like C#, VBA, VBScript etc.<br />
<span><br />
</span><br />
For example, in QTP you have different menu options or shortcuts for doing different tasks, such as opening a test case, running a test case, associating function libraries etc. And normally you would use QTP&#8217;s GUI to perform all these actions. But what AOM will do is that it will provide you with different functions that can perform all these tasks programatically. For example, AOM provides a function called &#8220;Run&#8221; that you can use to execute a given test case. So you can write a program or code that will use this Run function to execute a test case in QTP.<br />
<span><br />
</span><br />
Another good part about AOM is that it can be used with a variety of programming languages. If you are using excel sheets, then you can use AOM in VBA. If you wish to create your own little web portal to drive QTP, you can use C# with AOM.<br />
<span><br />
</span><br />
<strong>As part of this hybrid framework, we will be using the QTP AOM method to implement batch execution. </strong>The list of test cases to be executed will be maintained in an excel sheet and we will use excel macro (with VBScript + AOM) to execute the test cases in QTP.</p>
<p><span><br />
</span></p>
<h3>Preparing the batch excel sheet</h3>
<p>Implementing the batch execution in QTP using AOM is a two-step process. The <strong>first step</strong> is to create the list of test cases and the <strong>second step</strong> is to write code that will execute these test cases. In this section, we will focus on the first part, that is, creating the list of test cases in excel sheet. Follow the steps given below to create this test case list &#8211;<br />
<span><br />
</span><br />
<strong>1)</strong> Open a new excel workbook.<br />
<span><br />
</span><br />
<strong>2)</strong> Make sure that the developed tab is visible in the workbook.</p>
<p><img loading="lazy" decoding="async" class="aligncenter" alt="Developer Tab in MS Excel" src="https://www.automationrepository.com/wordpress/wp-content/uploads/ar/microsoft-excel-developer-tab.png" width="680" height="119" /></p>
<p><em> </em><br />
If the developer tab is not visible, then follow the below steps to enable the developer tab. The screenshots given below are from Microsoft Excel 2010. Based upon your version of MS Excel, you would need to figure out the steps accordingly.</p>
<p><strong>2.1)</strong> Select File &gt;&gt; Options.</p>
<p><img loading="lazy" decoding="async" class="aligncenter" alt="Enable Developer Tab in MS Excel" src="https://www.automationrepository.com/wordpress/wp-content/uploads/ar/developer-tab-file-options.png" width="135" height="454" /></p>
<p><strong>2.2)</strong> Click on Customize Ribbon from the left hand side pane.</p>
<p><img loading="lazy" decoding="async" class="aligncenter" alt="Enable Developer Tab in MS Excel" src="https://www.automationrepository.com/wordpress/wp-content/uploads/ar/developer-tab-customize-ribbon.png" width="339" height="251" /></p>
<p><strong>2.3)</strong> Select the Developer check box from the right-most pane.</p>
<p><img loading="lazy" decoding="async" class="aligncenter" alt="Enable Developer Tab in MS Excel" src="https://www.automationrepository.com/wordpress/wp-content/uploads/ar/developer-tab-developer-option.png" width="245" height="287" /></p>
<p><strong>2.4)</strong> Click OK. Developer tab should now be available in your excel sheet.<br />
<span><br />
</span><br />
<strong>3)</strong> In the excel sheet, leave the first row blank. We will add the Execute button in the first row.<br />
<span><br />
</span><br />
<strong>4)</strong> Starting with the second row, set the column headers and data as shown in the below image.</p>
<p><img loading="lazy" decoding="async" class="aligncenter" alt="QTP Hybrid Framework - Batch excel sheet structure" src="https://www.automationrepository.com/wordpress/wp-content/uploads/ar/batch-excel-sheet-without-execute-button.png" width="458" height="195" /><br />
<span><br />
</span><br />
<strong>5)</strong> Since you currently have only 1 test case in your framework, set Execute as &#8216;Yes&#8217; for the first test case. For second and third test cases, set the value as &#8216;No&#8217;.<br />
<span><br />
</span><br />
<strong>6)</strong> Save this file as &#8216;Batch.xls&#8217; in the Batch folder.<br />
<span><br />
</span><br />
<strong>7)</strong> Select Developer tab.<br />
<span><br />
</span><br />
<strong>8)</strong> Click on Insert option in Developer tab and then select the button icon under &#8216;Form Controls&#8217; section.</p>
<p><img loading="lazy" decoding="async" class="aligncenter" alt="Insert button in batch excel sheet" src="https://www.automationrepository.com/wordpress/wp-content/uploads/ar/developer-tab-insert-option.png" width="344" height="225" /><br />
<span><br />
</span><br />
<strong>9)</strong> Drag the mouse to create a button in the first column of the excel sheet.</p>
<p><img loading="lazy" decoding="async" class="aligncenter" alt="Insert button in batch excel sheet - 2" src="https://www.automationrepository.com/wordpress/wp-content/uploads/ar/batch-excel-sheet-insert-button.png" width="461" height="179" /><br />
<span><br />
</span><br />
<strong>10)</strong> In the dialog box that opens up, give a proper name to the macro and click on OK button.</p>
<p><img loading="lazy" decoding="async" class="aligncenter" alt="QTP Hybrid Framework - Set macro name" src="https://www.automationrepository.com/wordpress/wp-content/uploads/ar/set-macro-name.png" width="377" height="361" /><br />
<span><br />
</span><br />
<strong>11)</strong> The button would now be displayed in the first row. Right click on the button and change its text to &#8216;Execute&#8217;. Change other properties as required.</p>
<p><img loading="lazy" decoding="async" class="aligncenter" alt="Edit the properties of Execute button" src="https://www.automationrepository.com/wordpress/wp-content/uploads/ar/execute-button-change-properties.png" width="501" height="241" /><br />
<span><br />
</span><br />
<strong>12)</strong> Again right click on the button and select &#8216;Assign Macro&#8217; option.</p>
<p><img loading="lazy" decoding="async" class="aligncenter" alt="Assign macro to execute button" src="https://www.automationrepository.com/wordpress/wp-content/uploads/ar/assign-macro-to-execute-button.png" width="446" height="243" /><br />
<span><br />
</span><br />
<strong>13)</strong> Assign Macro dialog box should be displayed as shown below.</p>
<p><img loading="lazy" decoding="async" class="aligncenter" alt="Assign new macro to execute button - QTP Hybrid Framework" src="https://www.automationrepository.com/wordpress/wp-content/uploads/ar/assign-new-macro-to-excel-button.png" width="376" height="361" /><br />
<span><br />
</span><br />
<strong>14)</strong> Click on &#8216;New&#8217; button. Upon clicking the New button, a new window will be displayed as given below.</p>
<p><img loading="lazy" decoding="async" class="aligncenter" alt="QTP Hybrid Framework - Empty macro function" src="https://www.automationrepository.com/wordpress/wp-content/uploads/ar/execute-macro-empty-function.png" width="528" height="236" /><br />
<span><br />
</span><br />
<strong>15)</strong> Enter the following command inside the Sub function.</p>
<pre class="brush: vb; title: ; notranslate">
Shell &quot;WScript &quot; &amp; &quot;&quot;&quot;D:\QTP-Hybrid-Framework\Batch\DriverScript.vbs&quot;&quot;&quot;
</pre>
<p><em> </em><br />
The code in the sub function should now look like this &#8211;</p>
<p><img loading="lazy" decoding="async" class="aligncenter" alt="QTP Hybrid Framework - Excel macro with VBScript file call" src="https://www.automationrepository.com/wordpress/wp-content/uploads/ar/execute-macro-function-with-code.png" width="646" height="236" /></p>
<p><em> </em><br />
What this means is that when you click on the &#8216;Execute&#8217; button in the excel sheet, it will pass the control to this sub function. This sub function will in turn execute all the code that is there in <strong>DriverScript.vbs</strong> file. This DriverScript.vbs file would be the file where you will write the code to execute the test scripts. This coding part is described in the next section.</p>
<p><span><br />
</span></p>
<h3>Adding the code for batch execution</h3>
<p>When you use Microsoft Excel as your batch sheet, then you have two ways in which you can implement the coding part. These two ways are &#8211;<br />
<span><br />
</span><br />
<strong>a.) Writing the code in the macro itself:</strong> With this method, you write the code in the excel macro itself. And this code will be written in VBA. Also, since the macro code is a part of MS Excel, you don&#8217;t need to create a separate file to write the code.<br />
<span><br />
</span><br />
<strong>b.) Writing the code in VBS file:</strong> Here, you will create a separate .vbs file and write all the code in it. The excel macro will just be used to call this .vbs file. In this case, coding will be done using VBScript.<br />
<span><br />
</span><br />
Towards the end of the last section (point #15), you would have seen that we have created a separate <strong>DriverScript.vbs</strong> file. Also in the macro function, we have included a single line of code that just calls this vbs file. What this means is that we are using method b.) to write the AOM code.<br />
<span><br />
</span><br />
<span style="text-decoration: underline;"><strong>Important Note:</strong></span> Even though we have used method b. (using .vbs file) to write the code, you are free to use any of the method that suites you. The only reason we used it this way is that using .vbs file allows us to work with VBScript. And since QTP uses VBScript, we feel more comfortable with VBScript rather than with VBA.<br />
<span><br />
</span><br />
<strong>Steps to add the batch execution code:</strong> Follow the steps mentioned below to add the batch execution code to your framework.<br />
<span><br />
</span><br />
<strong>1)</strong> Open a new text file using notepad or any other text editor of your choice<br />
<span><br />
</span><br />
<strong>2)</strong> Add the following code in this text file. The explanation about the code is added with the code itself in the form of comments</p>
<pre class="brush: vb; title: ; notranslate">
'========== Declare and initialize the variables ==========
Dim sTestCaseFolder, strScriptPath, sQTPResultsPath, sQTPResultsPathOrig

sBatchSheetPath = &quot;D:\QTP-Hybrid-Framework\Batch\Batch.xls&quot;
sTestCaseFolder = &quot;D:\QTP-Hybrid-Framework\TestCases\&quot;
sQTPResultsPathOrig = &quot;D:\QTP-Hybrid-Framework\Results\DetailedQTPResults\&quot;

'========== Create an object to access QTP's objects, methods and properties ==========
Set qtpApp = CreateObject(&quot;QuickTest.Application&quot;)

'Open QTP if it is already not open
If qtpApp.launched &lt;&gt; True Then
 qtpApp.Launch
End If

qtpApp.Visible = True

'========== Set the run options for QTP ==========
qtpApp.Options.Run.ImageCaptureForTestResults = &quot;OnError&quot;
qtpApp.Options.Run.RunMode = &quot;Fast&quot;

'Set ViewResults property to false. This is because if you run many test cases in batch, you would not want QTP to open a separate result window for each of them
qtpApp.Options.Run.ViewResults = False

' ========== Read test cases from batch excel sheet ==========
Set xl_Batch = CreateObject(&quot;Excel.Application&quot;)
Set wb_Batch = xl_Batch.WorkBooks.Open(sBatchSheetPath)

'Loop through all the Rows
'1st row contains Execute button, 2nd row is header and the test case list starts from 3rd row. So, For loop is started from 3rd row
For iR = 3 to 1000

 'Get the value from the Execute column
 If xl_Batch.Cells(iR, 1).Value = &quot;Yes&quot; Then

 'Get Test Case Name
 sTestCaseName = xl_Batch.Cells(iR, 2).Value

 'Get the location where the test case is stored
 strScriptPath = sTestCaseFolder &amp; sTestCaseName

 'Open the Test Case in Read-Only mode
 qtpApp.Open strScriptPath, True
 WScript.Sleep 2000

 'Create an object of type QTP Test
 Set qtpTest = qtpApp.Test

 'Instruct QTP to perform next step when error occurs
 qtpTest.Settings.Run.OnError = &quot;NextStep&quot;

 'Create the Run Results Options object
 Set qtpResult = CreateObject(&quot;QuickTest.RunResultsOptions&quot;)

 'Set the results location. This result refers to the QTP result
 sQTPResultsPath = sQTPResultsPathOrig
 sQTPResultsPath = sQTPResultsPath &amp; sTestCaseName
 qtpResult.ResultsLocation = sQTPResultsPath

 'Run the test. The result will automatically be stored in the location set by you
 WScript.Sleep 2000
 qtpTest.Run qtpResult

 ElseIf xl_Batch.Cells(iR, 1).Value = &quot;No&quot; Then
 'Do nothing. You don't have to execute the test cases marked as No

 ElseIf xl_Batch.Cells(iR, 1).Value = &quot;&quot; Then
 'Blank value means that the list of test cases has finished
 'So you can exit the for loop
 Exit For

 End If

Next
</pre>
<p><span><br />
</span><br />
<strong>3)</strong> Save this text file as <strong>DriverScript.vbs</strong>. Make sure that the file is saved with .vbs extension only and not as DriverScript.vbs.txt. Also make sure that the path mentioned in the excel macro function (point #15 in the previous section) is the same place where you save this vbs file.<br />
<span><br />
</span><br />
<strong>4)</strong> Open the batch excel sheet. Make sure that the first test case is selected as &#8216;Yes&#8217;. And the remaining two test cases are marked as &#8216;No&#8217;. Also, go to Developer tab and check that the &#8216;Design Mode&#8217; option is unselected.<br />
<span><br />
</span><br />
<strong>5)</strong> Now, its time to verify if batch execution feature has been properly implemented or not. To do this, click on the Execute button. If everything is working fine, the driver script will load the first test case in QTP and will execute the test case.<br />
<span><br />
</span><br />
Now, you will have a hybrid framework that can execute a single test case in batch mode. Also, your hybrid framework has the features of modular and data driven frameworks implemented in it. <strong>So, at this stage, you can say that you have set up a hybrid framework with most of the important features in it. :&#8211;)</strong></p>
<p><span><br />
</span></p>
<h3>Final article on QTP Hybrid Framework</h3>
<p>The next article would be the final one on QTP hybrid framework series. That article would cover the remaining topics about implementing the reporting and auto-email features. Moreover, we will publish the entire framework code (with all the 3 test cases) in the next article.<br />
<span><br />
</span><br />
Till then, if you have any comments about this article, you can let us know about it using the comments section.</p>
<p><span><br />
</span></p>
<div style="font-family: Verdana,sans-serif; border: 1px solid #C8B560; padding: 3mm; background: #FFF8C6; text-align: center;">
<p><strong>If you enjoyed this article, you can join our blog to get new articles delivered directly in your inbox.</strong></p>
<form style="text-align: center;" action="http://feedburner.google.com/fb/a/mailverify" method="post" target="popupwindow" onsubmit="window.open('http://feedburner.google.com/fb/a/mailverify?uri=automationrepository/feeds', 'popupwindow', 'scrollbars=yes,width=550,height=520');return true"><input style="width: 160px; height: 20px;" type="text" value="Enter Your Email Address" onfocus="if (this.value == 'Enter Your Email Address') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Enter Your Email Address';}" /> <input type="hidden" name="uri" value="automationrepository/feeds" /> <input type="hidden" name="loc" value="en_US" /> <input type="submit" value="Join Us" /></p>
<p style="text-align: justify;">
</form>
</div>
<p style="border: 1px solid #C38EC7; padding: 3mm; background: #EBDDE2;"><strong>Visit <a title="QTP Frameworks – An Introduction" href="http://www.automationrepository.com/2012/03/qtp-framework-types-an-introduction/">QTP Frameworks</a> Main Page for more articles on QTP Frameworks</strong>. You can also visit our <a title="QTP Tutorials" href="http://www.automationrepository.com/tutorials-for-qtp-beginners/" target="_blank">QTP Tutorials</a> page for detailed QTP Tutorials.</p>
<p>The post <a rel="nofollow" href="https://www.automationrepository.com/wordpress/2013/08/designing-hybrid-framework-in-qtp-part-3/">Designing Hybrid Framework in QTP &#8211; Part 3</a> appeared first on <a rel="nofollow" href="https://www.automationrepository.com/wordpress">XX</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.automationrepository.com/wordpress/2013/08/designing-hybrid-framework-in-qtp-part-3/feed/</wfw:commentRss>
			<slash:comments>26</slash:comments>
		
		
			</item>
		<item>
		<title>Designing Hybrid Framework in QTP &#8211; Part 2</title>
		<link>https://www.automationrepository.com/wordpress/2013/08/designing-hybrid-framework-in-qtp-part-2/</link>
					<comments>https://www.automationrepository.com/wordpress/2013/08/designing-hybrid-framework-in-qtp-part-2/#comments</comments>
		
		<dc:creator><![CDATA[Anish Pillai]]></dc:creator>
		<pubDate>Sat, 03 Aug 2013 00:33:51 +0000</pubDate>
				<category><![CDATA[Advanced Concepts]]></category>
		<category><![CDATA[QTP Framework]]></category>
		<category><![CDATA[QTP Hybrid Framework]]></category>
		<guid isPermaLink="false">http://www.automationrepository.com/?p=2090</guid>

					<description><![CDATA[<p>Continued from previous article &#8211; Designing Hybrid Framework in QTP (Part 1). In this article, we will start looking at the process of creating a hybrid framework from scratch. This article would concentrate more on the coding aspects of the hybrid framework. We will start with a basic test script and then would build upon &#8230; <a href="https://www.automationrepository.com/wordpress/2013/08/designing-hybrid-framework-in-qtp-part-2/">Read more <span class="meta-nav">&#8594;</span></a></p>
<p>The post <a rel="nofollow" href="https://www.automationrepository.com/wordpress/2013/08/designing-hybrid-framework-in-qtp-part-2/">Designing Hybrid Framework in QTP &#8211; Part 2</a> appeared first on <a rel="nofollow" href="https://www.automationrepository.com/wordpress">XX</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Continued from previous article &#8211; <a title="Designing Hybrid Framework in QTP – Part 1" href="http://www.automationrepository.com/2013/07/designing-hybrid-framework-in-qtp-part-1/" target="_blank">Designing Hybrid Framework in QTP (Part 1)</a>. In this article, we will start looking at the process of creating a hybrid framework from scratch. This article would concentrate more on the coding aspects of the hybrid framework. We will start with a basic test script <span id="more-2090"></span>and then would build upon it by incorporating more features to it.</p>
<p><span><br />
</span></p>
<h3>Topics that will be covered in this article</h3>
<p>In this article, we will cover the following aspects of the hybrid framework &#8211;</p>
<p><strong>a)</strong> Identifying the test cases that will be automated as part of this framework</p>
<p><strong>b)</strong> The plan or approach as to how the framework will be created</p>
<p><strong>c)</strong> Folder structure and writing the first test case</p>
<p><strong>d)</strong> Applying the modular framework features in this hybrid framework</p>
<p><span><br />
</span></p>
<h3>Test Cases that will be automated</h3>
<p>As a part of this hybrid automation framework, we will automate the following test cases. The application that we will use would be mercury flight reservation system (windows version) and the version of QTP would be QTP 10. Even though we are using QTP 10, you would be able to execute the same test cases in the later versions without any issues.<br />
<span><br />
</span><br />
<strong>1) TC01_CreateOrder:</strong> The flow of this test case would be to login to the application, create an order and then logout<br />
<span><br />
</span><br />
<strong>2) TC02_CreateAndUpdateOrder:</strong> For this test case, the flow would be: login &gt;&gt; create order &gt;&gt; search order &gt;&gt; logout<br />
<span><br />
</span><br />
<strong>3) TC03_CreateAndDeleteOrder:</strong> Here, the flow of the test case would be like this: login &gt;&gt; create order &gt;&gt; search order &gt;&gt; delete order &gt;&gt; logout</p>
<p><span><br />
</span></p>
<h3>Basic approach to create the hybrid framework</h3>
<p>As mentioned earlier, the hybrid framework that you will create here will consist of a lot of components and features that will be interlinked with each other. So, in order to create the framework from scratch, you will need to have a plan or an approach. You simply can&#8217;t go on doing random stuff and assume that the components and features would somehow get linked together at the end.<br />
<span><br />
</span><br />
The most basic approach (and also the safest one) is to start with a small and easy chunk. This small chunk should be something that can be executed, for example a test case. You should then execute this test case and make sure that it works fine. After this is done, you should then start adding other components and features around it. After the addition of each component, you should execute your code to make sure that things work fine.<br />
<span><br />
</span><br />
By following this approach you would be able to add all the components together to come up with your hybrid framework. And since you added all these components over a single test case only, you will have a basic framework with you, which has only 1 test case in it. Also, it&#8217;s not necessary that you have to add all the components/features onto a single test case. The thumb rule is to create one test case and add the important components and features to it. So, once this basic framework is ready (with the important components), you can start adding other test cases to your framework.<br />
<span><br />
</span><br />
What you saw above was the generic approach that you can follow to create a framework from scratch. Now you would see the exact steps or approach that we will follow here to create our hybrid framework.</p>
<p style="text-align: center;"><img loading="lazy" decoding="async" class="aligncenter" title="Approach to create Hybrid Framework in QTP" alt="Approach to create Hybrid Framework in QTP" src="https://www.automationrepository.com/wordpress/wp-content/uploads/ar/approach-to-create-hybrid-framework.png" width="401" height="441" /></p>
<p><em> </em><br />
<strong>1) </strong>The first step would be to define a generic folder structure that you would use for your framework. Please note that its not necessary that whatever folder structure you create in the beginning is 100% correct. This is because there might be some scenarios that might have skipped your mind in the beginning. And to accommodate that scenario you might need to alter the folder structure a bit. But most of the times, 80-90% of your folder structure would remain the same way as you had thought of it initially.<br />
<span><br />
</span><br />
<strong>2) </strong>The next step that you would need to follow is to write the first test case. This should be a plain and simple test case, like the way its written in <a title="QTP Linear Framework – Complete Reference with Example" href="http://www.automationrepository.com/2012/04/qtp-framework-tutorial-qtp-linear-framework/" target="_blank">QTP linear framework</a>.<br />
<span><br />
</span><br />
<span style="text-decoration: underline;"><strong>Note:</strong></span> Many a times, people start with the second step first. That is, they first write the test case and think about the folder structure at some later stage. This approach also works fine. But we suggest you work on folder structure first because when you start thinking about the folder structure in the beginning, you sort of think about how your overall framework would look like. And thinking about that sort of details since the initial stages sometimes help you avoid costly (in terms of time and effort) reworks.<br />
<span><br />
</span><br />
<strong>3)</strong> After you verify that your test case (written in linear manner) works fine, the next step would be to analyze the code and identify reusable functions. At this step, you would need to introduce the function library and move the reusable functions into it.<br />
<span><br />
</span><br />
<strong>4)</strong> Next step would be to remove all the hard-coded data from the test case and put it in an excel sheet. You should then write the code to fetch your data from the excel sheets.<br />
<span><br />
</span><br />
<strong>5)</strong> At this step, you would need to create a batch excel sheet and add a macro or driver script to it. This macro when executed would run your test case (that is added in the batch excel sheet).<br />
<span><br />
</span><br />
<strong>6)</strong> Now you would need to work on the test results part. You would have to modify your code so that you can store your test results in two different ways &#8211; both as summarized results as well as detailed results. You would also need to add a time-stamp mechanism to your result files so that it doesn&#8217;t get overwritten.<br />
<span><br />
</span><br />
<strong>7)</strong> The next step would be to add the auto-email functionality to your framework. At this point, you would have your basic hybrid framework ready that has most of the important features added in.<br />
<span><br />
</span><br />
<strong>8)</strong> Now, the next step would be to add the remaining test cases in your framework. At this stage, it would not be required to first write the test cases in linear fashion. Since most of the common functions are already in place, you can directly start using those functions when you write the test scripts.<br />
<span><br />
</span><br />
<strong>9)</strong> The ninth and final step would be to modify some of the code as deemed necessary. This step is important because the initial framework that you created worked well on 1 test case. But when you try to add multiple test cases, you might need to make some additional changes in your code so that all the test cases can run one after the other without any issues.<br />
<span><br />
</span><br />
<strong> At this stage, you will have your full fledged hybrid framework up and running.</strong> With this, let us now start with our first step.</p>
<p><span><br />
</span></p>
<h3>Folder structure</h3>
<p>The folder structure that would be used for this hybrid framework is given below.</p>
<p style="text-align: center;"><span style="color: #ff0000;"><strong><img loading="lazy" decoding="async" class="aligncenter" title="Hybrid Framework in QTP - Folder Structure" alt="Hybrid Framework in QTP - Folder Structure" src="https://www.automationrepository.com/wordpress/wp-content/uploads/ar/qtp-hybrid-framework-folder-structure.png" width="244" height="309" /></strong></span></p>
<p>Most of the stuff in the folder structure is self explanatory. Let&#8217;s quickly go through each one of them.</p>
<p><strong>a) </strong>QTP-Hyrbid-Framework folder: This is the parent folder. All the framework code and other artifacts will be stored inside this folder.</p>
<p><strong>b)</strong> Batch folder: This is the folder that takes care of the batch execution. The batch excel sheet (which will have the list of all the test cases) and the excel macro will be stored in this folder.</p>
<p><strong>c)</strong> DataSheet folder: All your excel data sheets will be stored in this folder.</p>
<p><strong>d)</strong> Resources folder: This is just a top-level folder that has many sub-folders inside it.</p>
<p><strong>e)</strong> AppSpecific_FunctionLibrary, Generic_FunctionLibrary and Object Repository: These folders will be used to store function libraries and object repositories.</p>
<p><strong>f)</strong> ConfigurationFiles folder: This folder will contain the items that would be used to configure the overall framework settings. For example, the settings such as whether to send email or not, or what should be the default wait time etc will be stored in this folder.</p>
<p><strong>g)</strong> GenericFiles folder: This folder will be used to store the generic files. For example, if your test cases upload or download some files to/from the application, then those files will be stored in this folder.</p>
<p><strong>h)</strong> Results folder: Results folder contains many sub-folders that will be used to store the test results and the error screenshots.</p>
<p><strong>i)</strong> TestCases folder: This is the folder where all your QTP test cases will be stored.</p>
<p><span><br />
</span></p>
<h3>Writing the first test script</h3>
<p>You have already defined the folder structure and now its time to write your first test script. You would be writing this test script in linear fashion, that is, in the way its done in case of <a title="QTP Linear Framework – Complete Reference with Example" href="http://www.automationrepository.com/2012/04/qtp-framework-tutorial-qtp-linear-framework/" target="_blank">QTP linear framework</a>. This means that all the code will be in a linear, sequential manner. Also at this stage, you would not create any reusable functions. All your test data will also be hard-coded with the test script itself.<br />
<span><br />
</span><br />
While writing the test script, please make sure that you don&#8217;t record the script. Use object repository to first add the objects and then write the code in the QTP test case. The test case that you would create first is <strong>TC01_CreateOrder</strong>. The flow of the test case would be like this &#8211;</p>
<p><img loading="lazy" decoding="async" class="aligncenter" alt="QTP Hybrid Framework - Create Order Test Case Flow" src="https://www.automationrepository.com/wordpress/wp-content/uploads/ar/hybrid-framework-test-case-flow.png" width="445" height="320" /></p>
<p><em> </em><br />
Once your test case is created, store it in the &#8220;<strong>TestCases</strong>&#8221; folder. Also save the object repository in its corresponding location. Below we have given the complete code for create order. The code that you create would look somewhat similar to this.<br />
<em> </em></p>
<pre class="brush: vb; title: ; notranslate">
'Open the flight reservation application
SystemUtil.Run &quot;C:\Program Files\HP\QuickTest Professional\samples\flight\app\flight4a.exe&quot;

'Login to the application
Dialog(&quot;Login&quot;).WinEdit(&quot;AgentName&quot;).Set &quot;anish&quot;
Dialog(&quot;Login&quot;).WinEdit(&quot;Password&quot;).Set &quot;mercury&quot;
Dialog(&quot;Login&quot;).WinButton(&quot;OK&quot;).Click

'Verify that login is successful
If (Window(&quot;FlightReservation&quot;).Exist(10)) Then
	Reporter.ReportEvent micPass, &quot;Login Successful&quot;, &quot;Login Successful&quot;
Else
	Reporter.ReportEvent micFail, &quot;Login Unsuccessful&quot;, &quot;Login Unsuccessful&quot;
End If

'Create a new order - i.e. book a flight ticket
Window(&quot;FlightReservation&quot;).ActiveX(&quot;DateOfFlight&quot;).Type &quot;010135&quot;
Window(&quot;FlightReservation&quot;).WinComboBox(&quot;FlyFrom&quot;).Select &quot;Denver&quot;
Window(&quot;FlightReservation&quot;).WinComboBox(&quot;FlyTo&quot;).Select &quot;Frankfurt&quot;
Window(&quot;FlightReservation&quot;).WinButton(&quot;Flights...&quot;).Click

'Select the first flight in the list and click OK
Window(&quot;FlightReservation&quot;).Dialog(&quot;FlightsTable&quot;).WinButton(&quot;OK&quot;).Click

'Provide name, class and Insert the order (using descriptive programming approach)
Window(&quot;FlightReservation&quot;).WinEdit(&quot;attached text:=Name:&quot;,&quot;nativeclass:=Edit&quot;).Set &quot;anish&quot;
Window(&quot;FlightReservation&quot;).WinRadioButton(&quot;text:=First&quot;).Click
Window(&quot;FlightReservation&quot;).WinButton(&quot;text:=&amp;Insert Order&quot;).Click
wait(8)

'Verify if order is created
strOrderNumber = Window(&quot;FlightReservation&quot;).WinEdit(&quot;attached text:=Order No:&quot;).GetROProperty(&quot;text&quot;)
If (strOrderNumber &lt;&gt; &quot;&quot;) Then
	Reporter.ReportEvent micPass, &quot;Flight booked successfully&quot;, &quot;Order number - &quot; &amp; strOrderNumber
Else
	Reporter.ReportEvent micFail, &quot;Flight not booked&quot;, &quot;Flight not booked&quot;
End If

'Close the application
Window(&quot;FlightReservation&quot;).Close
</pre>
<p><em> </em><br />
Before you move over to the next stage, you have to make sure that whatever you have done till now works fine. So, run the test script that you have created and verify that it executes completely without any issues.<br />
<span><br />
</span><br />
<span style="text-decoration: underline;"><strong>Important note:</strong></span> Please note that, as part of this framework creation process, the basic steps such as adding objects to the object repository, associating function library to the scripts etc would not be explained. We are assuming that you have gone through all the previous articles on the other QTP frameworks and hence you have a good understanding on how these basic things are done. Even if you have directly started with this article, we will assume that you have a basic understanding on how different QTP frameworks work.</p>
<p><span><br />
</span></p>
<h3>Function Library &#8211; Adding application independent functions</h3>
<p>In the previous article on QTP hybrid framework, we had mentioned that a hybrid framework is created by taking out features from other framework types and implementing them in your framework. This is exactly what you would do next. You would select the features from the other framework types and add them to your framework one by one.<br />
<span><br />
</span><br />
The first feature that you would include in your framework is to add reusable functions, and that too the application independent functions. Now, the first question that you would come to your mind is &#8211; what are application dependent functions? Well, as the name suggests, an application independent function is a reusable function that doesn&#8217;t depend on your application.<br />
<span><br />
</span><br />
Take QTP click operation as an example. In the above code, you can see that the click operation is used at many places to click on different types of buttons. Now, this click function is not bound to the flight reservation application in any way. So if you replace the flight reservation application with some other application, like the windows calculator, the click button will still function in the same way. As long as you pass the correct object, the click operation will click on the button, be it in the flight reservation application or in the windows calculator.<br />
<span><br />
</span><br />
So, similar to the click operation, there are various other operations like set, type, select etc that do not depend on your application under test. So the first thing that you would do it to replace these QTP operations with your own custom functions. The whole idea here is to replace all (or most of) the QTP operations with your own custom functions.</p>
<p><span><br />
</span></p>
<h3>Why application independent functions are important?</h3>
<p>Well, this is another important question that might have come into your minds. When QTP already provides its own functions like click, set, type etc then why do we need to replace them with our custom functions. Well, there are a few reasons as to why we do so &#8211;<br />
<span><br />
</span><br />
<strong>1)</strong> By creating your own functions, you can extend the capability of the operation by adding more features to it. For example, you can write a function called fnButtonClick() where you can first verify if the button exists. Then you add the code to actually click on the button. And finally you can add your custom message which tells that the button has been clicked. In this way, you are extending the normal click operation by adding more operations to it.<br />
<span><br />
</span><br />
<strong>2)</strong> Another important thing that you can accomplish is custom error handling. If the button that you try to click is not found, QTP will handle the error in the way that you specified. This way, you will have more control on how your framework behaves in error scenarios.<br />
<span><br />
</span><br />
<strong>3)</strong> You can provide more meaningful names to your custom functions. For example, rather than using an operation called set, you can create your own function that you can name as setValueInTextField(). These sort of function names make more sense than some QTP defined operation names.<br />
<span><br />
</span><br />
<strong>4)</strong> These custom functions can be used to achieve method overriding. Refer the article on <a title="How to achieve Method Overriding &amp; Reuse using RegisterUserFunc in QTP" href="http://www.automationrepository.com/2011/12/how-to-achieve-method-overriding-and-reuse-using-registeruserfunc-in-qtp/" target="_blank"><strong>method overriding using RegisterUserFunc</strong></a> for more information about this concept.</p>
<p>Let us now see how to replace the QTP operations with your custom functions.</p>
<p><span><br />
</span></p>
<h3>Replacing QTP operations with application independent functions</h3>
<p>Follow the steps given below to replace the QTP operations with your own custom functions.</p>
<p><strong>1) </strong>Create a new function library and save it in the<strong> Generic_FunctionLibrary</strong> folder.</p>
<p><strong>2) </strong>Associate the function library with the test script.</p>
<p><strong>3)</strong> To replace the set operation with your custom function, add the following code in the function library.</p>
<pre class="brush: vb; title: ; notranslate">
'Registering the user defined functions
'================================
'
RegisterUserFunc &quot;WinEdit&quot;, &quot;fnSetValueInTextField&quot;, &quot;fnSetValue&quot;
'
'
'
'================================
'Function name - fnSetValue
'Description - Set value in a text field
'================================
Function fnSetValue(objControl, strValue)

On Error Resume Next

'Set the value
objControl.Set strValue

'Report out the result
If Err.Number = 0 Then
Reporter.ReportEvent micPass, &quot;Value - '&quot; &amp; strValue &amp; &quot;' entered in Field - '&quot; &amp; objControl.ToString() &amp; &quot;'&quot;, &quot;Passed&quot;
End If

End Function
'================================
</pre>
<p><em> </em><br />
<strong>4)</strong> Come back to the test script and replace the operation set with the custom function name. Please note that if each of the above steps is done correctly, the custom function will be displayed as an option in the intellisense menu.</p>
<pre class="brush: vb; title: ; notranslate">
Dialog(&quot;Login&quot;).WinEdit(&quot;AgentName&quot;).fnSetValueInTextField &quot;anish&quot;
</pre>
<p><em> </em><br />
<img loading="lazy" decoding="async" class="aligncenter" alt="QTP Hybrid Framework - custom function displayed in intellisense menu" src="https://www.automationrepository.com/wordpress/wp-content/uploads/ar/intellisense-menu-displays-user-defined-function.png" width="469" height="322" /><br />
<em> </em></p>
<p><strong>5)</strong> Run the code to see that the test script works perfectly fine with the custom function.</p>
<p><strong>6)</strong> Replace all the set operations with the same custom function name.</p>
<p><strong>7)</strong> Write custom functions for all other operations and add them in your test script.</p>
<p><strong>8)</strong> Once this is done, all the QTP operations in the test script will be replaced by your own custom functions. The test script code should look something like this.</p>
<pre class="brush: vb; title: ; notranslate">
'Open the flight reservation application
SystemUtil.Run &quot;C:\Program Files\HP\QuickTest Professional\samples\flight\app\flight4a.exe&quot;

'Login to the application
Dialog(&quot;Login&quot;).WinEdit(&quot;AgentName&quot;).fnSetValueInTextField &quot;anish&quot;
Dialog(&quot;Login&quot;).WinEdit(&quot;Password&quot;).fnSetValueInTextField &quot;mercury&quot;
Dialog(&quot;Login&quot;).WinButton(&quot;OK&quot;).fnWinButtonClick

'Verify that login is successful
If (Window(&quot;FlightReservation&quot;).Exist(10)) Then
Reporter.ReportEvent micPass, &quot;Login Successful&quot;, &quot;Login Successful&quot;
Else
Reporter.ReportEvent micFail, &quot;Login Unsuccessful&quot;, &quot;Login Unsuccessful&quot;
End If

'Create a new order - i.e. book a flight ticket
Window(&quot;FlightReservation&quot;).ActiveX(&quot;DateOfFlight&quot;).fnTypeValueInActiveXField &quot;010135&quot;
Window(&quot;FlightReservation&quot;).WinComboBox(&quot;FlyFrom&quot;).fnSelectDropDownValue &quot;Denver&quot;
Window(&quot;FlightReservation&quot;).WinComboBox(&quot;FlyTo&quot;).fnSelectDropDownValue &quot;Frankfurt&quot;
Window(&quot;FlightReservation&quot;).WinButton(&quot;Flights...&quot;).fnWinButtonClick

'Select the first flight in the list and click OK
Window(&quot;FlightReservation&quot;).Dialog(&quot;FlightsTable&quot;).WinButton(&quot;OK&quot;).fnWinButtonClick

'Provide name, class and insert the order (using descriptive programming approach)
Window(&quot;FlightReservation&quot;).WinEdit(&quot;attached text:=Name:&quot;,&quot;nativeclass:=Edit&quot;).fnSetValueInTextField &quot;anish&quot;
Window(&quot;FlightReservation&quot;).WinRadioButton(&quot;text:=First&quot;).fnRadioButtonClick
Window(&quot;FlightReservation&quot;).WinButton(&quot;text:=&amp;Insert Order&quot;).fnWinButtonClick
wait(8)

'Verify if order is created
strOrderNumber = Window(&quot;FlightReservation&quot;).WinEdit(&quot;attached text:=Order No:&quot;).GetROProperty(&quot;text&quot;)
If (strOrderNumber &lt;&gt; &quot;&quot;) Then
Reporter.ReportEvent micPass, &quot;Flight booked successfully&quot;, &quot;Order number - &quot; &amp; strOrderNumber
Else
Reporter.ReportEvent micFail, &quot;Flight not booked&quot;, &quot;Flight not booked&quot;
End If

'Close the application
Window(&quot;FlightReservation&quot;).fnWindowClose
</pre>
<p><em> </em><br />
<strong>9)</strong> After all the QTP operations are replaced with custom functions, run your test script once again to make sure that everything is OK.</p>
<p><span><br />
</span></p>
<h3>Looking at the test results</h3>
<p>At this stage, you have replaced all the QTP operations with your own custom functions. Also, the reporting steps have been added inside the custom functions. So let us now have a look at how the test results would look when you run your customized code.<br />
<span><br />
</span><br />
The below image compares the test results before and after you have implemented your custom functions. Here, you can note that the readability of the test results has increased a lot after the addition of custom functions. Now you should be able to quickly glance at the results and get an idea about what is happening with the script.</p>
<p><img loading="lazy" decoding="async" class="aligncenter" alt="QTP Hybrid Framework - customized test run results" src="https://www.automationrepository.com/wordpress/wp-content/uploads/ar/customized-test-run-results.png" width="591" height="378" /></p>
<p><em> </em><br />
One issue with the customized result shown above is that even when you customize the result, its look and feel remains the same. You can try to tweak the CSS a bit, but there is not much that you can do there. Another solution would be to extend this logic by writing the results in an HTML file. You can further add style sheets and CSS to make your result HTML files look more beautiful. You can also add your company logo to get more professionally looking test results. That&#8217;s the level of control you get when you use custom functions. And that&#8217;s one of the main reasons why the custom functions are important.</p>
<p><span><br />
</span></p>
<h3>Function Library &#8211; Adding application specific functions</h3>
<p>This section is fairly straightforward and is something that you would have done a lot in QTP modular frameworks. The objective of this section is to analyze your code and see if you can identify some reusable components. Once you have done so, you should then replace the linear code with these reusable functions.<br />
<span><br />
</span><br />
By looking at our code, you can easily figure out that the entire test case can be divided into 3 reusable functions. These are &#8211; <strong>a) </strong>open application and login, <strong>b) </strong>create order, and <strong>c)</strong> close application. Create these 3 reusable functions and add them in a separate function library. Since these functions are application specific functions, so you have to save this function library in <strong>AppSpecific_FunctionLibray</strong> folder. Finally, don&#8217;t forget to associate this function library to your test case.<br />
<span><br />
</span><br />
After you have replaced your code with the reusable functions, your test script would look something like this.</p>
<pre class="brush: vb; title: ; notranslate">
fnLogin()
fnCreateOrder()
fnCloseApplication()
</pre>
<p>Execute the test case to make sure that the addition of these features didn&#8217;t result in any issues. Now you have a hybrid framework in which you have incorporated the features of QTP modular framework.<br />
<span><br />
</span><br />
It is now time to stop this article at this point. This post is already very lengthy, adding more content to it will only complicate the matters. So we will stop it here and take up the other components in the next article. The next article will focus on adding data sheets to the framework. Also, we will have a close look at how you can add the batch execution capability to your framework.<br />
<span><br />
</span><br />
<strong>This was all from our end and its time to know what you think about it. Use the comments section and pour in your thoughts on this article.</strong></p>
<p><span><br />
</span></p>
<div style="font-family: Verdana,sans-serif; border: 1px solid #C8B560; padding: 3mm; background: #FFF8C6; text-align: center;">
<p><strong>If you enjoyed this article, you can join our blog to get new articles delivered directly in your inbox.</strong></p>
<form style="text-align: center;" action="http://feedburner.google.com/fb/a/mailverify" method="post" target="popupwindow" onsubmit="window.open('http://feedburner.google.com/fb/a/mailverify?uri=automationrepository/feeds', 'popupwindow', 'scrollbars=yes,width=550,height=520');return true"><input style="width: 160px; height: 20px;" type="text" value="Enter Your Email Address" onfocus="if (this.value == 'Enter Your Email Address') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Enter Your Email Address';}" /> <input type="hidden" name="uri" value="automationrepository/feeds" /> <input type="hidden" name="loc" value="en_US" /> <input type="submit" value="Join Us" /></p>
<p style="text-align: justify;">
</form>
</div>
<p style="border: 1px solid #C38EC7; padding: 3mm; background: #EBDDE2;"><strong>Visit <a title="QTP Frameworks – An Introduction" href="http://www.automationrepository.com/2012/03/qtp-framework-types-an-introduction/">QTP Frameworks</a> Main Page for more articles on QTP Frameworks</strong>. You can also visit our <a title="QTP Tutorials" href="http://www.automationrepository.com/tutorials-for-qtp-beginners/" target="_blank">QTP Tutorials</a> page for detailed QTP Tutorials.</p>
<p>The post <a rel="nofollow" href="https://www.automationrepository.com/wordpress/2013/08/designing-hybrid-framework-in-qtp-part-2/">Designing Hybrid Framework in QTP &#8211; Part 2</a> appeared first on <a rel="nofollow" href="https://www.automationrepository.com/wordpress">XX</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.automationrepository.com/wordpress/2013/08/designing-hybrid-framework-in-qtp-part-2/feed/</wfw:commentRss>
			<slash:comments>19</slash:comments>
		
		
			</item>
		<item>
		<title>Designing Hybrid Framework in QTP &#8211; Part 1</title>
		<link>https://www.automationrepository.com/wordpress/2013/07/designing-hybrid-framework-in-qtp-part-1/</link>
					<comments>https://www.automationrepository.com/wordpress/2013/07/designing-hybrid-framework-in-qtp-part-1/#comments</comments>
		
		<dc:creator><![CDATA[Anish Pillai]]></dc:creator>
		<pubDate>Tue, 23 Jul 2013 18:58:56 +0000</pubDate>
				<category><![CDATA[QTP Framework]]></category>
		<category><![CDATA[QTP Hybrid Framework]]></category>
		<guid isPermaLink="false">http://www.automationrepository.com/?p=2026</guid>

					<description><![CDATA[<p>In the previous article on QTP Hybrid Framework, you saw the hybrid framework from a generic point of view. That article highlighted the very basic information about hybrid frameworks, such as &#8211; what a hybrid framework is, its structure and some important features that are common across multiple hybrid frameworks. Starting with this article, we &#8230; <a href="https://www.automationrepository.com/wordpress/2013/07/designing-hybrid-framework-in-qtp-part-1/">Read more <span class="meta-nav">&#8594;</span></a></p>
<p>The post <a rel="nofollow" href="https://www.automationrepository.com/wordpress/2013/07/designing-hybrid-framework-in-qtp-part-1/">Designing Hybrid Framework in QTP &#8211; Part 1</a> appeared first on <a rel="nofollow" href="https://www.automationrepository.com/wordpress">XX</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>In the previous article on <a title="Hybrid Framework in QTP – The Basics" href="http://www.automationrepository.com/2013/07/qtp-hybrid-framework-the-basics/" target="_blank">QTP Hybrid Framework</a>, you saw the hybrid framework from a generic point of view. That article highlighted the very basic information about hybrid frameworks, such as &#8211; what a hybrid framework is, its structure and some important features that are common across multiple hybrid frameworks.<span id="more-2026"></span></p>
<p>Starting with this article, we will explain the step by step process that will guide you to create your own hybrid framework from scratch. The framework will incorporate some of the features that we had mentioned in the previous article. This step by step process will be detailed and will span across 2 to 3 articles. Let&#8217;s start with whats in store for this article.</p>
<p><span><br />
</span></p>
<h3>Topics that will be covered in this article</h3>
<p>In this article, we will cover the following topics on Hybrid Framework &#8211;</p>
<ul>
<li><strong>1)</strong> <span style="text-decoration: underline;"><strong>Components</strong></span> that would be used to create this framework</li>
<li><strong>2)</strong> <span style="text-decoration: underline;"><strong>Features</strong></span> that would be a part of this hybrid framework</li>
<li><strong>3)</strong> The <span style="text-decoration: underline;"><strong>flow diagram</strong></span> of the hybrid framework</li>
</ul>
<p>All the above topics would serve as the basic building blocks that would help you understand and relate to the bigger picture with ease.</p>
<p><span><br />
</span></p>
<h3>Components used to create this framework</h3>
<p>Below is the list of all the components that will be used to create the hybrid framework. A short description accompanies each component.</p>
<p style="text-align: center;"><img loading="lazy" decoding="async" class="aligncenter" title="Hybrid Framework in QTP - Framework Components" src="https://www.automationrepository.com/wordpress/wp-content/uploads/ar/hybrid-framework-in-qtp-components.png" alt="Hybrid Framework in QTP - Framework Components" width="415" height="446" /></p>
<p><em> </em><br />
<strong>1) VB Excel Macro:</strong> The VB excel macro will act as the starting point for running the test scripts. How it would work is like this &#8211; There will be an excel sheet which will contain the list of all the test cases. There will also be an &#8216;execute&#8217; button in the excel sheet.</p>
<p>If you want to run the test scripts, you will need to click on the &#8216;execute&#8217; button. This execute button will have a macro attached to it. So when you click on the button, the macro will open QTP and load the first test case to it. It will then instruct QTP to execute the test script.</p>
<p>The same procedure will be followed for all the test cases that are available in the excel sheet. The excel macro will use QTP AOM (automation object model) concepts to interact with QTP.</p>
<p><em> </em><br />
<strong>2) Excel Sheets:</strong> Excel sheets will be used extensively by the hybrid framework that we would create. Excel sheets will be primarily used to store the following information &#8211;</p>
<ul>
<li><strong>a) Test Case List:</strong> As mentioned above in point 1, a list of all the test scripts will be maintained in excel sheet. This will be used for batch execution.</li>
<li><strong>b) Test Data:</strong> All the test data would come from excel sheets. No test data will be hard-coded anywhere in the test scripts.</li>
<li><strong>c) Test Results:</strong> Excel sheets will be used to provide a summarized result of batch execution. Here, the excel sheet will simply contain the list of test cases that were executed together with the information about whether the test scripts passed or failed.</li>
</ul>
<p><em> </em><br />
<strong>3) Test Scripts:</strong> These are the actual QTP test scripts. For each scenario that you would automate, you would need to create a separate QTP test script.</p>
<p><em> </em><br />
<strong>4) Function Library:</strong> This hybrid automation framework will use two separate function libraries. The first function library will store all the generic functions (application independent functions). Some examples for this can be functions to click on a link, to enter value in a text field etc.</p>
<p>The second function library will contain application specific functions. Functions such as login, logout etc will be a part of this second function library.</p>
<p><em> </em><br />
<strong>5) Object Repository:</strong> All the object definitions will be stored in the object repository. There will be minimal use of <a title="Descriptive Programming in QTP – The Complete Guide : Part1" href="http://www.automationrepository.com/2012/03/descriptive-programming-in-qtp-the-complete-guide-part1/" target="_blank">descriptive programming concepts</a>. Having said that, we will try to incorporate descriptive programming at some places so that you can get a feel of how you can use both object repository and descriptive programming together in the same place.</p>
<p><span><br />
</span></p>
<h3>Salient features of the hybrid framework</h3>
<p>Following are some of the important features that you will see in this hybrid framework.</p>
<p><strong>1)</strong> This framework will be <strong>optimized for batch execution</strong>. This is what most good frameworks are all about. With this framework, you will be able to easily select the test cases that you want to execute in batch run.</p>
<p><em> </em><br />
<strong>2)</strong> To execute your test scripts, you would not be required to open QTP. This would be taken care of entirely by the driver script (excel macro).</p>
<p><em> </em><br />
<strong>3)</strong> As mentioned in the previous article, this framework will provide the test execution results at two different levels &#8211; summarized results and detailed results.</p>
<p><em> </em><br />
<strong>4)</strong> The test execution results from multiple runs <strong>would not be overwritten</strong>. Each test execution result will be appended by date-time stamp so that it can be referenced whenever required.</p>
<p><em> </em><br />
<strong>5)</strong> The hybrid framework will have the provision to <strong>automatically send emails</strong> (with the test results) after completion of a batch run.</p>
<p><em> </em><br />
<strong>6)</strong> The framework will contain an <strong>external configuration sheet</strong> which will help you to configure many of the features of the framework without having to touch any of the code.</p>
<p><span><br />
</span></p>
<h3>Flow diagram of the framework</h3>
<p>The below image describes the flow diagram for test script execution in the hybrid framework that we will create.</p>
<p style="text-align: center;"><img loading="lazy" decoding="async" class="aligncenter" title="Hybrid Framework in QTP - Flow Diagram" src="https://www.automationrepository.com/wordpress/wp-content/uploads/ar/hybrid-framework-flow-diagram.png" alt="Hybrid Framework in QTP - Flow Diagram" width="473" height="509" /></p>
<p><em> </em><br />
<strong>1)</strong> Execution of the test scripts start from the VB excel macro. Once you click on execute button in the excel sheet, the macro iterates through the excel sheet to find out the test case that needs to be executed.</p>
<p><em> </em><br />
<strong>2)</strong> Once the macro finds the test case, it loads the test case into QTP and &#8220;asks&#8221; QTP to execute that test case.</p>
<p><em> </em><br />
<strong>3)</strong> QTP (with the help of function libraries, object repository and data sheets) executes the test case.</p>
<p><em> </em><br />
<strong>4)</strong> After the test case is executed, QTP sends the control back to the driver script. Driver script then loads the next test case into QTP.</p>
<p><em> </em><br />
<strong>5)</strong> Once all the intended test cases have been executed, driver script creates the test results and stores it into its corresponding folders.</p>
<p><em> </em><br />
<strong>6)</strong> The driver script then sends an email to all the intended recipients.</p>
<p><span><br />
</span><br />
This was all about the features, components and flow diagram of the hybrid framework that we will create. The next article will focus on the most important part of the process &#8211;<strong> the actual creation of the framework. </strong>That&#8217;s all from our side. Do let us know your thoughts on this using the comments section.<strong><br />
</strong></p>
<p><span><br />
</span></p>
<div style="font-family: Verdana,sans-serif; border: 1px solid #C8B560; padding: 3mm; background: #FFF8C6; text-align: center;">
<p><strong>If you enjoyed this article, you can join our blog to get new articles delivered directly in your inbox.</strong></p>
<form style="text-align: center;" action="http://feedburner.google.com/fb/a/mailverify" method="post" onsubmit="window.open('http://feedburner.google.com/fb/a/mailverify?uri=automationrepository/feeds', 'popupwindow', 'scrollbars=yes,width=550,height=520');return true" target="popupwindow"><input style="width: 160px; height: 20px;" onfocus="if (this.value == 'Enter Your Email Address') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Enter Your Email Address';}" type="text" value="Enter Your Email Address" /> <input type="hidden" name="uri" value="automationrepository/feeds" /> <input type="hidden" name="loc" value="en_US" /> <input type="submit" value="Join Us" /></p>
<p style="text-align: justify;">
</form>
</div>
<p style="border: 1px solid #C38EC7; padding: 3mm; background: #EBDDE2;"><strong>Visit <a title="QTP Frameworks – An Introduction" href="http://www.automationrepository.com/2012/03/qtp-framework-types-an-introduction/">QTP Frameworks</a> Main Page for more articles on QTP Frameworks</strong>. You can also visit our <a title="QTP Tutorials" href="http://www.automationrepository.com/tutorials-for-qtp-beginners/" target="_blank">QTP Tutorials</a> page for detailed QTP Tutorials.</p>
<p>The post <a rel="nofollow" href="https://www.automationrepository.com/wordpress/2013/07/designing-hybrid-framework-in-qtp-part-1/">Designing Hybrid Framework in QTP &#8211; Part 1</a> appeared first on <a rel="nofollow" href="https://www.automationrepository.com/wordpress">XX</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.automationrepository.com/wordpress/2013/07/designing-hybrid-framework-in-qtp-part-1/feed/</wfw:commentRss>
			<slash:comments>18</slash:comments>
		
		
			</item>
		<item>
		<title>Hybrid Framework in QTP &#8211; The Basics</title>
		<link>https://www.automationrepository.com/wordpress/2013/07/qtp-hybrid-framework-the-basics/</link>
					<comments>https://www.automationrepository.com/wordpress/2013/07/qtp-hybrid-framework-the-basics/#comments</comments>
		
		<dc:creator><![CDATA[Anish Pillai]]></dc:creator>
		<pubDate>Sun, 21 Jul 2013 00:38:16 +0000</pubDate>
				<category><![CDATA[QTP Framework]]></category>
		<category><![CDATA[QTP Hybrid Framework]]></category>
		<guid isPermaLink="false">http://www.automationrepository.com/?p=2003</guid>

					<description><![CDATA[<p>From all the QTP Framework articles that we have posted on this blog till now, this series of articles (about the hybrid framework) is be the most important one. The sole reason for this is &#8211; &#8220;Hybrid framework is the most commonly used framework in test automation projects.&#8221; So, if you learn this and get &#8230; <a href="https://www.automationrepository.com/wordpress/2013/07/qtp-hybrid-framework-the-basics/">Read more <span class="meta-nav">&#8594;</span></a></p>
<p>The post <a rel="nofollow" href="https://www.automationrepository.com/wordpress/2013/07/qtp-hybrid-framework-the-basics/">Hybrid Framework in QTP &#8211; The Basics</a> appeared first on <a rel="nofollow" href="https://www.automationrepository.com/wordpress">XX</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>From all the <a title="QTP Framework Tutorials – Framework Types, Examples &amp; Code Snippets" href="http://www.automationrepository.com/2012/03/qtp-framework-types-an-introduction/" target="_blank">QTP Framework</a> articles that we have posted on this blog till now, this series of articles (about the hybrid framework) is be the most important one. The sole reason for this is &#8211; <strong></strong></p>
<p><strong>&#8220;Hybrid framework is the most commonly used framework in test automation projects.&#8221;<span id="more-2003"></span></strong></p>
<p>So, if you learn this and get it right, then you would be in a position to work on automation projects in your organization. With this, let us now start with the basics of the QTP hybrid framework.</p>
<p><span><br />
</span></p>
<h3>What is Hybrid Framework in QTP?</h3>
<p>Each and every framework type in QTP has its own positives and negatives. You can take the positive points from each of these frameworks and create a customized framework that suites your requirements. This customized framework is called a hybrid framework.</p>
<p>So, in very simple terms &#8211;<strong> &#8220;A hybrid framework is a framework that is created by combining together the features of the different types of QTP frameworks.&#8221; </strong>This is depicted in the image shown below.<strong><br />
</strong></p>
<p><span><img loading="lazy" decoding="async" class="aligncenter" title="Hybrid Framework In QTP" src="https://www.automationrepository.com/wordpress/wp-content/uploads/ar/hybrid-framework-borrows-from-other-frameworks.png" alt="Hybrid Framework In QTP" width="497" height="363" /><br />
</span></p>
<h3>Is there any specific predefined structure of a Hybrid Framework?</h3>
<p>Well, a straightforward answer for this question would be &#8211; <strong>No</strong>. Let try to understand why it is this way? In the previous section, you had read about what a hybrid framework actually is. There are two key takeaway points in that explanation &#8211;</p>
<ul>
<li><strong>1)</strong> A hybrid framework is a <strong>collection of features</strong> from the other framework types.</li>
<li><strong>2)</strong> A hybrid framework is one that <strong>suites your requirements</strong>.</li>
</ul>
<p><em> </em><br />
Now, the second point mentioned above is very important. The hybrid framework that you create should suite your requirements or your stakeholder&#8217;s requirements. And there can be a lot of factors that influence your decisions. For example &#8211;</p>
<ul>
<li><strong>&#8211;</strong> you might want to use a particular feature in your hybrid framework but it might not be useful or necessary for the application you are testing. Example &#8211; you might want to use excel sheets to store test data. But in case your application takes the same data every time, it makes more sense to hard-code the data in your code itself or maybe taking it as environment variables</li>
<li><strong>&#8211;</strong> you might have a disliking for certain features and hence you always tend to use the features that you like. For example, I&#8217;m more biased towards functions and hence I tend to use them more than say, using action calls</li>
<li><strong>&#8211;</strong> your client may have a preference towards certain type of framework as they would have seen a similar sort of framework being used previously. So if you can convince the client, then its well and good, else you would have to stick around with what they have suggested (this is something that I have had to deal with in few of my automation projects)</li>
</ul>
<p><em> </em><br />
Taking all the above points into consideration, you can safely say that the features that you select to create your hybrid framework may vary vastly from someone else&#8217;s framework. And hence, there is no predefined structure of this type of framework. To sum it up, different hybrid frameworks should be like &#8211;</p>
<p><img loading="lazy" decoding="async" class="aligncenter" title="How different hybrid frameworks in QTP differ from each other" src="https://www.automationrepository.com/wordpress/wp-content/uploads/ar/apples-vs-oranges.png" alt="How different hybrid frameworks in QTP differ from each other" width="475" height="301" /></p>
<p>But there are certain components (or features) that frequently appear in different hybrid frameworks. These components would be the ones that we would use to create the sample hybrid framework.<br />
<span><br />
</span></p>
<h3>Is it easy to identify Hybrid Frameworks?</h3>
<p>Well, its easy but not that straightforward to identify a hybrid framework. An important reason for this is that the implementation of hybrid framework varies from person to person and from project to project. But you had also seen in the beginning of this article that most of the frameworks implemented in live projects are in fact hybrid frameworks.</p>
<p>Hence, any good framework worth its salt should be a hybrid framework. And to identify it properly, you need to have a close look at its architecture and its components. You should try to find out if its using keywords extensively, or if its taking its data from excel sheets, or if the code is written in modular format. This way, you would be able to identify the framework types from which the hybrid framework borrows its features.</p>
<p><em> </em><br />
<span style="text-decoration: underline;"><strong>Useful Tip</strong></span><span style="text-decoration: underline;"><strong>:</strong></span> Whenever you create or use a hybrid framework, don&#8217;t just call it a hybrid framework. Always try to include the names of the other frameworks from which your hybrid framework has derived its features. For example, you can call your framework as &#8211;</p>
<ul>
<li>&#8211; a hybrid framework based on functional and data driven approach</li>
<li>&#8211; a keyword based hybrid framework</li>
<li>&#8211; a hybrid framework implemented with functional and keyword driven components</li>
<li>&#8211; or any other fancy terms that come to your mind</li>
</ul>
<p>Its always considered a good practice to call your framework this way.</p>
<p><em> </em><br />
<span style="text-decoration: underline;"><strong>A word about BPT Framework:</strong></span> A good BPT framework will also not just be a BPT framework alone. It would also incorporate the features of a keyword driven, data driven or modular framework in it. And if that&#8217;s the case, then it becomes a hybrid framework. But still people tend to call it a BPT framework. So in your case, you can choose to simply call it a BPT framework, or a BPT based hybrid framework or something on similar lines.</p>
<p><span><br />
</span></p>
<h3>Features of a Hybrid Framework</h3>
<p>In this section, you would see some of the features that you can be implemented as part of your hybrid framework. Some of these features are pretty common and you would see them being used in many different hybrid frameworks. There would be other features also that are not so important and can be termed as nice to have (but not mandatory). Let us see some of these important features.</p>
<p><em> </em><br />
<strong>1.)</strong> The most basic set of features come first. The hybrid framework should be designed in such a way that it is <strong>re-usable and easily scalable.</strong> Also, the code should be <strong>easy to understand and maintain</strong>. As a matter of fact, please don&#8217;t consider this point as a feature. It is a must-have and you should consider it a rule. Doing this would save you a lot of troubles afterwards.</p>
<p><em> </em><br />
<strong>2.)</strong> All the components in the framework can be grouped separately. You can employ a basic folder structure to keep the test cases, function libraries, data sheets and test results grouped together in an efficient manner.</p>
<p><img loading="lazy" decoding="async" class="aligncenter" title="employ an efficient folder structure for your framework" src="https://www.automationrepository.com/wordpress/wp-content/uploads/ar/folder-structure-hybrid-framework.png" alt="employ an efficient folder structure for your framework" width="224" height="271" /></p>
<p><em> </em><br />
<strong>3.)</strong> <strong>One click execution.</strong> This is a good feature that you can implement in your automation framework. With just a single click of a button, the framework should execute all the test cases. In most of the cases, this feature is implement using MS excel + macros. This is because the excel sheets provide you with more control on how you can select your test cases.</p>
<p><img loading="lazy" decoding="async" class="aligncenter" title="One Click Execution Of Test Scripts" src="https://www.automationrepository.com/wordpress/wp-content/uploads/ar/one-click-execution.png" alt="One Click Execution Of Test Scripts" width="850" height="209" /></p>
<p><em> </em><br />
<strong>4.)</strong> Another important point is how you display your test results. You should aim to display the test results at minimum 2 different levels of abstraction. These are &#8211; <strong>summarized report</strong> and<strong> detailed report.</strong> A summarized report can simply be an excel sheet that provides the list of the test cases that were executed, whether they passed or failed, and a link pointing towards the detailed report for each of  the test cases. You can also add more parameters to this report if required. An example of a summarized report is shown in the below image.</p>
<p><img loading="lazy" decoding="async" class="aligncenter" title="Summarized Report" src="https://www.automationrepository.com/wordpress/wp-content/uploads/ar/summarized-reports.png" alt="Summarized Report" width="686" height="145" /></p>
<p>A detailed report would be the actual QTP result which you would have saved in appropriate result folders. The detailed report will mostly be used for investigative purpose. For example, in case a test script fails, or it takes more than expected time for completion, you can open the detailed result and try to find out the exact cause for the issue.</p>
<p><em> </em><br />
<strong>5.)</strong> <strong>Automated Email Notification</strong>. This is another important feature that you can incorporate in your automation framework. This is especially useful when you execute your test scripts in batch execution mode. You can write some logic in your framework that will automatically send emails to intended recipients after the completion of the batch run. You can also include the summarized excel report as an attachment in the email.</p>
<p><em> </em><br />
<strong>6.) Automated SMS Notification</strong>. This can be considered as an extension of the above point. Here, you can have your framework send an SMS to a select list of people with the test execution status.</p>
<p>If you intend to use this feature, then please keep in mind that the messages that you send should be short and crisp. For example, you could send something like this as an SMS &#8211; <strong>&#8220;TCs executed-100. Passed-85. Failed-15.&#8221;</strong></p>
<p>Also, please note that this feature is used very rarely. So from the usability point of view, its very difficult justify the use or need of sending SMSes. Also you would need to factor in the cost of sending SMSes.</p>
<p><span style="text-decoration: underline;"><strong>A scenario where sending SMS can be useful:</strong></span> You can configure your framework to send an SMS to certain people when, say 5 or 10 consecutive test cases fail one after the other. Such a scenario normally indicates that there is some big issue going on. Maybe the environment went down, or some other problem. Having an SMS sent in such a situation can help the teams identify the issue in a more timely manner.</p>
<p><em> </em><br />
<strong>7.) Framework should be externally configurable to a certain extent.</strong> This is a nice feature that I have started using recently. The idea behind this feature is &#8211; there should be certain functionalities in your framework that you should be able to configure without having to touch the code. Consider the following scenarios as examples &#8211;</p>
<ul>
<li><strong>a)</strong> Consider a case that on a particular day, the test environment is pretty slow. This requires you to increase the default load time of the pages. Your framework should provide a provision to do this easily for all the test cases.</li>
<li><strong>b)</strong> Consider another situation where you need to modify the details of the people to whom the email should be sent. Or maybe you don&#8217;t want to send email for a particular batch run. You framework should provide you a means with which you should be able to do these tasks without touching the code.</li>
</ul>
<p>The best way to create an externally configurable sheet is to use an excel sheet. The below image shows an example of such a sheet.</p>
<p><img loading="lazy" decoding="async" class="aligncenter" title="Hybrid Framework - External Configuration Sheet" src="https://www.automationrepository.com/wordpress/wp-content/uploads/ar/external-config-sheet.png" alt="Hybrid Framework - External Configuration Sheet" width="456" height="318" /></p>
<p><em> </em><br />
<strong>8.) Intermediate Status Reports. </strong>This is another nice to have feature that you can incorporate in your automation framework. Consider a scenario where you have set up a batch execution of 100 test cases. Its obvious that you wouldn&#8217;t be sitting in front of your system all the time to monitor the execution. Suppose you move away from your desk and come back to see the execution after say, 1 hour.</p>
<p>At this point the test cases might still be executing but you would not know how much more time your scripts will take to execute or maybe how many test cases are still pending. In such situations, intermediate status reports come in handy.</p>
<p>Intermediate status report can be as simple as a auto-closing popup that appears after the execution of each test case, gives you the updates and closes automatically (in 3 to 5 seconds). A simple message like the one shown below will be more than enough.</p>
<p><img loading="lazy" decoding="async" class="aligncenter" title="Intermediate Status Report" src="https://www.automationrepository.com/wordpress/wp-content/uploads/ar/intermediate-status-report.png" alt="Intermediate Status Report" width="223" height="204" /></p>
<p>These were some of the features that you can incorporate in your automation framework. It&#8217;s not necessary that you add all the features at once. A good approach would be create the framework with the minimum necessary features. And then you can add these nice-to-have features to your framework as enhancements.</p>
<p>In the upcoming articles in this series, we will create a hybrid framework from scratch where we will be incorporating some of these features. Please note that we will not be adding all the features to the sample framework as it leads to code complexity. The goal of the upcoming articles would be to keep the framework creation process as simple as possible, so that it is easily understood by everyone.</p>
<p><span><br />
</span></p>
<h3>Over to you</h3>
<p>This was all about the basics of hybrid framework and some cool features that can be implemented as part of this framework. We are waiting to hear your thoughts on these. Did you find this article helpful? Did you find the features interesting? Was there any feature that you were not aware about? Or something that you have seen or used but is not mentioned here? You can let us know your thoughts using the comments section.</p>
<p><span><br />
</span></p>
<div style="font-family: Verdana,sans-serif; border: 1px solid #C8B560; padding: 3mm; background: #FFF8C6; text-align: center;">
<p><strong>If you enjoyed this article, you can join our blog to get new articles delivered directly in your inbox.</strong></p>
<form style="text-align: center;" action="http://feedburner.google.com/fb/a/mailverify" method="post" onsubmit="window.open('http://feedburner.google.com/fb/a/mailverify?uri=automationrepository/feeds', 'popupwindow', 'scrollbars=yes,width=550,height=520');return true" target="popupwindow"><input style="width: 160px; height: 20px;" onfocus="if (this.value == 'Enter Your Email Address') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Enter Your Email Address';}" type="text" value="Enter Your Email Address" /> <input type="hidden" name="uri" value="automationrepository/feeds" /> <input type="hidden" name="loc" value="en_US" /> <input type="submit" value="Join Us" /></p>
<p style="text-align: justify;">
</form>
</div>
<p style="border: 1px solid #C38EC7; padding: 3mm; background: #EBDDE2;"><strong>Visit <a title="QTP Frameworks – An Introduction" href="http://www.automationrepository.com/2012/03/qtp-framework-types-an-introduction/">QTP Frameworks</a> Main Page for more articles on QTP Frameworks</strong>. You can also visit our <a title="QTP Tutorials" href="http://www.automationrepository.com/tutorials-for-qtp-beginners/" target="_blank">QTP Tutorials</a> page for more QTP Tutorials.</p>
<p>The post <a rel="nofollow" href="https://www.automationrepository.com/wordpress/2013/07/qtp-hybrid-framework-the-basics/">Hybrid Framework in QTP &#8211; The Basics</a> appeared first on <a rel="nofollow" href="https://www.automationrepository.com/wordpress">XX</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.automationrepository.com/wordpress/2013/07/qtp-hybrid-framework-the-basics/feed/</wfw:commentRss>
			<slash:comments>17</slash:comments>
		
		
			</item>
	</channel>
</rss>

<!--
Performance optimized by W3 Total Cache. Learn more: https://www.boldgrid.com/w3-total-cache/


Served from: www.automationrepository.com @ 2026-03-31 06:39:21 by W3 Total Cache
-->