QTP Challenges 4 Experts _ Just Another WordPress

165
QTP Challenges 4 Experts Just another WordPress.com site Four Different Ways to Associate Function Libraries to our QTP Scripts 26 MAR 2013 Leave a comment by vsprasad2k in QTP Most of the times, when you are creating test scripts or are designing a new QTP Framework, you would be trying to come up with reusable functions which you would have to store in the function library. Now, in order to use this function library with multiple test cases, you need to associate this function library with your scripts. This article explains the 4 methods that will help you in associating the function libraries in QTP Test Cases. Based on the type of framework you are using, you can use any of the following methods to associate function libraries to your QTP Script - 1) By using ‘File > Seings > Resources > Associate Function Library’ option in QTP. 2) By using Automation Object Model (AOM). 3) By using ExecuteFile method. 4) using LoadFunctionLibrary method. Let’s see in detail how each of these methods can be used to map function libraries to your test scripts. 1. Using ‘File > Settings > Resources > Associate Function Library’ option from the Menu bar This is the most common method used to associate a function library to a test case. To use this method, select File > Seings option from the Menu bar. This will display the ‘Test Seings’ window. Click on Resources from the left hand side pane. From the right hand side pane, click on the ‘+’ buon and select the function library that needs to be associated with the test case. QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/ 1 of 165 8/12/2014 6:10 PM

description

QTP tutorial

Transcript of QTP Challenges 4 Experts _ Just Another WordPress

Page 1: QTP Challenges 4 Experts _ Just Another WordPress

QTP Challenges 4 Experts

Just another WordPress.com site

Four Different Ways to Associate Function Libraries to our

QTP Scripts

26 MAR 2013 Leave a comment

by vsprasad2k in QTP

Most of the times, when you are creating test scripts or are designing a new QTP Framework, youwould be trying to come up with reusable functions which you would have to store in the functionlibrary. Now, in order to use this function library with multiple test cases, you need to associate thisfunction library with your scripts. This article explains the 4 methods that will help you in associatingthe function libraries in QTP Test Cases.

Based on the type of framework you are using, you can use any of the following methods to associatefunction libraries to your QTP Script -

1) By using ‘File > Se%ings > Resources > Associate Function Library’ option in QTP.2) By using Automation Object Model (AOM).3) By using ExecuteFile method.4) using LoadFunctionLibrary method.

Let’s see in detail how each of these methods can be used to map function libraries to your test scripts.

1. Using ‘File > Settings > Resources > Associate Function Library’

option from the Menu bar

This is the most common method used to associate a function library to a test case. To use this method,select File > Se.ings option from the Menu bar. This will display the ‘Test Se.ings’ window. Click onResources from the left hand side pane. From the right hand side pane, click on the ‘+’ bu.on and selectthe function library that needs to be associated with the test case.

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

1 of 165 8/12/2014 6:10 PM

Page 2: QTP Challenges 4 Experts _ Just Another WordPress

Associate function Library to QTP

2. Using AOM (Automation Object Model)

QTP AOM is a mechanism using which you can control various QTP operations from outside QTP.Using QTP Automation Object Model, you can write a code which would open a QTP test and associatea function library to that test.

Example: Using the below code, you can open QTP, then open any test case and associate a requiredfunction library to that test case. To do so, copy paste the below code in a notepad and save it with a .vbsextension.

12345678910111213

'Open QTP

Set objQTP = CreateObject("QuickTest.Application")objQTP.Launch

objQTP.Visible = True

'Open a test and associate a function library to the test

objQTP.Open "C:AutomationSampleTest", False, False

Set objLib = objQTP.Test.Settings.Resources.Libraries'If the library is not already associated with the test case, associate it..

If objLib.Find("C:SampleFunctionLibrary.vbs") = -1 Then ' If library is notalready added

objLib.Add "C:SampleFunctionLibrary.vbs", 1 ' Associate the library to the

test case

End

3. Using ExecuteFile Method

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

2 of 165 8/12/2014 6:10 PM

Page 3: QTP Challenges 4 Experts _ Just Another WordPress

ExecuteFile statement executes all the VBScript statements in a specified file. After the file has beenexecuted, all the functions, subroutines and other elements from the file (function library) are availableto the action as global entities. Simply put, once the file is executed, its functions can be used by theaction. You can use the below mentioned logic to use ExecuteFile method to associate function librariesto your script.

12345

'Action begins

ExecuteFile "C:YourFunctionLibrary.vbs"

'Other logic for your action would come here

'.....

4. Using LoadFunctionLibrary Method

LoadFunctionLibrary, a new method introduced in QTP 11 allows you to load a function library when astep runs. You can load multiple function libraries from a single line by using a comma delimiter.

12345678

'Some code from the action

'.....

LoadFunctionLibrary "C:YourFunctionLibrary_1.vbs" 'Associate a single functionlibrary

LoadFunctionLibrary "C:FuncLib_1.vbs", "C:FuncLib_2.vbs" 'Associate more than 1function libraries

'Other logic for your action would come here

'.....

This was all about the different ways using which you can associate function libraries to QTP Scripts.What are your views on this article? Can you think of any other points which I have missed and can beadded here? Please let us know your views using the comments section. Happy Reading.. :–)

Reference: h.p://www.automationrepository.com/2011/09/associate-function-library-to-qtp-script/(h.p://www.automationrepository.com/2011/09/associate-function-library-to-qtp-script/)

Does QTP / Unified Functional Testing Support Flex?

14 FEB 2013 Leave a comment

by vsprasad2k in QTP

Supports will depend on the version of Adobe Flex versions used to develop an application:

Flex SDK QTP 11 and below UFT 11.5

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

3 of 165 8/12/2014 6:10 PM

Page 4: QTP Challenges 4 Experts _ Just Another WordPress

lower than v4.5 Adobe QTP Flex Add-in No

v4.5 No HP UFT Flex Add-in

HP Unified Functional Testing (UFT) Flex Add-in

To use the HP Flex Add-in, the Flex application must be prepared/configured/setup accordingly with HP FlexAdd-in agent files. For more information see, Document ID KM00339739 – How to Prepare Flex Applicationsfor Testing with HP Flex add-in? (h.p://support.openview.hp.com/selfsolve/document/KM00339739)

Starting UFT 11.5, HP provides support for specific versions of Flex, with the HP Flex Add-in for GUItesting. Any other versions (mostly older), are not supported by UFT. We suggest trying QTP with Adobe FlexAdd-in (see below).

There is no current plans of providing backwards compatibility with Adobe QTP Flex Add-in, so scriptsusing such version cannot be ran nor upgraded to be used with the UFT Flex Add-in.

For more information about limitations, see Troubleshooting and Limitations – Flex Add-in“, within the“Chapter 13 – Flex Add-in” of the HP UFT Add-ins Guide (h.p://support.openview.hp.com/selfsolve/document/KM00225579)

Adobe QuickTest Professional (QTP) Flex Add-in

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

4 of 165 8/12/2014 6:10 PM

Page 5: QTP Challenges 4 Experts _ Just Another WordPress

IMPORTANT: Hewle% Packard does not support the Adobe Flex add-in, only HP Flex add-in (readsection above), therefore we strongly suggest contacting Adobe (h.p://www.adobe.com(h.p://www.adobe.com/)) to see about availability, support details, and pricing.

If yor are currently using the Adobe QuickTest Professional Flex Add-in, support forAdobe (Macromedia) Flexapplications must be handled by Adobe.

Adobe has a Flex Builder; commonly this includes the QuickTest Professional Flex add-in. The add-in wasdeveloped using QuickTest Professional’s Test ExtensibilityArchitecture functionality. The Flex add-in isdeveloped and owned by Adobe.

Adobe is providing the add-in via an automation package that is shipped with Flex Builder 3 Professional. Basicinformation on the automation package with QuickTest Professional integration is here:

h.p://www.adobe.com/support/documentation/en/flex/3/releasenotes_flex3_C.html (h.p://www.adobe.com/support/documentation/en/flex/3/releasenotes_flex3_C.html)h.p://www.adobe.com/products/flex/upgrade/ (h.p://www.adobe.com/products/flex/upgrade/)

Users can download the automation package with QuickTest Professional integrationhere: h.p://www.adobe.com/cfusion/tdrc/index.cfm?product=flex (h.p://www.adobe.com/cfusion/tdrc/index.cfm?product=flex)

A specific Adobe license is required and needs to be requested from Adobe. No specific Flex license is required onthe QuickTest Professional side.

Note: Support for the Flex add-in is being provided by Adobe. Customers/end-users need to contact the Adobesupport organization for help with problems or questions related to the Flex add-in.

From the Flex Builder 3 release notes (h.p://www.adobe.com/support/documentation/en/flex/3/releasenotes_flex3_C.html) (for an updated version, contact Adobe):

Requirements for Using the QTP Plug-in To test applications with Flex Automated Testing and the QTP agent, you must install the following:

HP QuickTest Professional 9.1 (no support for Smart Identification), available from HPHP QuickTest Professional 9.2 and patch 1701 or later if you want Smart Identification supportAdobe Flex 3 Plug-in for HP QuickTest ProfessionalMicrosoft Internet Explorer, version 6 or laterFlash Player ActiveX control, version 9.0.28.0 or higher

How to clean uninstall Unified Functional Testing (UFT)?

14 FEB 2013 Leave a comment

by vsprasad2k in QTP

As of right now, there is no specific specialized uninstallation process for UFT 11.5 or higher, so HP

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

5 of 165 8/12/2014 6:10 PM

Page 6: QTP Challenges 4 Experts _ Just Another WordPress

recommends:

Review Requirements:

Important. Same as QuickTest Professional (QTP) or Service Test (ST), full admin rights and UAC offis required before doing steps below. For more information seeDocument ID KM183747 – What arethe minimum permissions required for QuickTest Professional (QTP)?(h.p://support.openview.hp.com/selfsolve/document/KM183747)

1.

Check the optional tasks

(Optional) Backup licensing information:

Seat license: back up the LSERVRC file. For more information seeDocument ID KM175077 –What is the lservrc file and where to find it? (h.p://support.openview.hp.com/selfsolve/document/KM175077)

Concurrent license: Save contents of LSHOST/LSFORCEHOST Windows environmentvariable(s). For more information see Document ID KM175036 – How to set the LSHOST orLSFORCEHOST system variable? (h.p://support.openview.hp.com/selfsolve/document/KM175036)

1.

(Optional) Backup Test/Resources stored locally (if on ALM/QC, ignore step)2.

2.

Uninstall any non-core add-in/utilities.

Remove any of the below items if exist on machine from the “Programs and Features” underWindows Controls Panel’s (or Add/Remove Programs for operating systems older than WindowsVista), before continuing:

Unified Functional Testing (UFT) Add-in for Application Lifecycle Management (ALM) / QualityCenter (QC).NET Extensibility Add-inWPF/SilverLight Extensibility Add-inJava Extensibility Add-inWeb Extensibility Add-in (if displayed)Extensibility Accelerator Note: ensure to backup EA projects before uninstalling it

3.

Uninstall Unified Functional Testing from the “Programs and Features” under Windows Controls

Panel’s (or Add/Remove Programs for operating systems older than Windows Vista)

4.

Delete any traces left.

Review and check for traces mentioned on below documents, under the “Delete any tracesleft” section:

Document ID KM171368 – How to perform a clean uninstall of QuickTest Professional (QTP)?(h.p://support.openview.hp.com/selfsolve/document/KM171368)Document ID KM1016043 – How to perform a Clean Uninstall of Service Test (ST)?(h.p://support.openview.hp.com/selfsolve/document/KM1016043)

5.

Note: The uninstallation steps above, or related documents, do not indicate removing any of thecomponents used by tool (prerequisites or post-installation requirements). If end-user needs to removethen, collect the versions information of those currently installed on client machine, this in case otherseparate products unrelated to UFT is affected.

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

6 of 165 8/12/2014 6:10 PM

Page 7: QTP Challenges 4 Experts _ Just Another WordPress

Does QuickTest Professional (QTP) and/or Unified

Functional Testing (UFT) support Citrix?

14 FEB 2013 Leave a comment

by vsprasad2k in QTP

For more information about Citrix XenApp product, see externalreference:h.p://en.wikipedia.org/wiki/Citrix_XenApp (h.p://en.wikipedia.org/wiki/Citrix_XenApp)

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

7 of 165 8/12/2014 6:10 PM

Page 8: QTP Challenges 4 Experts _ Just Another WordPress

Supported versions

Citrix MetaFramePresentation Server

QTP 9.2QTP9.5

QTP10.0

QTP11.0

UFT 11.5GUI

Version 4.0 Yes Yes Yes Yes No

Version 4.5 No No Yes Yes Yes

Version 5 No No Yes Yes Yes

Version 6 (Xenapp) No No No Yes Yes

Notes:

“XenApp” is the new name for newer versions of Citrix (6 and higher). Formore information see Document ID KM870314 – Difference CitrixMetaframe Presentation Server and XenApp?(h.p://support.openview.hp.com/selfsolve/document/KM870314)“Citrix XenDesktop” isn’t supported.If QTP 11 isn’t viewing run results on Citrix XenApp 6, check with HPSupport about testing Hot-Fix QTP_00857 (This is a private patch onlyprovided by HP Support, so if needed, please submit a case)

Scope of support (What Citrix implementation is supported)

(IMPORTANT) Requirements: To record and replay against application(s)hosted on a Citrix environment, both QTP / UFT and application undertesting (AUT) must be:

Installed on the same machine (usually the server).Running within the same Citrix session.

Example Scenario 1:

Application Under Testing (AUT) Location: Installed and hosted on CitrixserverQTP / UFT Location: Installed on clientStatus: Not Supported.Notes: If try to record and replay against the application, QTP / UFT willnot recognize individual objects. In fact, QTP / UFT will view the entiresession Window as one object.

(h.p://qtpchallenge.files.wordpress.com/2013/02/citrx1.jpg)Example Scenario2:

Application Under Testing (AUT) Location: Installed and hosted on Citrixserver Status: Supported.QTP / UFT Location: Installed and hosted on Citrix server

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

8 of 165 8/12/2014 6:10 PM

Page 9: QTP Challenges 4 Experts _ Just Another WordPress

Requirement:Both QTP and AUT must be under same Citrix Session (thismay required special configuration). See ilustration below to checkrecommended scenario where support works appropiatelyNotes: Citrix hosting a virtual version of a Windows operating system andwithin such, both QTP / UFT and the AUT are installed; QTP / UFT will beable to interact virtually with any item/element/program installed on suchoperating system as if it were a physical operating system. This isnormally seeing as “using the same session”

(h.p://qtpchallenge.files.wordpress.com/2013/02/citrx2.jpg)Note:One suggestion to determine if the QTP / UFT recognition works fine onsame Citrix session

When using the Object Spy, the pointy hand cursor (when actually spying)

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

9 of 165 8/12/2014 6:10 PM

Page 10: QTP Challenges 4 Experts _ Just Another WordPress

remains the same (stays as pointy-hand-cursor, instead of the defaulticon/cursor, such as the pointing-arrow). If it changes back while still actuallyspying (while hovering mouse on top of desired application to spy), AUT andQTP / UFT are not using the type of same session required.

License Requirements

It is required to use a concurrent (floating) license to operate QTP / UFT in aCitrix environment.

For more information, please refer to:

Document ID: KM183794 – Unable to launch QTP / UFT in a TerminalServices/Citrix environment with a seat license(h.p://support.openview.hp.com/selfsolve/document/KM183794).Document ID KM497568 – Can the License Server be installed on a VirtualMachine? (h.p://support.openview.hp.com/selfsolve/document/KM497568)

More feedback

From the QTP / UFT documentation:

When running QuickTest on a remote machine using a Remote DesktopConnection session (RDC) or using Citrix, if the remote session is minimizedduring the run session, or if the computer on which the application is being testedis logged off or locked, the following problems may occur:

the test or component run session may failsteps that contain keyboard or focus operations may failthe Test Results still image capture and/or the Mercury Screen Recorder maydisplay a black screensteps for which the device level replay is configured to use the mouse (insteadof browser events) to run mouse operations may fail. (Set the device levelreplay using a Se.ing.WebPackage(“ReplayType”) statement or by se.ing theReplay type option in the Advanced Web Options dialog box.)

Workaround: If using Citrix or a Remote Desktop Connection session to run atest or component, do not minimize the session window, and make sure that thecomputer on which the application is being tested is not logged off or locked.

Critical patches available for Unified Functional

Testing (UFT)

14 FEB 2013 Leave a comment

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

10 of 165 8/12/2014 6:10 PM

Page 11: QTP Challenges 4 Experts _ Just Another WordPress

by vsprasad2k in QTP

Feature -Patch

Core Product -UFT_00001 – UFT Service Pack 11.51 (h.p://support.openview.hp.com/selfsolve/document/KM00337418)

HP UFT Add-in for ALM – UFTALM_00001 – UFT Add-in Service Pack 11.51 for ALM(h.p://support.openview.hp.com/selfsolve/document/KM00337421)

HP Results Viewer – UFTRRV_00001 – UFT RRV Service Pack (h.p://support.openview.hp.com/selfsolve/document/KM00337422)11.51

HP Extensibility Accelerator – UFTEXA_00001 – UFT EA Service Pack 11.51(h.p://support.openview.hp.com/selfsolve/document/KM00338055)

Note: The “ALM Integration Enablement Pack” (required for UFT to connect to ALM 11.5) is a pack to beinstalled on ALM server, not on UFT client

What is the difference between QTP and UFT ?

12 FEB 2013 Leave a comment

by vsprasad2k in QTP

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

11 of 165 8/12/2014 6:10 PM

Page 12: QTP Challenges 4 Experts _ Just Another WordPress

HP Unified Functional Testing [UFT] is a new tool released in December of2012 that integrates two of HP Testing products in a common IDE. Itprovides a powerfull testing framework for GUI and API testing:

HP Service TestHP QuickTest Professional

HP Unified Functional Testing has enhanced, and brand new functionalitiesthat are not available in previous versions of HP Service Test or HP QuickTestProfessional.

Some important considerations

Many, not all, of the knowledge base articles available for HP QuickTestProfessional 10, 11 and HP Service Test 11.20 can be applied to HP UnifiedFunctional Testing product.Licenses for QTP or ST will work for UFT, but they can restrict somefeatures. It’s recomendable to upgrade to UFT Licenses to take advantageto the complete functionality provided by the tool.If you just need API Testing, you can use HP Service Test Standalone,however this option it’s not avaialble for GUI testing.HP Unified Functional Testing offers integration with Perfecto Mobile inorder to perform Mobile Testing.HP Unified Functional Testing offers new Add-ins for GUI testing as suchas: QT and Flex.HP Unified Functional Testing is not considered to be newer version ofeither QuickTest Professional or ServiceTest.

09 FEB 2013 Leave a comment

Know more about HP UFT 11.5 [Click to download] (h%p://h30499.www3.hp.com/hpeb/a%achments/hpeb/sws-583/198/1/Functional%20Test%20Webinar%20Nov%2028%20final%20slides.pdf)

HP UFT 11.5 [Unified Functional Testing tool]

-Its an unique platform for testing almost all kind of applications.

- HP QTP’s latest version, combination of QTP and Service Test

- Key Benfits:

Automate testing of multi-layer test scenarios, including GUI and API testing.Powerful visual user experience and toolsetTesting of emerging technologies with innovative HP UFT Insight object recognitionEasy conversation of manual tests to automated testsFramework definition for be.er test management thanks to tight integration to HP Business ProcessTesting and HP Application Lifecycle Management

LINK by vsprasad2k

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

12 of 165 8/12/2014 6:10 PM

Page 13: QTP Challenges 4 Experts _ Just Another WordPress

Reasons for Why BPT is a Great Testing Framework

09 JAN 2013 2 Comments

by vsprasad2k in QTP

1) You can build and run tests quickly and easily

BPT speeds up test creation, maintenance and execution through reuse of components.

2) You don’t have to be an automation expert to use BPT

Manual testers, automation engineers, and subject ma.er experts can all use BPT effectively.

3) People in different testing roles can all work together

BPT helps you document your components and tests, including screenshots, how they should be used,etc. This makes it easy for people with different roles and skillsets to share each other’s assets.

4) You can run the same test automatically and manually

You’re free to choose how to run your tests. And if you want to automate your existing manual tests,you can continue to run them manually until you’ve completed the automation.

5) You don’t need to build your own framework

Creating a framework is expensive and time consuming. You avoid all of that with BPT, which gives youeverything you need out of the box, and is fully customizable so that you can tailor it to the way you andyour organization work.

6) You can easily create and update tests for SAP, Oracle, and other so-called ‘packaged applications’

You can use pre-configured test assets such as those offered by TurnKey (h.p://h20229.www2.hp.com/partner/directory/ax/us/turnkeysolutions.html) to save time and effort in testing leading ERP and CRMapplications.

7) Testing can start early

Keywords and components can be defined before the application has been delivered for testing, so youcan design tests earlier in the software development lifecycle.

8) You’re encouraged to plan your testing activities in advance

BPT helps you think about what you’re going to test, how you’re going to test it, and the componentsand other assets you’ll need.

9) BPT is fully integrated with HP’s test management and testing tools

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

13 of 165 8/12/2014 6:10 PM

Page 14: QTP Challenges 4 Experts _ Just Another WordPress

BPT is tightly integrated with lots of HP tools – for example, Application Lifecycle Management(h.p://hp.com/go/alm), QuickTest (h.p://hp.com/go/uft), Service Test (h.p://hp.com/go/uft), Sprinter(h.p://h30499.www3.hp.com/t5/The-Future-of-Testing-Blog/HP-Sprinter-Improving-Quality-without-Automated-Testing/ba-p/5739783#.UFnK5o2Ur0Q), etc., so you don’t need to learn a whole new set oftools.

QTP object identifications issues when working with

.Net Application

10 NOV 2012 Leave a comment

by vsprasad2k in challenges, QTP, Web Extensibility Add-in

Points to ponder when you face QTP Object Identification issues working with .Net Applications:

Check which object controls they have used in .Net Application development. Like:Infragistics NetAdvance object controls:

TestAdvantage for Windows Forms 2007 contains QuickTest Professional Custom Libraries for the

Infragistics NetAdvantage for Windows Forms 2007 Volume 1 Controls. QuickTest Professional and.NET Add-In

1.

HP’s QuickTest Professional provides the industry’s best solution for functional test and regression

test automation – addressing every major software application and environment. QuickTestProfessional employs the concept of keyword-driven testing to radically simplify test creation andmaintenance.

2.

h.p://www.infragistics.com/products/testadvantage-windows-forms-qhp/

(h.p://www.infragistics.com/products/testadvantage-windows-forms-qhp/)

3.

DevExpress Object controls, QTP /DeveExpress Tech support doesn’t have any extension/plug-in tosupport the .Net Application developed using this object controls.

Verify whether you have installed the respective QTP Patches QTP_00699,QTPNET_00082,QTPNET_00096, Etc.. [As required for swf/wpf objects]

After installation, launch QTP and select the first radio bu.on in Windows tab on Record & RunSe.ings window.

Key Enhancements in QTP 11.0

28 AUG 2012 Leave a comment

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

14 of 165 8/12/2014 6:10 PM

Page 15: QTP Challenges 4 Experts _ Just Another WordPress

by vsprasad2k in challenges, QTP, QTP Tricks, Uncategorized Tags: Features of QTP 11.0

Click here to see ‘QTP Vs Selenium’ post (h.p://qtp4experts.wordpress.com/qtp-vs-selenium/)

1) Support for new Operating Systems:QTP 11.0 has added new support for the following operating systems:

Windows 7Windows Vista SP2Windows Server 2008 SP2Windows Server 2008 R2

2) Enhanced Data Management Facility:QTP is now seamlessly integrated with HP ALM (Application Lifecycle Management) software. QualityCenter (HP ALM) test configuration functionality enables us to determine at runtime which data sets touse for our tests.

ALM test configurations enable us to:

Unbind our data from our testsShare common data sources across different testsFilter our data to fit our testing needsIncrease requirements traceabilityWe store the data for our tests in the Quality Center Test Resources module in the form of data tableresource files.

We can then define multiple test configurations for a test in the Test Plan module. When working withdata-driven QTP tests in HP ALM, each configuration is a QTP test that is set to run with a selected dataresource file and optional data filter se.ings.

One or more specific configurations of the test can be included in a Test Set to cover different parts of arequirement or to cover multiple requirements.

By using Quality Center test configurations, we can create more generic tests and reuse them byassociating a different set of data with each. We can also reuse our data by associating the same datatable file with multiple tests.

3) New Object Spy Functionality:The Object Spy has the following new features:

Add an object to a repository: We can now add an object to the object repository directly from theObject Spy.Highlight an object in our application: When we select a test object in the Object Spy Object hierarchytree, we can then select to highlight the object in our application that corresponds to that test object.Copy/paste object properties: We can copy the identification properties and values of a selected testobject in the Object Spy and paste the details into any document. The details are forma.ed inprogrammatic description syntax. This option is especially useful if we want to compare theproperties and values of two objects in our application or when creating programmatic descriptions.

Additionally, the Object Spy has a new, cleaner look and feel:

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

15 of 165 8/12/2014 6:10 PM

Page 16: QTP Challenges 4 Experts _ Just Another WordPress

4) New Smart Regular Expression list:The Smart Regular Expression list provides syntax hints that make it easier than ever to insert regularexpressions into our test steps. It also enables us to access the Regular Expression Evaluator, which letsus test regular expressions to make sure they suit our needs.

5) New QTP-Service Test integration facility:Now we can test our GUI and UI-Less Application Functionality in One Test. We can use QTP steps tostart testing the GUI elements in our application, then call a Service Test test to validate servicecommunications (standard Web Services, non-SOAP Web Services, such as REST, etc.), and then stepback into our QTP GUI testing, all in a single test run.

The results of the QTP and Service Test steps are displayed in a unified report in the new Run ResultsViewer.

6) New Run Results Viewer:The new Run Results Viewer provides an Executive Summary page with summary data, pie charts andstatistics for both the current and previous runs, a quick link to the previous run results, and more.

The Run Results Viewer displays the results of our run session in a set of panes that we can show, hide,move, dock, and otherwise customize to our needs.

We can install the Run Results Viewer as a standalone installation. This enables us to share the results ofour tests with business analysts and developers who do not work with QTP.

7) New facility to hide the Keyword View:If we prefer working only with the Expert View, we can now use an option in the Options dialog box tohide the Keyword View so that only the Expert View is displayed when we open QTP Professional.

Facility to add Images to Our Run Results:We can now add a Reporter.ReportEvent statement that includes an image file path. This lets us add animage to the run results wherever one is needed.

9) New Log Tracking Functionality:QTP’s new Log Tracking functionality helps us work with developers to pinpoint the root causes ofunexpected behavior in our application.

When we enable log tracking, QTP receives the Java or .NET log framework messages from ourapplication and embeds them in the run results.

We can click a log message in the results to jump to the relevant step in the run results tree, or we canclick a step in the run results tree and view the log message that was generated at the time that theselected step ran. We can also specify that a log message of a particular level (or higher) will fail our test.

After we view the results, we can print or export the log tracking details to a file to show to a developer,or we can provide the developer with the standalone Run Results Viewer installation so that thedeveloper can view and analyze the results directly on his or her own desktop.

10) Automatic Parameterization of Steps:We can instruct QTP to automatically parameterize the steps in our test’s actions at the end of arecording session.

This enables us to create actions that can be used for a variety of different purposes or scenarios by

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

16 of 165 8/12/2014 6:10 PM

Page 17: QTP Challenges 4 Experts _ Just Another WordPress

referencing different sets of data.

We activate this option by selecting the Automatically parameterize steps option in the General tab ofthe Options dialog box. We can set the option to use Global Data Table Parameters or Test Parameters.

When we stop a recording session while this option is selected, QTP replaces the constant values in thetest object operation arguments of our steps with either Data Table parameters or action parameters,based on our selection in the Options dialog box.

QTP performs this automatic parameterization for all relevant steps in any action in our test, in whichwe recorded one or more steps during that recording session.

If we work with HP ALM, and we select the Global Data Table Parameters option, we can map thegenerated parameters to the column names of a data resource and then use different configurations inour test sets.

11) New Visual relation identifiers:We can now use visual relation identifiers to identify application objects based on other objects that arealways near them.

This enables us to create a more reliable identification definition for test objects that are otherwisedifficult to differentiate, and to ensure that the identification remains reliable even if the user interfacedesign changes.

The Visual Relation Identifier Dialog Box provides the interface and tools to help us create and verifyour visual relation identifier definitions.

12) Visual indication of Version Control Status of Tests:If we are working with version control in HP ALM or Quality Center, QTP provides a visual indicationto show us when an asset is checked into or out of a project.

Tests, components, and function libraries that are part of version controlled projects stored in HP ALMor Quality Center display an icon and/or text in the title bar, indicating their version control status.

13) Web 2.0 add-ins support:QTP 11.0 provides Web Add-in Extensibility-based add-ins for ASP .NET Ajax, GWT, Yahoo UI, andDojo Web 2.0 toolkits.

We can use these add-ins just as we would any other add-in. We can also use Web Add-in Extensibilityor Extensibility Accelerator to customize the provided support to match our needs.

We install these add-ins by running the Web 2.0 Toolkit Support Setup from the Add-in Extensibilityand Web 2.0 Toolkits option in the QTP setup window.

The operations supported for each Web 2.0 test object class are a combination of custom operationsdeveloped for that test object class and operations directly inherited from the corresponding (base) WebAdd-in test object class.

14) New capabilities for working with Web-Based objects:Following new testing capabilities are now available handling Web-Based objects.

a) Firefox Testing: Us can now record steps on Mozilla Firefox and use the.Object property to access the

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

17 of 165 8/12/2014 6:10 PM

Page 18: QTP Challenges 4 Experts _ Just Another WordPress

Firefox DOM.

b) XPath, CSS, Identifiers: Us can add the XPath or CSS identifier properties to instruct QTP to identify aWeb object in our application based on its XPath location or CSS definition.

c) Event Identifiers: Us can also now use the a.ribute/* notation in the test object description to identifya Web-based object based on an event associated with that object. For example, us can adda.ribute/onClick as a property in a WebBu.on test object description to identify a bu.on that isassociated with the onClick event.

d) Embed or Run JavaScripts in our Web Pages: We can use the new EmbedScript/EmbedScriptFromFileand RunScript/RunScriptFromFile functions to embed JavaScripts in all loaded browser pages andframes or to run JavaScripts in specific pages. Use these scripts to perform operations on, or retrieve datafrom, the browser pages in our application.

15) New methods for testing Web-based Operations:The following methods are available to test Web-based applications:

AnyWebBasedObject.RightClick / MiddleClickBrower.ClearCacheBrowser.DeleteCookies

16) New LoadFunctionLibrary statement:The new LoadFunctionLibrary statement lets us load a function library when a step runs instead of atthe beginning of a run session. This means, for example, that us can define conditional steps that usefunctions from various function libraries, but load only the required function libraries during a runsession.

17) Improved checkpoints and output value objects management:We can now manage checkpoints and output value objects when comparing, merging, and exportingobject repositories just like any other test object, including filtering, searching, and conflict resolution.

18) Dual Monitor Support:QTP recognizes objects across multiple monitors, meaning that our application display no longer needsto be limited to one screen. Alternatively, we can view QTP on one monitor while the steps run on ourapplication on another monitor.

19) New QTP Asset Upgrade Tool for HP ALM and Quality Center:The QTP Asset Upgrade Tool for HP ALM/Quality Center enables us to upgrade, in a batch, all the QTPassets in an HP ALM or Quality Center 10.00 project from QTP 9.5 or earlier to the current format and toconvert testing document a.achments to the resources and dependencies model.

The QTP Asset Upgrade Tool for HP ALM/Quality Center also enables us to upgrade our tests to use thenew test configurations feature. If our tests contain data table parameters that are stored in the Globalsheet of a QTP data table, this tool copies those data table parameters to our HP ALM or Quality Centerproject, enabling us to start working with HP ALM test configurations.

20) Test execution in minimized remote desktop protocol session:We can now run QTP in a minimized RDP (remote desktop protocol) session in an RDP 6.0 or later clientby se.ing a registry value on the remote computer.

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

18 of 165 8/12/2014 6:10 PM

Page 19: QTP Challenges 4 Experts _ Just Another WordPress

21) Improved Web Add-in Extensibility:We can now develop browser-independent Web Add-in Extensibility support sets that support testingcustom controls on both Internet Explorer and Firefox, and on different versions of these browsers.

We can introduce external JavaScript libraries in our Web Add-in Extensibility support sets, enabling usto call their functions from within the JavaScript functions we develop to support custom controls.

QTP’s performance when learning, spying, and running steps on controls supported by Web Add-inExtensibility is improved.

22) Improved Business Process Testing:QTP 11.0 provides the following enhancements for business process testing when working with HPALM:

# Improved performance.

# Application areas are now stored in the HP ALM Test Resources module as resources.

This enables us to apply version control to an application area, view at a glance which components areusing a specific application area, see which resource files are associated with a particular applicationarea, share our application areas with other projects, and so on.

# Local system monitoring is now supported for component runs.

# All component parameters in HP ALM are now inserted as string value types. From HP ALM, we canuse options to encrypt these parameter values or to apply dynamic date values.

23) New QTP-Service Test integration Facility:The new QTP-Service Test integration enables us to test across the GUI and non-GUI layers of ourapplication.

We can use QTP steps to start testing the GUI elements in our application, then call a Service Test tovalidate service communications (standard Web Services, non-SOAP Web Services, such as REST, etc.),and then step back into our QTP GUI testing, all in a single test run.

The results of the QTP and Service Test steps are displayed in a unified report in the new Run ResultsViewer.

24) New Extensibility Accelerator for Functional Testing:

The new Extensibility Accelerator for Functional Testing is a Visual Studio-like IDE that facilitates thedesign, development, and deployment of Web Add-in Extensibility support.

It provides a user interface and special tools that help us define new test object classes, map those testobject classes to the controls in our application, and teach QTP how to identify the controls, performoperations on the controls and retrieve their properties.

We install the Extensibility Accelerator from the Add-in Extensibility and Web 2.0 Toolkits option in theQTP Professional setup window.

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

19 of 165 8/12/2014 6:10 PM

Page 20: QTP Challenges 4 Experts _ Just Another WordPress

Release Locked QTP Tests from QC

30 JUL 2012 Leave a comment

by vsprasad2k in QTP QC ISSUES

Execute the below Script,

Set QCConnection=QCUtil.QCConnectionSet con=QCConnection.commandcon.CommandText=”DELETE FROM LOCKS WHERE LK_USER = ‘USERID’ “Set recset=con.execute

*Mention your QC USER ID in above code

***********************************************************************************************

you can find this info. in QC Site Configuration TAB (Use QC Admin login) , Lock_TimeOut option

Working on Windows Shell, Registy keys and TextUtil

using QTP

17 JUL 2012 Leave a comment

by vsprasad2k in COM DCOM AOM, QTP, QTP Registry, QTP Tricks Tags: QTP RegEdit

Change the Registry Key Values:

‘f_WriteRegEdit(“HKCUControl PanelInternationalsShortDate”,datatable(“DateFormat”),”REG_SZ”)

Function f_WriteRegEdit(strKeyPath,strKeyVal,strValType)

Set WshShell = CreateObject(“WScript.Shell”)

WshShell.RegWrite strKeyPath, strKeyVal, strValType

End Function

msgbox f_ReadRegEdit(“HKCUControl PanelInternationalsShortDate”)

Function f_ReadRegEdit(strKeyPath)

Set WshShell = CreateObject(“WScript.Shell”)

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

20 of 165 8/12/2014 6:10 PM

Page 21: QTP Challenges 4 Experts _ Just Another WordPress

f_ReadRegEdit=WshShell.RegRead (strKeyPath)

End Function

How to make QC Status incomplete, during script execution:

Reporter.ReportEvent micPass,”test”,”test”

Set WshShell = CreateObject(“WScript.Shell”)

WshShell.SendKeys “{F4}”

Reporter.ReportEvent micPass,”test”,”test”

——————————————————————————————————————————————

Window or Page is not recognizing ???? you may use shell scripting and textutil.GetText to avoidsuch situations…

Let me know if you have any issues using the code…

Set WshShell = CreateObject(“WScript.Shell”)

WshShell.SendKeys “{TAB 1}”

WshShell.SendKeys “some data”

msgbox textutil.GetText(“1704986″)

VBScript code snippet to execute a Stored Procedure using

ADO object

17 JUL 2012 Leave a comment

by vsprasad2k in QTP, QTP ADODB

‘Connect to server to auditSet MyProdServer = CreateObject(“ADODB.Connection”)Set MyProdServerCMD = CreateObject(“ADODB.Command”)Set MyProdServerRS = CreateObject(“ADODB.Recordset”)MyProdServer.Provider = “sqloledb”MyProdServer.ConnectionString = “server=” & sServerNameSource &

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

21 of 165 8/12/2014 6:10 PM

Page 22: QTP Challenges 4 Experts _ Just Another WordPress

“;Database=admin;Trusted_Connection=yes;”MyProdServer.OpenMyProdServerCMD.ActiveConnection = MyProdServerMyProdServerCMD.CommandText = “sp_who3″MyProdServerCMD.CommandType = adCmdStoredProc

Set MyProdServerRS = MyProdServerCMD.Execute

If MyProdServerRS.State = adStateClosed ThenlogFile.WriteLine(“No results returned ” & Now())Else

MyProdServerRS.MoveFirstWhile MyProdServerRS.EOF = FalsesSPID = MyProdServerRS(“SPID”)sCmdText = MyProdServerRS(“CommandText”)sLogin = MyProdServerRS(“Login”)sHostName = MyProdServerRS(“HostName”)sBlkBy = MyProdServerRS(“BlkBy”)sDBName = MyProdServerRS(“DBName”)sCommand = MyProdServerRS(“Command”)sCPUTime = MyProdServerRS(“CPUTime”)sDiskIO = MyProdServerRS(“DiskIO”)sLastBatch = MyProdServerRS(“LastBatch”)sProgramName = MyProdServerRS(“ProgramName”)sSpid2 = MyProdServerRS(“SPID”)

Automation Test Development Strategy is simillar to

SDLC process

12 JUL 2012 Leave a comment

by vsprasad2k in Uncategorized

For the projects who want to make automation testing 100% successful/robust, for the feasibility theyhave done… follow the below Software Automation Test Development Process [SATDP] with automatedmetrics/artifacts which should update the project status as and then at each phase, like resuableactions/functions/testscripts/OR/libs developed whom, when and what they developed and place thetest results path in excel, be.er use Macros..I will describe the process followed in each phase, soon…

Automation Test Feasibility1.

Automation Test Plan/Plan2.

Analyse Manual TCs/ Analysis3.

Test Script Designing/Design4.

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

22 of 165 8/12/2014 6:10 PM

Page 23: QTP Challenges 4 Experts _ Just Another WordPress

Test Script Development/Code5.

Business Tests Run/Unit Test6.

Integrate Business TestScripts,Functions and ReUsable Actions /Integration7.

Code Optimization/Performation8.

Batch Execution / Execute9.

Export/Copy the entire webtable from the webpage into

Excelsheet, using Vb script

12 JUL 2012 Leave a comment

by vsprasad2k in Uncategorized

dim xl set xl=createobject(“Excel.Application”)xl.workbooks.open “c:/book1.xls”set nsheet=xl.sheets.item(1)row=Browser(“browser”).page(“page”).webtable(“table”).getroproperty(“rows”)cols=Browser(“browser”).page(“page”).webtable(“table”).getroproperty(“cols”)for i=0 to row-1for j=0 to col-1val=Browser(“browser”).page(“page”).webtable (“table”).getcelldata(i,j)nsheet.cells(i,j)=valnextnext

—————————————————————————————–Environment(“Peportpath”)=”C:Result.xls”a=Browser(“Google”).Page(“Google”).WebTable (“index:=0″).GetROProperty(“outerhtml”)Set FSO = CreateObject(“Scripting.FileSystemObject”)Set WriteFile = FSO.CreateTextFile( Environment (“Peportpath”), True) writeFile.writeLine(a)writeFile.close

Methods of Reading Data from EXCEL Sheet

-Using VBScript

31 MAY 2012 Leave a comment

by vsprasad2k in QTP, QTP Excel, QTP VBScript

Method #1

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

23 of 165 8/12/2014 6:10 PM

Page 24: QTP Challenges 4 Experts _ Just Another WordPress

Datatable.Importsheet “path of the excel file.xls”, source sheet ID/Name, desination sheet ID/NameDatatable.SetCurrentRow(1) ‘Read Value from First Rowvalue = datatable.Value(parameterName,Sheet ID/Name)

‘To Read Value from All the rows

Datatable.Importsheet “path of the excel file.xls”, source sheet ID/Name, desination sheet ID/NameFor vRow = 1 To Datatable.GetRowCountDatatable.SetCurrentRow(vRow)value = datatable.Value(parameterName,Sheet ID/Name)Next

Method #2

Dim objexcel, objWorkbook, objDriverSheet, columncount, rowcountset objexcel = Createobject(“Excel.Application”)Set objWorkbook = objExcel.WorkBooks.Open(“path of the file.xls”)Set objDriverSheet = objWorkbook.Worksheets(“name of the sheet / Id of the sheet”)columncount = objDriverSheet.usedrange.columns.countrowcount = objDriverSheet.usedrange.rows.countfor i = 1 to colunmcountcolumnname = objDriversheet.cells(i,1)if columnname = knowncolumnname thenfor j = 1 to rowcountfieldvalue = objdriversheet.cells(j,i)nextend ifnext

Method #3

Function GetDataFromDB (strFileName, strSQLStatement)

Dim objAdCon, objAdRsSet objAdCon = CreateObject(“ADODB.Connection”)

objAdCon.Open “DRIVER={Microsoft Excel Driver (*.xls)};DBQ=”&strFileName & “;Readonly=True”If Err <> 0 ThenReporter.ReportEvent micFail,”Create Connection”, “[Connection] Error has occured. Error : ” & ErrSet obj_UDF_getRecordset = NothingExit FunctionEnd If

Set objAdRs = CreateObject(“ADODB.Recordset”)objAdRs.CursorLocation=3 ‘ set the cursor to use adUseClient – disconnected recordsetobjAdRs.Open strSQLStatement, objAdCon, 1, 3

MsgBox objAdRs.fields(4).nameWhile objAdRs.EOF=falseFor i=0 to objAdRs.Fields.count

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

24 of 165 8/12/2014 6:10 PM

Page 25: QTP Challenges 4 Experts _ Just Another WordPress

Msgbox objAdRs.fields(i)NextobjAdRs.moveNextWend

If Err<>0 ThenReporter.ReportEvent micFail,”Open Recordset”, “Error has occured.Error Code : ” & ErrSet obj_UDF_getRecordset = NothingExit FunctionEnd If

Set objAdRs.ActiveConnection = Nothing

objAdCon.CloseSet objAdCon = Nothing

End Function

Example

Set rsAddin = GetDatasFromDB(“C:Documents and Se.ingsgrameshDesktopLogin.xls”, “Select * from[Login$]“)

VBScript to open excel spreadsheet, update cell, save

then close

12 MAY 2012 Leave a comment

by vsprasad2k in QTP Excel, QTP Tricks, QTP VBScript, Uncategorized

Set objExcel = CreateObject(“Excel.Application”)‘Set objWorkbook = objExcel.Workbooks.Open(“C:test.xls”)objExcel.Application.Visible = TrueobjExcel.Workbooks.AddobjExcel.Cells(1, 1).Value = “Test value”

objExcel.ActiveWorkbook.SaveAs “C:test.xls”objExcel.ActiveWorkbook.CloseobjExcel.Application.Quit

BPT running in an infinite loop, when using QTP 11 QC11

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

25 of 165 8/12/2014 6:10 PM

Page 26: QTP Challenges 4 Experts _ Just Another WordPress

15 APR 2012 Leave a comment

by vsprasad2k in challenges, QTP, QTP Patch, QTP Tricks Tags: bpt, QTP 11.0 Patch

BPT’s running in an infinite loop? Going crazy trying to figure out the solution for it?Its Patch QTP_00821

HP has just released a critical patch for people using QuickTest Professional 11 and ALM/QC 11.00 withBPT. The patch resolves an issue with se.ings that were setup for normal QTP test were sometimesincorrectly applied to a Business Process Test run. These se.ing caused the BPT to run in an infiniteloop.

Patch QTP_00821 (h.p://support.openview.hp.com/selfsolve/document/FID/DOCUMENTUM_QTP_00821) can be downloaded from HP.

Avoid system lock during Automation Test Script Execution

21 MAR 2012 Leave a comment

by vsprasad2k in Uncategorized

There are few ways to prevent windows to lock the system:

Way1:Download the software Caffeine 1.4 (h.p://download.cnet.com/Caffeine/3000-2094_4-10914397.html)and install on the machine where u run the scripts.

Way 2:Create a .vbs file (with the below mentioned code) and a task in task scheduler

Const DELAY_MINUTES = 10

Wscript.Sleep DELAY_MINUTES * 60000DoCreateObject(“Wscript.Shell”).SendKeys “+”Wscript.Sleep DELAY_MINUTES * 60000Loop

Way 3:Create a .vbs file (with the below mentioned code) and a task in task scheduler

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

26 of 165 8/12/2014 6:10 PM

Page 27: QTP Challenges 4 Experts _ Just Another WordPress

Const micVoid = 0

Const micByte = 26

Const micLong = 3

Const KEYEVENTF_KEYUP = &H2

Set Extern = CreateObject("Mercury.ExternObj")

extern.Declare micVoid, "keybd_event", "user32", "keybd_event", micByte, micbyte,

miclong, micLong

Extern.Declare micVoid, "Sleep", "kernel32", "Sleep", micLong

While True

extern.keybd_event 0, 0, KEYEVENTF_KEYDOWN, 0

Extern.Sleep 20000

Wend

-********************-*****************-*****************************-*********************************-*****************************We can even run the scripts when the system is locked, but QTP may not replay constantly on a lockedmachine

The Quick Test Professional computer is locked or logged off.Quick Test Professional was launched without permission to interact with the desktop.The following registry key which enables you to run tests on a remote computer, even on anincompatible execution environment:HKEY_CURRENT_USERSoftwareMercury InteractiveQuick TestProfessionalMicTestSkipEnvironmentChecks

Set the registry key to 1 to prevent the remote execution checks, and 0 to perform the checks.

system lock during QTP Automation Test Script Execution

21 MAR 2012 1 Comment

by vsprasad2k in Uncategorized

There are few ways to prevent windows to lock the system:

Way1:Download the software Caffeine 1.4 (h.p://download.cnet.com/Caffeine/3000-2094_4-10914397.html)and install on the machine where u run the scripts.

Way 2:Create a .vbs file (with the below mentioned code) and a task in task scheduler

Const DELAY_MINUTES = 10

Wscript.Sleep DELAY_MINUTES * 60000DoCreateObject(“Wscript.Shell”).SendKeys “+”

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

27 of 165 8/12/2014 6:10 PM

Page 28: QTP Challenges 4 Experts _ Just Another WordPress

Wscript.Sleep DELAY_MINUTES * 60000Loop

Way 3:Create a .vbs file (with the below mentioned code) and a task in task scheduler

Const micVoid = 0

Const micByte = 26

Const micLong = 3

Const KEYEVENTF_KEYUP = &H2

Set Extern = CreateObject("Mercury.ExternObj")

extern.Declare micVoid, "keybd_event", "user32", "keybd_event", micByte, micbyte,

miclong, micLong

Extern.Declare micVoid, "Sleep", "kernel32", "Sleep", micLong

While True

extern.keybd_event 0, 0, KEYEVENTF_KEYDOWN, 0

Extern.Sleep 20000

Wend

-********************-*****************-*****************************-*********************************-*****************************We can even run the scripts when the system is locked, but QTP may not replay constantly on a lockedmachine

The Quick Test Professional computer is locked or logged off.Quick Test Professional was launched without permission to interact with the desktop.The following registry key which enables you to run tests on a remote computer, even on anincompatible execution environment:HKEY_CURRENT_USERSoftwareMercury InteractiveQuick TestProfessionalMicTestSkipEnvironmentChecks

Set the registry key to 1 to prevent the remote execution checks, and 0 to perform the checks.

QTP Mercury Device Replay

21 MAR 2012 Leave a comment

by vsprasad2k in challenges, COM DCOM AOM, QTP, QTP Tricks, QTP VBScript Tags: QTP MercuryDeviceReplay

In Order to use the DeviceReplay methods, you need to create DeviceReplay object.

Set objDeviceReplay = CreateObject(“Mercury.DeviceReplay”)

We use SendKeys method to send keyboard input/keystrokes to applications that dont have automationinterface. We can also send more than one keystroke at a time using Sendkeys method. To sendkeystrokes x,y and z, you would send the string argument “xyz”.

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

28 of 165 8/12/2014 6:10 PM

Page 29: QTP Challenges 4 Experts _ Just Another WordPress

Note: You cannot send Print Screen key to an application.

So, the difference between Mercury DeviceReplay and Sendkeys is

SendKeys -> Support only Keyboard OperationsDeviceReplay-> Support Keyboard + Mouse Operations like Drag Drop too.

In addition to that DeviceReplay supports sending multilingual characters and symbols, while sendkeyssupport limited keyboard operations.

The other operational difference is dependency on QTP software.

Mercury.DeviceReplay :- It comes with QTP as a module, so you need QTP on the system and only fromQTP action you can use it.SendKeys :- It could be used in VBS script to simulate keyboard inputs with native windows shellcommands. It has no dependency on QTP as such.

Mercury DeviceReplay is a powerful utility to simulate keyboard input and also for simulating mouseclicks and movements. Under Java Add-in, you can find the DeviceReplay property. At times, Object.Setand Object.Type doesnt help in QTP for some applications. You can use Mercury DeviceReplay to typeNon English symbols and le.ers even without changing the keyboard layout or installing the specialfonts.

Methods

MouseMove x, y {Move the mouse to the screen coordinate (x,y).}1.

MouseClick x, y, bu.on {Move the mouse to the screen coordinate (x,y) and click the bu.on}

(0=left; 1=middle; 2=right).

2.

MouseDblClick x, y, bu.on {Move the mouse to the screen coordinate (x,y) and double-click the

bu.on}(0=left; 1=middle; 2=right).

3.

DragAndDrop x, y, dropx, dropy, bu.on {Drag the mouse from screen coordinate (x,y) to

(dropx,dropy) with the bu.on}(0=left; 1=middle; 2=right) pressed.

4.

PressKey key {Press a key using the ASCII code of the key.}For example, Chr(13), vbCR and

vbTab.

5.

MouseDown x, y, bu.on { Press the mouse bu.on on screen coordinate (x,y).}6.

MouseUp x, y, bu.on {Release the mouse bu.on on screen coordinate (x,y).}7.

KeyDown key {Press a key using the ASCII code of the key.}For example, Chr(13), vbCR

and vbTab.

8.

KeyUp key {Release a key using the ASCII code of the key.}For example, Chr(13),

vbCR and vbTab.

9.

SendString string {Type a string.}10.

QTP Mercury Device Replay vs WScript SendKeys Method

21 MAR 2012 Leave a comment

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

29 of 165 8/12/2014 6:10 PM

Page 30: QTP Challenges 4 Experts _ Just Another WordPress

by vsprasad2k in challenges, COM DCOM AOM, QTP, QTP Tricks, QTP VBScript

In Order to use the DeviceReplay methods, you need to create DeviceReplay object.

Set objDeviceReplay = CreateObject(“Mercury.DeviceReplay”)

We use SendKeys method to send keyboard input/keystrokes to applications that dont have automationinterface. We can also send more than one keystroke at a time using Sendkeys method. To sendkeystrokes x,y and z, you would send the string argument “xyz”.

Note: You cannot send Print Screen key to an application.

So, the difference between Mercury DeviceReplay and Sendkeys is

SendKeys -> Support only Keyboard OperationsDeviceReplay-> Support Keyboard + Mouse Operations like Drag Drop too.

In addition to that DeviceReplay supports sending multilingual characters and symbols, while sendkeyssupport limited keyboard operations.

The other operational difference is dependency on QTP software.

Mercury.DeviceReplay :- It comes with QTP as a module, so you need QTP on the system and only fromQTP action you can use it.SendKeys :- It could be used in VBS script to simulate keyboard inputs with native windows shellcommands. It has no dependency on QTP as such.

Mercury DeviceReplay is a powerful utility to simulate keyboard input and also for simulating mouseclicks and movements. Under Java Add-in, you can find the DeviceReplay property. At times, Object.Setand Object.Type doesnt help in QTP for some applications. You can use Mercury DeviceReplay to typeNon English symbols and le.ers even without changing the keyboard layout or installing the specialfonts.

Out of Mercury DeviceReplay and SendKeys, which one should I use for Automation testing with QTP?

1. Depends on your objective like mouse operations & multilingual testing required.2.In case of normal keyboard operations supported by both, SendKeys is easy to use due to English likesyntax for keyboard input. Whereas for devicereplay you need to define user friendly names/constants(like VK_SHIFT etc) to numeric keycodes.

QTP Dot Net addin seems to have an issue with NET

4.0 applications.

15 MAR 2012 Leave a comment

by vsprasad2k in Uncategorized

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

30 of 165 8/12/2014 6:10 PM

Page 31: QTP Challenges 4 Experts _ Just Another WordPress

Till .NET 3.5 and below, it was working fine. However, objects from .NET 4.0 application is showing avery strange behavior. Most of the objects are ge.ing recognized as “SwfObjects”.

Till .NET 3.5 and below, we could get the hierarchy as:

SwfWindow(“…”).SwfBu.on(“…”)

After moving to .NET 4.0, we are ge.ing hierarchy like this:

Window(“…”).SwfObject(“…”)

Now the question arises

Why SwfWindow objects are being viewed as Window. We have done the installation of .NETframework 4.0 very recently.

The solution / answer goes like this:

The .NET Framework version 4.0 was installed after QuickTest Professional was installed which is thepossible issue for this QTP behavior.

When you desire to work on .NET 4.0, then it’s be.er to firstly install this before the installation ofQuickTest Professional. If .NET 4.0 is installed after QuickTest, then you need to register following two.NET DLL files as per the procedure given below.:

1. If working on a 64 bit operating system, you will be required to install patch QTP_00709.

2. Open a command prompt (Start > Run > type “cmd” > Click “Ok”)

3. Navigate toGlobalAssemblyCacheNet4

4. Run the following two commands:

1. ….binGACRegUtil4x86.exe -i Mercury.QTP.Agent.dll2. ….binGACRegUtil4x86.exe -i Mercury.QTP.WpfAgent.dll

The above mentioned steps should fix this issue.

However, just in case if it doesn’t happen, we would recommend to carryout clean uninstalling of HPQuickTest Professional. 

Object Identification issue with IE8 and IE9 on QTP11.0

15 MAR 2012 Leave a comment

by vsprasad2k in COM DCOM AOM, QTP, QTP Tricks, Uncategorized

Tool: QTP 11.0

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

31 of 165 8/12/2014 6:10 PM

Page 32: QTP Challenges 4 Experts _ Just Another WordPress

OS: Windows 7Browser: IE 9General Issues: Objects are not recognised and IE gets hanged.Solutions: Install patch QTPWEB_00078

Tool: QTP 11.0OS: Windows 7Browser: IE 8

General Issues: Objects are not recognised for Web Application.Solutions:1. Right Click and run QTP as an Administrator and then try recordingor recognizing objects.2. Open QTP, go to Record and Run Se.ings and navigate to the Web taband change the se.ings from a specific browser se.ings to ‘Record onany open browser’ se.ing and then try recording or recognizingobjects.Reason for not working:a. QTP needs Admin level privileges to some of its files/registryoptions to perform its functionality.b. Windows 7 has bought in levels of security, your User ID on yourtest PC might NOT have had all the admin level privileges.c. To do one time se.ing by right clicking on QTP desktop shortcutand select Properties. Navigate to Compatibility Tab and check theoption Run as Administrator.

Tool: QTP 10.0OS: Windows 7Browser: IE 8General Issues: Objects are not recognised.Solutions:1. Install following two patches a. For IE8.0 – qtpweb_00037.exe. You can download it from: h.p://support.openview.hp.com/selfsolve/document/KM743912 (h.p://support.openview.hp.com/selfsolve/document/KM743912) Here is the description of the patch: ======================================================================== HP QuickTest Professional 10.00 Patch QTPWEB_00037 (c) Copyright 2009 Hewle.-Packard Development Company, L.P. ======================================================================== QTPWEB_00037 – Support for Internet Explorer 8 ======================================================================== This patch provides official support for testing Web applicationsin Internet Explorer 8. It includes support for working with Internet Explorer 8 on alloperating systems that QuickTest Professional supports. (For the complete list, see the QuickTest Professional 10.00 Readme.)

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

32 of 165 8/12/2014 6:10 PM

Page 33: QTP Challenges 4 Experts _ Just Another WordPress

b. For Windows 7.0 – qtp_00644.exe.2. Try the below se.ings: a. IE: Select the “Enable 3rd party extensions” option under Tools–> Advanced section in IE b. Open Control Panel, choose User Accounts and Family Safety >>System and Security Se.ings>>Change User Account Controlse.ings>>Set the control to ‘Never notify’ and restart the computer.

Tool: QTP 9.5OS: Windows 7Browser: IE 8

General Issues: IE 8 gets crash.Solutions: Uncheck ‘ActiveX add-in’ when launching QTP 9.5 will workfile with IE 8.Note: Official Support for IE8 is QTP 10.0 with Patch QTPWEB_00037.

QTP Object Identification issue with IE8 and IE9

on QTP11.0

15 MAR 2012 Leave a comment

by vsprasad2k in COM DCOM AOM, QTP, QTP Tricks, Uncategorized

Tool: QTP 11.0OS: Windows 7Browser: IE 9General Issues: Objects are not recognised and IE gets hanged.Solutions: Install patch QTPWEB_00078

Tool: QTP 11.0OS: Windows 7Browser: IE 8

General Issues: Objects are not recognised for Web Application.Solutions:1. Right Click and run QTP as an Administrator and then try recordingor recognizing objects.2. Open QTP, go to Record and Run Se.ings and navigate to the Web taband change the se.ings from a specific browser se.ings to ‘Record onany open browser’ se.ing and then try recording or recognizingobjects.Reason for not working:a. QTP needs Admin level privileges to some of its files/registryoptions to perform its functionality.

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

33 of 165 8/12/2014 6:10 PM

Page 34: QTP Challenges 4 Experts _ Just Another WordPress

b. Windows 7 has bought in levels of security, your User ID on yourtest PC might NOT have had all the admin level privileges.c. To do one time se.ing by right clicking on QTP desktop shortcutand select Properties. Navigate to Compatibility Tab and check theoption Run as Administrator.

Tool: QTP 10.0OS: Windows 7Browser: IE 8General Issues: Objects are not recognised.Solutions:1. Install following two patches a. For IE8.0 – qtpweb_00037.exe. You can download it from: h.p://support.openview.hp.com/selfsolve/document/KM743912 (h.p://support.openview.hp.com/selfsolve/document/KM743912) Here is the description of the patch: ======================================================================== HP QuickTest Professional 10.00 Patch QTPWEB_00037 (c) Copyright 2009 Hewle.-Packard Development Company, L.P. ======================================================================== QTPWEB_00037 – Support for Internet Explorer 8 ======================================================================== This patch provides official support for testing Web applicationsin Internet Explorer 8. It includes support for working with Internet Explorer 8 on alloperating systems that QuickTest Professional supports. (For the complete list, see the QuickTest Professional 10.00 Readme.)

b. For Windows 7.0 – qtp_00644.exe.2. Try the below se.ings: a. IE: Select the “Enable 3rd party extensions” option under Tools–> Advanced section in IE b. Open Control Panel, choose User Accounts and Family Safety >>System and Security Se.ings>>Change User Account Controlse.ings>>Set the control to ‘Never notify’ and restart the computer.

Tool: QTP 9.5OS: Windows 7Browser: IE 8

General Issues: IE 8 gets crash.Solutions: Uncheck ‘ActiveX add-in’ when launching QTP 9.5 will workfile with IE 8.Note: Official Support for IE8 is QTP 10.0 with Patch QTPWEB_00037.

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

34 of 165 8/12/2014 6:10 PM

Page 35: QTP Challenges 4 Experts _ Just Another WordPress

QTP VB Script Class Object Example

16 SEP 2011 Leave a comment

by vsprasad2k in QTP

Class User

‘ declare private class variablePrivate m_userName

‘ declare the propertyPublic Property Get UserNameUserName = m_userNameEnd Property

Public Property Let UserName (strUserName)m_userName = strUserNameEnd Property

‘ declare and define the methodSub DisplayUserNameResponse.Write UserNameEnd Sub

End Class

‘After you have declared your Class, then, as demonstrated below, you may create an instance of thatClass (i.e., object) using Set and New.

‘Use of ClassDim objUserSet objUser = New User

‘ set the UserName propertyobjUser.UserName = “The Guru”

‘ call the DisplayUserName method‘ to print the user nameobjUser.DisplayUserName

Output:“The Guru”

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

35 of 165 8/12/2014 6:10 PM

Page 36: QTP Challenges 4 Experts _ Just Another WordPress

Designing QTP Framework

05 SEP 2011 Leave a comment

by vsprasad2k in challenges, QTP, QTP Tricks, Uncategorized Tags: QTP Framework

What is framework?Automation Framework is a set of guidelines and process you use to manage and optimize yourautomation testing. In simple words, Framework is a way to do the things in fashioned and organizedmanner! Framework is nothing but a concept.

It’s always possible to work without framework but you’ll be doing a lot of rework, everything will behere & there and in most of the time you will end-up with a mess, specially in the large projects.

Framework lets you predefine your automation plans, strategies and how you are going to proceed.

Types of Framework:Framework can be of several types, but here are three main types of frameworks-1. Keyword driven framework2. Data driven framework3. Hybrid frameworkBut this is only theoretical. Practically, there is no ‘Chinese Wall’ between the framework types.In every organization you work, you’ll find that it’s quite different from the other and not only onorganization level, you can feel the difference within different projects!Yess, but most of the them could be mapped with Hybrid type and I like it!! Hybrid framework has no boundaries and open to take benefit of all possible type of frameworks.How to design a framework?I have done a lot of automation projects and designed a lot a frameworks, but seriously guys, I neverused any particular type of framework!

Practically, every application/project has its own expectation. You just need to start your work inorganized way and believe me friends, at the end of the day; your framework will be readyautomatically!! Sounds crazy??You can’t design a complete framework and then start automation! You start automation and frameworkwill start building simultaneously.

The first step of any test automation framework is to do a quick POC with few high priority test cases. Bydoing POC, you will identify the object identification issues, challenges, complexities, required test-dataand limitation you have. Once you are ready with this information, you can proceed with next steps. Onthe basis of above information, you can decide what type of framework is most suitable to you.

But before starting, you must take some time to decide your strategies about..

1. Object Identification2. Test-Data3. Function Library

:)

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

36 of 165 8/12/2014 6:10 PM

Page 37: QTP Challenges 4 Experts _ Just Another WordPress

4. Error Handling5. Controller script6. Documents and Manuals1. Object Identification:How to identify objects i.e. using Object Repository or Descriptive programming or both. As per myunderstanding, dont’t try to stick on one particular. Depending on the application/object types, mixedapproach is most fruitful most of the time.2. Test-Data:How to manage you data? DataTable or Excel or may be flat/csv files.3. Function Library:Be clear about what type of function libraries you are going to use and why.4. Error Handling:Whets your plan to handle errors? Be clear about it.5. Controller script:Design a controller script, which will control all your automation. It should be neat. This helps tounderstand what actually you are going to call.6. Documents and Manuals:Keep all the documentation, user guide/manuals, keywords descriptions here.

Create different folder for the these six things and keep data in folders accordingly.

This was the one part.

Apart from this, from first day of your automation, keep only one thing in your mind.. follow generalgood practices!Here are are few points need to be take care in designing successful framework.

Try to document each and every thing, as much as you can! like comments in script, modification etc.Don’t stick with any particular object identification, use mix of OR and DPWhile using OR, don’t use record and playback, just add object in the object repository and code thescript manually.Follow proper Naming-Conventions for all your variables, functions, files.Define all the variables in you scripts, use Option Explicit.Try to keep you functions small to enhance reusability and portability.Never hard code any data in the scripts, use parametrization.Take regular back-up of your work.

QTP 11.0 Key Features Enhanced

05 SEP 2011 Leave a comment

by vsprasad2k in challenges, QTP, QTP Tricks, Uncategorized

The key enhancements in QTP 11.0 include the following:

1) Support for new Operating Systems:QTP 11.0 has added new support for the following operating systems:

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

37 of 165 8/12/2014 6:10 PM

Page 38: QTP Challenges 4 Experts _ Just Another WordPress

a) Windows 7

b) Windows Vista SP2

c) Windows Server 2008 SP2

d) Windows Server 2008 R2

2) Enhanced Data Management Facility:QTP is now seamlessly integrated with HP ALM (Application Lifecycle Management) software. QualityCenter (HP ALM) test configuration functionality enables us to determine at runtime which data sets touse for our tests.

ALM test configurations enable us to:

a) Unbind our data from our tests

b) Share common data sources across different tests

c) Filter our data to fit our testing needs

d) Increase requirements traceability

e) We store the data for our tests in the Quality Center Test Resources module in the form of data tableresource files.

We can then define multiple test configurations for a test in the Test Plan module. When working withdata-driven QTP tests in HP ALM, each configuration is a QTP test that is set to run with a selected dataresource file and optional data filter se.ings.

One or more specific configurations of the test can be included in a Test Set to cover different parts of arequirement or to cover multiple requirements.

By using Quality Center test configurations, we can create more generic tests and reuse them byassociating a different set of data with each. We can also reuse our data by associating the same datatable file with multiple tests.

3) New Object Spy Functionality:The Object Spy has the following new features:

a) Add an object to a repository: We can now add an object to the object repository directly from theObject Spy.

b) Highlight an object in our application: When we select a test object in the Object Spy Object hierarchytree, we can then select to highlight the object in our application that corresponds to that test object.

c) Copy/paste object properties: We can copy the identification properties and values of a selected testobject in the Object Spy and paste the details into any document. The details are forma.ed inprogrammatic description syntax. This option is especially useful if we want to compare the propertiesand values of two objects in our application or when creating programmatic descriptions.

Additionally, the Object Spy has a new, cleaner look and feel:

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

38 of 165 8/12/2014 6:10 PM

Page 39: QTP Challenges 4 Experts _ Just Another WordPress

4) New Smart Regular Expression list:The Smart Regular Expression list provides syntax hints that make it easier than ever to insert regularexpressions into our test steps. It also enables us to access the Regular Expression Evaluator, which letsus test regular expressions to make sure they suit our needs.

5) New QTP-Service Test integration facility:Now we can test our GUI and UI-Less Application Functionality in One Test. We can use QTP steps tostart testing the GUI elements in our application, then call a Service Test test to validate servicecommunications (standard Web Services, non-SOAP Web Services, such as REST, etc.), and then stepback into our QTP GUI testing, all in a single test run.

The results of the QTP and Service Test steps are displayed in a unified report in the new Run ResultsViewer.

6) New Run Results Viewer:The new Run Results Viewer provides an Executive Summary page with summary data, pie charts andstatistics for both the current and previous runs, a quick link to the previous run results, and more.

The Run Results Viewer displays the results of our run session in a set of panes that we can show, hide,move, dock, and otherwise customize to our needs.

We can install the Run Results Viewer as a standalone installation. This enables us to share the results ofour tests with business analysts and developers who do not work with QTP.

7) New facility to hide the Keyword View:If we prefer working only with the Expert View, we can now use an option in the Options dialog box tohide the Keyword View so that only the Expert View is displayed when we open QTP Professional.

Facility to add Images to Our Run Results:We can now add a Reporter.ReportEvent statement that includes an image file path. This lets us add animage to the run results wherever one is needed.

9) New Log Tracking Functionality:QTP’s new Log Tracking functionality helps us work with developers to pinpoint the root causes ofunexpected behavior in our application.

When we enable log tracking, QTP receives the Java or .NET log framework messages from ourapplication and embeds them in the run results.

We can click a log message in the results to jump to the relevant step in the run results tree, or we canclick a step in the run results tree and view the log message that was generated at the time that theselected step ran. We can also specify that a log message of a particular level (or higher) will fail our test.

After we view the results, we can print or export the log tracking details to a file to show to a developer,or we can provide the developer with the standalone Run Results Viewer installation so that thedeveloper can view and analyze the results directly on his or her own desktop.

10) Automatic Parameterization of Steps:We can instruct QTP to automatically parameterize the steps in our test’s actions at the end of arecording session.

This enables us to create actions that can be used for a variety of different purposes or scenarios by

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

39 of 165 8/12/2014 6:10 PM

Page 40: QTP Challenges 4 Experts _ Just Another WordPress

referencing different sets of data.

We activate this option by selecting the Automatically parameterize steps option in the General tab ofthe Options dialog box. We can set the option to use Global Data Table Parameters or Test Parameters.

When we stop a recording session while this option is selected, QTP replaces the constant values in thetest object operation arguments of our steps with either Data Table parameters or action parameters,based on our selection in the Options dialog box.

QTP performs this automatic parameterization for all relevant steps in any action in our test, in whichwe recorded one or more steps during that recording session.

If we work with HP ALM, and we select the Global Data Table Parameters option, we can map thegenerated parameters to the column names of a data resource and then use different configurations inour test sets.

11) New Visual relation identifiers:We can now use visual relation identifiers to identify application objects based on other objects that arealways near them.

This enables us to create a more reliable identification definition for test objects that are otherwisedifficult to differentiate, and to ensure that the identification remains reliable even if the user interfacedesign changes.

The Visual Relation Identifier Dialog Box provides the interface and tools to help us create and verifyour visual relation identifier definitions.

12) Visual indication of Version Control Status of Tests:If we are working with version control in HP ALM or Quality Center, QTP provides a visual indicationto show us when an asset is checked into or out of a project.

Tests, components, and function libraries that are part of version controlled projects stored in HP ALMor Quality Center display an icon and/or text in the title bar, indicating their version control status.

13) Web 2.0 add-ins support:QTP 11.0 provides Web Add-in Extensibility-based add-ins for ASP .NET Ajax, GWT, Yahoo UI, andDojo Web 2.0 toolkits.

We can use these add-ins just as we would any other add-in. We can also use Web Add-in Extensibilityor Extensibility Accelerator to customize the provided support to match our needs.

We install these add-ins by running the Web 2.0 Toolkit Support Setup from the Add-in Extensibilityand Web 2.0 Toolkits option in the QTP setup window.

The operations supported for each Web 2.0 test object class are a combination of custom operationsdeveloped for that test object class and operations directly inherited from the corresponding (base) WebAdd-in test object class.

14) New capabilities for working with Web-Based objects:Following new testing capabilities are now available handling Web-Based objects.

a) Firefox Testing: Us can now record steps on Mozilla Firefox and use the.Object property to access the

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

40 of 165 8/12/2014 6:10 PM

Page 41: QTP Challenges 4 Experts _ Just Another WordPress

Firefox DOM.

b) XPath, CSS, Identifiers: Us can add the XPath or CSS identifier properties to instruct QTP to identify aWeb object in our application based on its XPath location or CSS definition.

c) Event Identifiers: Us can also now use the a.ribute/* notation in the test object description to identifya Web-based object based on an event associated with that object. For example, us can adda.ribute/onClick as a property in a WebBu.on test object description to identify a bu.on that isassociated with the onClick event.

d) Embed or Run JavaScripts in our Web Pages: We can use the new EmbedScript/EmbedScriptFromFileand RunScript/RunScriptFromFile functions to embed JavaScripts in all loaded browser pages andframes or to run JavaScripts in specific pages. Use these scripts to perform operations on, or retrieve datafrom, the browser pages in our application.

15) New methods for testing Web-based Operations:The following methods are available to test Web-based applications:

a) AnyWebBasedObject.RightClick / MiddleClick

b) Brower.ClearCache

c) Browser.DeleteCookies

16) New LoadFunctionLibrary statement:The new LoadFunctionLibrary statement lets us load a function library when a step runs instead of atthe beginning of a run session. This means, for example, that us can define conditional steps that usefunctions from various function libraries, but load only the required function libraries during a runsession.

17) Improved checkpoints and output value objects management:We can now manage checkpoints and output value objects when comparing, merging, and exportingobject repositories just like any other test object, including filtering, searching, and conflict resolution.

18) Dual Monitor Support:QTP recognizes objects across multiple monitors, meaning that our application display no longer needsto be limited to one screen. Alternatively, we can view QTP on one monitor while the steps run on ourapplication on another monitor.

19) New QTP Asset Upgrade Tool for HP ALM and Quality Center:The QTP Asset Upgrade Tool for HP ALM/Quality Center enables us to upgrade, in a batch, all the QTPassets in an HP ALM or Quality Center 10.00 project from QTP 9.5 or earlier to the current format and toconvert testing document a.achments to the resources and dependencies model.

The QTP Asset Upgrade Tool for HP ALM/Quality Center also enables us to upgrade our tests to use thenew test configurations feature. If our tests contain data table parameters that are stored in the Globalsheet of a QTP data table, this tool copies those data table parameters to our HP ALM or Quality Centerproject, enabling us to start working with HP ALM test configurations.

20) Test execution in minimized remote desktop protocol session:We can now run QTP in a minimized RDP (remote desktop protocol) session in an RDP 6.0 or later client

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

41 of 165 8/12/2014 6:10 PM

Page 42: QTP Challenges 4 Experts _ Just Another WordPress

by se.ing a registry value on the remote computer.

21) Improved Web Add-in Extensibility:We can now develop browser-independent Web Add-in Extensibility support sets that support testingcustom controls on both Internet Explorer and Firefox, and on different versions of these browsers.

We can introduce external JavaScript libraries in our Web Add-in Extensibility support sets, enabling usto call their functions from within the JavaScript functions we develop to support custom controls.

QTP’s performance when learning, spying, and running steps on controls supported by Web Add-inExtensibility is improved.

22) Improved Business Process Testing:QTP 11.0 provides the following enhancements for business process testing when working with HPALM:

# Improved performance.

# Application areas are now stored in the HP ALM Test Resources module as resources.

This enables us to apply version control to an application area, view at a glance which components areusing a specific application area, see which resource files are associated with a particular applicationarea, share our application areas with other projects, and so on.

# Local system monitoring is now supported for component runs.

# All component parameters in HP ALM are now inserted as string value types. From HP ALM, we canuse options to encrypt these parameter values or to apply dynamic date values.

23) New QTP-Service Test integration Facility:The new QTP-Service Test integration enables us to test across the GUI and non-GUI layers of ourapplication.

We can use QTP steps to start testing the GUI elements in our application, then call a Service Test tovalidate service communications (standard Web Services, non-SOAP Web Services, such as REST, etc.),and then step back into our QTP GUI testing, all in a single test run.

The results of the QTP and Service Test steps are displayed in a unified report in the new Run ResultsViewer.

24) New Extensibility Accelerator for Functional Testing:

The new Extensibility Accelerator for Functional Testing is a Visual Studio-like IDE that facilitates thedesign, development, and deployment of Web Add-in Extensibility support.

It provides a user interface and special tools that help us define new test object classes, map those testobject classes to the controls in our application, and teach QTP how to identify the controls, performoperations on the controls and retrieve their properties.

We install the Extensibility Accelerator from the Add-in Extensibility and Web 2.0 Toolkits option in theQTP Professional setup window.

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

42 of 165 8/12/2014 6:10 PM

Page 43: QTP Challenges 4 Experts _ Just Another WordPress

QTP Framework Designing

05 SEP 2011 Leave a comment

by vsprasad2k in challenges, QTP, QTP Tricks, Uncategorized

What is framework?Automation Framework is a set of guidelines and process you use to manage and optimize yourautomation testing. In simple words, Framework is a way to do the things in fashioned and organizedmanner! Framework is nothing but a concept.

It’s always possible to work without framework but you’ll be doing a lot of rework, everything will behere & there and in most of the time you will end-up with a mess, specially in the large projects.

Framework lets you predefine your automation plans, strategies and how you are going to proceed.

Types of Framework:Framework can be of several types, but here are three main types of frameworks-1. Keyword driven framework2. Data driven framework3. Hybrid frameworkBut this is only theoretical. Practically, there is no ‘Chinese Wall’ between the framework types.In every organization you work, you’ll find that it’s quite different from the other and not only onorganization level, you can feel the difference within different projects!Yess, but most of the them could be mapped with Hybrid type and I like it!! Hybrid framework has no boundaries and open to take benefit of all possible type of frameworks.How to design a framework?I have done a lot of automation projects and designed a lot a frameworks, but seriously guys, I neverused any particular type of framework!

Practically, every application/project has its own expectation. You just need to start your work inorganized way and believe me friends, at the end of the day; your framework will be readyautomatically!! Sounds crazy??You can’t design a complete framework and then start automation! You start automation and frameworkwill start building simultaneously.

The first step of any test automation framework is to do a quick POC with few high priority test cases. Bydoing POC, you will identify the object identification issues, challenges, complexities, required test-dataand limitation you have. Once you are ready with this information, you can proceed with next steps. Onthe basis of above information, you can decide what type of framework is most suitable to you.

But before starting, you must take some time to decide your strategies about..

1. Object Identification2. Test-Data3. Function Library

:)

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

43 of 165 8/12/2014 6:10 PM

Page 44: QTP Challenges 4 Experts _ Just Another WordPress

4. Error Handling5. Controller script6. Documents and Manuals1. Object Identification:How to identify objects i.e. using Object Repository or Descriptive programming or both. As per myunderstanding, dont’t try to stick on one particular. Depending on the application/object types, mixedapproach is most fruitful most of the time.2. Test-Data:How to manage you data? DataTable or Excel or may be flat/csv files.3. Function Library:Be clear about what type of function libraries you are going to use and why.4. Error Handling:Whets your plan to handle errors? Be clear about it.5. Controller script:Design a controller script, which will control all your automation. It should be neat. This helps tounderstand what actually you are going to call.6. Documents and Manuals:Keep all the documentation, user guide/manuals, keywords descriptions here.

Create different folder for the these six things and keep data in folders accordingly.

This was the one part.

Apart from this, from first day of your automation, keep only one thing in your mind.. follow generalgood practices!Here are are few points need to be take care in designing successful framework.

Try to document each and every thing, as much as you can! like comments in script, modification etc.Don’t stick with any particular object identification, use mix of OR and DPWhile using OR, don’t use record and playback, just add object in the object repository and code thescript manually.Follow proper Naming-Conventions for all your variables, functions, files.Define all the variables in you scripts, use Option Explicit.Try to keep you functions small to enhance reusability and portability.Never hard code any data in the scripts, use parametrization.Take regular back-up of your work.

Problems with QTP 11 Installation

05 SEP 2011 Leave a comment

by vsprasad2k in challenges, QTP, QTP Tricks, Uncategorized

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

44 of 165 8/12/2014 6:10 PM

Page 45: QTP Challenges 4 Experts _ Just Another WordPress

Notes and Limitations

This section includes the following:

Before You Install

Supplemental Information

Before You Install

This section includes information that is important for you to know before you install QuickTest.

You cannot install QuickTest when a McAfee Anti-Virus application is running.

Workaround: Disable the antivirus application during the QuickTest installation process.

QuickTest Professional supports the Sentinel RMS License Manager version 8.3.0 as its concurrentlicense server. Earlier versions of the concurrent license server are not supported.

QuickTest does not support Windows user names with non-English le.ers. If you log in to Windowsusing a user name (with administrative privileges) that contains non-English characters and theninstall QuickTest, the installation may complete successfully, but you may not be able to openQuickTest or it may not behave correctly.

The path in which installation files for QuickTest are located, and the path in which QuickTest isinstalled, can contain only English characters.

When upgrading to QuickTest 11.00 from a QuickTest 9.5 or 10.00 installation on which a LanguagePack (localized version of QuickTest) was previously installed, you may get an error message whenopening QuickTest after the upgrade.

Workaround: Repair the installation:

In the Control Panel, select Add/Remove Programs and select the HP QuickTest Professional entry.

Click the Change bu.on.

In the installation wizard that opens, choose the Repair option and follow the on-screen instructions.

If you install QuickTest 11.00 while the QTPNET_00015 patch (a QuickTest 10.00 patch) is installedon your computer, QuickTest may behave unexpectedly.

Workaround:

Open the Add/Remove Programs dialog box from the Control Panel.

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

45 of 165 8/12/2014 6:10 PM

Page 46: QTP Challenges 4 Experts _ Just Another WordPress

Display the installed patches by selecting the Show updates check box (or click the View InstalledUpdates bu.on, depending on your operating system version.)

Locate HP QuickTest Professional in the list and check whether QTPNET_00015 for HP QuickTestProfessional 10.00 QFE is listed as an installed update.

If it is installed, click Remove to uninstall this patch before you install QuickTest 11.00.

If you want to work with .NET 4.0, it is best to install it before you install QuickTest. If you install.NET 4.0 after you install QuickTest, you must manually register two .NET DLLs as follows:

In <QuickTest installation folder>GlobalAssemblyCacheNet4, execute the following commands:

….binGACRegUtil4x86.exe -i Mercury.QTP.Agent.dll

….binGACRegUtil4x86.exe -i Mercury.QTP.WpfAgent.dll

In Windows XP and Windows 2003, if you install the Oracle Add-in, the Windows Remote ShellService (rshsvc.exe) may fail and display an error message every time you restart the computer. Thisoccurs only if the Remote Shell Service is configured to run automatically.

Supplemental Information

Use the information in this section as a supplement to the product documentation.

Additional troubleshooting information, guidelines, and feature-specific limitations are described in therelevant locations of the installation and product documentation. Make sure you are aware of thoseissues when working with the relevant features.

This section includes the following:

Installation

Operating Systems

General

Web Add-in

Silverlight Add-in

Quality Center and Business Process Testing

Documentation

Internationalization

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

46 of 165 8/12/2014 6:10 PM

Page 47: QTP Challenges 4 Experts _ Just Another WordPress

Installation

When you install a new QuickTest 11.00 installation and you specify a single concurrent licenseserver in the License Wizard, QuickTest now automatically specifies the server in an LSFORCEHOSTenvironment variable, to optimize performance. However if you perform an upgrade from QuickTest10.00, and you already had an LSHOST variable defined, the upgrade installation does not changethe se.ing to LSFORCEHOST.

Workaround: If desired, set the LSFORCEHOST variable manually, as described in the HP FunctionalTesting Concurrent License Server Installation Guide.

If you manually set an LSHOST environment variable to a particular server (or upgrade from aprevious version of QuickTest where the LSHOST variable was set), QuickTest sometimes gets itslicense from another server, even when the specified server has the required licenses available.

Workaround: To ensure that a specific server will be used, specify an LSFORCEHOST environmentvariable instead.

Operating Systems

If you work with QuickTest on a Windows 7 operating system with User Account Control (UAC) turnedon, and you open a test from a protected location (such as Program Files), it is opened in read-onlymode and a message is displayed that you do not have permissions to open it in read-write mode.

General

When you save a test using the Save Test with Resources option, it also saves any tests containingcalled external actions. However, to preserve space, these called tests contain only the called actions,and not all of the actions from the original test. Therefore, you cannot open these called tests inQuickTest from the local copy.

Workaround: If you need to have full access to the called tests as well as the main test that you saveusing the Save Test with Resources option, then you must manually save all required tests locally andthen manually edit all references to the relevant actions from the main test to the actions it calls.

Web Add-in

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

47 of 165 8/12/2014 6:10 PM

Page 48: QTP Challenges 4 Experts _ Just Another WordPress

The If Handler option in the Web Event Recording Configuration dialog box works on MozillaFirefox browsers only if the handler is assigned as an a.ribute (for example, <A onclick = “somecode”/>) and not if it is assigned as a property (for example, aObj.onclick = function() {some code})

Silverlight Add-in

When Silverlight applications are opened in two tabs sequentially (without QuickTest performingany operations on the first one before the second opens), QTP will use a custom server to supportcontrols only in the first application with which you interact. The same is true when two tabs arerefreshed sequentially.

Workaround: Perform an operation (for example, use the Object Spy) with the first tabopened/refreshed before opening/refreshing the second one.

If a Web page contains a Silverlight application that is windowless and is scrolled out of view whenthe page opens the first time, QuickTest will not be able to make this application visible. (Forexample, in this scenario, QuickTest will not be able to perform an SlvWindow.MakeVisible step).

Quality Center and Business Process Testing

When comparing two baselines, if the only change in a resource is its association to a test orcomponent, the Asset Comparison Tool does not indicate any change in the resource even thoughHP ALM or Quality Center may indicate that the resource is Modified.

If an HP ALM or Quality Center user manually changes the status of a test instance run, HPALM/Quality Center creates something called fast run results to record the change of the test status.The fast run results are not valid QuickTest run results files. However, when you try to select resultsto open or delete in the Run Results Viewer or Run Results Deletion tool, the fast run results areavailable in the list.

After you run a component locally in QuickTest, you cannot use the Jump to Step in QuickTestoption from the Run Results Viewer.

You cannot perform a remote execution of a business process test on a Windows 2008 R2 QuickTestcomputer.

Documentation

The QuickTest Help Index tab contains only reference items, such as objects, methods, properties,

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

48 of 165 8/12/2014 6:10 PM

Page 49: QTP Challenges 4 Experts _ Just Another WordPress

and functions. It does not contain any entries from the user guides.

To search for information from all the documents in the QuickTest Documentation Library, use theSearch tab.

On some operating systems or after installing certain Windows service packs or updates, you maynot be able to view the content of some Help files.

Workaround:

Right-click the CHM file in <QTP installation folder)help, and click Properties.

In the dialog box that opens, click Unblock.

For details, see h.p://support.microsoft.com/kb/902225 (h.p://support.microsoft.com/kb/902225)

Internationalization

If you are working with a QuickTest User Interface Pack, install it before running QuickTest for thefirst time, if possible.

If you install a QuickTest User Interface Pack after running QuickTest, the following items may remainin English after installing the User Interface Pack:

Menus and toolbars in the Object Repository window (in QuickTest or in the Object RepositoryManager)

The Find dialog box in the Expert View

Workaround: Close QuickTest and delete the folder: %APPDATA%HPQuickTest Professional(For example, C:Documents and Se%ings<username>Application DataHPQuickTest Professional).

When working on an operating system using a Spanish locale, you may get an assertion errormessage at the beginning of the QuickTest installation.

Workaround: Modify the sLanguage registry key value as follows:

In the Start > Run dialog box, type: regedit.

Go to the registry path: HKEY_CURRENT_USERControl PanelInternational

Change the sLanguage value from ES to ESN

If the above steps do not solve the problem, restart your computer and try again.

Run the QuickTest installation again.

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

49 of 165 8/12/2014 6:10 PM

Page 50: QTP Challenges 4 Experts _ Just Another WordPress

Selecting the View Sample Snapshot option in the QuickTest Asset Comparison Tool opens awindow containing a sample image of the selected element in QuickTest. The image displays theEnglish user interface.

The Add-in Extensibility SDKs are not localized.

Working with Windows Registry’s Using

DontNetFactory object

05 SEP 2011 Leave a comment

by vsprasad2k in challenges, QTP, QTP Tricks, QTP VBScript, Uncategorized

‘Creating the .Net Computer object

Set obj = DotNetFactory(“Microsoft.VisualBasic.Devices.Computer”,”Microsoft.VisualBasic”)

Set Registry = obj.Registry

IEPathKey =“HKEY_LOCAL_MACHINESOFTWAREMICROSOFTWINDOWSCURRENTVERSIONAPPPATHSIEXPLORE.EXE”

‘Display the path of IE from Registry

Msgbox “Internet Explorer Location – ” & Registry.GetValue(IEPathKey,””,””)

Registry.SetValue “HKEY_CURRENT_USERSoftwareMyApp”, “Path”, “C:Test.exe”

How to Ping an IP Address using DoNetFactory

05 SEP 2011 Leave a comment

by vsprasad2k in challenges, QTP, QTP Tricks, QTP VBScript, Uncategorized

‘Creating the .Net Computer object

Set obj = DotNetFactory(“Microsoft.VisualBasic.Devices.Computer”,”Microsoft.VisualBasic”)

blnPingSuccess= ob.Ping(“127.0.0.1″)

Msgbox fnCheckResponse(“blnPingSuccess”,”Ping was Successful”,”Ping ws Unsuccessful”)

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

50 of 165 8/12/2014 6:10 PM

Page 51: QTP Challenges 4 Experts _ Just Another WordPress

‘Wait for 5 Secs

blnPingSuccess = obj.Ping(“127.0.0.1″,5000)

Set obj = Nothing

Public Function fnCheckResponse(condition, string1, string2)

If Condition Then

fnCheckResponse =string1

Else

fnCheckResponse =string2

End If

End Function

QTP Working with Windows Registry Using

DontNetFactory object

05 SEP 2011 Leave a comment

by vsprasad2k in challenges, QTP, QTP Tricks, QTP VBScript, Uncategorized

‘Creating the .Net Computer object

Set obj = DotNetFactory(“Microsoft.VisualBasic.Devices.Computer”,”Microsoft.VisualBasic”)

Set Registry = obj.Registry

IEPathKey = “HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION\APPPATHS\IEXPLORE.EXE”

‘Display the path of IE from Registry

Msgbox “Internet Explorer Location – ” & Registry.GetValue(IEPathKey,””,””)

Registry.SetValue “HKEY_CURRENT_USER\Software\MyApp”, “Path”, “C:\Test.exe”

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

51 of 165 8/12/2014 6:10 PM

Page 52: QTP Challenges 4 Experts _ Just Another WordPress

Visual Relation Identifier in QTP 11.0

15 AUG 2011 Leave a comment

by vsprasad2k in challenges, QTP, QTP Tricks

Visual Relation Identifiers will provide a method to identify a object based on the neighbour objectidentification properties. This works to the power while working with webtable class in web basedapplications. We can define the visual relationship identifiers, which can be set in both local and sharedobject repositories.

How Visual Relation Identifiers Work:

If you want to identify and click on a class ‘WebCheckBox’ present in the same row where the mainidentifier ‘employee ID’ WebElement is present. Add the employee ID WebElement to QTP objectrepository, and add one ‘WebCheckBox’ class object without any identifications properties. Click on thevisual relation identifiers bu.on and provide and select relation details (left and check the horizontalcheckbox and click on ‘OK’ bu.on. Now drag the ‘WebElement’ class into QTP IDE and execute thestatement, it will check the desired check beside that expected ‘Employee ID’.

It identifies the object based the related object we map to the VRI object, we can specify the 3 differentrelational details to the both objects based on its position: Left/Right (or) Above/Below (or) Closest to X,Y/both axis.

Video:

h.p://h20621.www2.hp.com/video-gallery/us/en/c3505a334636ac1caa92798d2ab15c85c60b0ca4/r/video(h.p://h20621.www2.hp.com/video-gallery/us/en/c3505a334636ac1caa92798d2ab15c85c60b0ca4/r/video)

Using Descriptive Progamming:

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

52 of 165 8/12/2014 6:10 PM

Page 53: QTP Challenges 4 Experts _ Just Another WordPress

Set rc = VisualRelations.Create

Set relation =

relation.relatedobjectpath = "Bro

relation.relativeposition = micRe

relation.setargument micrelinline

Set des=Description.Create

des.Add "micclass","WebCheckBox"

des.Add "visual relations",rc

Browser("micclass:=Browser").Page

Set relation = Nothing

Set rc=Nothing

QTP 11 Visual Relation Identifier

15 AUG 2011 3 Comments

by vsprasad2k in challenges, QTP, QTP Tricks

Visual Relation Identifiers will provide a method to identify a object based on the neighbour objectidentification properties. This works to the power while working with webtable class in web basedapplications. We can define the visual relationship identifiers, which can be set in both local and sharedobject repositories.

How Visual Relation Identifiers Work:

If you want to identify and click on a class ‘WebCheckBox’ present in the same row where the mainidentifier ‘employee ID’ WebElement is present. Add the employee ID WebElement to QTP objectrepository, and add one ‘WebCheckBox’ class object without any identifications properties. Click on thevisual relation identifiers bu.on and provide and select relation details (left and check the horizontalcheckbox and click on ‘OK’ bu.on. Now drag the ‘WebElement’ class into QTP IDE and execute thestatement, it will check the desired check beside that expected ‘Employee ID’.

It identifies the object based the related object we map to the VRI object, we can specify the 3 differentrelational details to the both objects based on its position: Left/Right (or) Above/Below (or) Closest to X,Y/both axis.

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

53 of 165 8/12/2014 6:10 PM

Page 54: QTP Challenges 4 Experts _ Just Another WordPress

This identification property helps in solving most of the object identification issues in webtable usingQTP and of not demanding much technical knowledge pushing automation to next level.

QTP – VB Script Interview Sample Questions and Answers

16 JUL 2011 Leave a comment

by vsprasad2k in QTP VBScript Tags: VB Script Samples

‘1 Print Hello WorldPrint “Hello World”‘**************************************************************************‘**************************************************************************‘2 Find whether given number is a odd numberDim oNumber

oNumber=4If oNumber mod 2 <>0 ThenPrint “The Number “& oNumber &” is an Odd Number”elsePrint “The Number “& oNumber &” is not an Odd Number”End If‘**************************************************************************‘**************************************************************************‘3 Print odd numbers between given range of numbers

Dim RangeStartDim RangeEndDim iCounterRangeStart=10RangeEnd=20

For iCounter=RangeStart to RangeEnd

If iCounter mod 2 <>0 ThenPrint oNumberEnd If

Next

‘**************************************************************************‘**************************************************************************‘4 Find the factorial of a given numberDim oNumberDim iCounterDim fValue

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

54 of 165 8/12/2014 6:10 PM

Page 55: QTP Challenges 4 Experts _ Just Another WordPress

oNumber=6fValue=1

For iCounter=oNumber to 1 step-1fValue=fValue*iCounterNextprint fValue

‘**************************************************************************‘**************************************************************************‘5 Find the factors of a given numberDim oNumberDim iCounter

oNumber=10

For iCounter=1 to oNumber/2If oNumber mod iCounter=0 Thenprint iCounterEnd IfNextprint oNumber‘**************************************************************************‘**************************************************************************‘6 Print prime numbers between given range of numbers

Dim RangeStartDim RangeEndDim iCounterRangeStart=1RangeEnd=30

For iCounter=RangeStart to RangeEnd

For iCount=2 to round(iCounter/2)If iCounter mod iCount=0 ThenExit forEnd IfNext

If iCount=round(iCounter/2)+1 or iCounter=1 Thenprint iCounterEnd IfNext

‘**************************************************************************‘**************************************************************************‘7 Swap 2 numbers with out a temporary variable

Dim oNum1Dim oNum2

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

55 of 165 8/12/2014 6:10 PM

Page 56: QTP Challenges 4 Experts _ Just Another WordPress

oNum1=1055oNum2=155

oNum1=oNum1-oNum2oNum2=oNum1+oNum2oNum1=oNum2-oNum1print oNum1print oNum2‘**************************************************************************‘**************************************************************************‘8 Write a program to Perform specified Arithmetic Operation on two given numbersDim oNum1Dim oNum2Dim oValue

oNum1=10oNum2=20

OperationtoPerform=”div”

Select Case lcase(OperationtoPerform)

Case “add”oValue=oNum1+oNum2Case “sub”oValue=oNum1-oNum2Case “mul”oValue=oNum1*oNum2Case “div”oValue=oNum1/ oNum2End Selectprint oValue‘**************************************************************************‘**************************************************************************‘9 Find the length of a given stringDim oStrDim oLengthoStr=”sudhakar”oLength=len(oStr)print oLength‘**************************************************************************‘**************************************************************************’10 Reverse given stringDim oStrDim oLengthDim oCharDim iCounter

oStr=”sudhakar”oLength=len(oStr)

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

56 of 165 8/12/2014 6:10 PM

Page 57: QTP Challenges 4 Experts _ Just Another WordPress

For iCounter=oLength to 1 step-1oChar=oChar&mid(oStr,iCounter,1)Nextprint oChar‘**************************************************************************‘**************************************************************************’11 Find how many alpha characters present in a string.Dim oStrDim oLengthDim oCharDim iCounter

oStr=”su1h2kar”oLength=len(oStr)

oAlphacounter=0

For iCounter=1 to oLength

If not isnumeric (mid(oStr,iCounter,1)) thenoAlphacounter=oAlphacounter+1End if

Nextprint oAlphacounter

‘**************************************************************************‘**************************************************************************’12 Find occurrences of a specific character in a string

Dim oStrDim oArrayDim ochroStr=”sudhakar”ochr=”a”

oArray=split(oStr,ochr)print ubound(oArray)‘**************************************************************************‘**************************************************************************’13 Replace space with tab in between the words of a string.

Dim oStrDim fStr

oStr=”Quick Test Professional”

fStr=replace(oStr,” “,vbtab)print fStr

‘**************************************************************************

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

57 of 165 8/12/2014 6:10 PM

Page 58: QTP Challenges 4 Experts _ Just Another WordPress

‘**************************************************************************’14 Write a program to return ASCII value of a given character

Dim ochrDim aVal

ochr=”A”

aVal=asc(ochr)print aVal

‘**************************************************************************‘**************************************************************************’15 Write a program to return character corresponding to the given ASCII value

Dim ochrDim aVal

aVal=65

oChr=chr(aVal)print oChr

‘**************************************************************************‘**************************************************************************’16 Convert string to Upper CaseDim oStrDim uStr

oStr=”QuickTest Professional”

uStr=ucase(oStr)print uStr‘**************************************************************************‘**************************************************************************’17 Convert string to lower caseDim oStrDim lStr

oStr=”QuickTest Professional”lStr=lcase(oStr)print lStr

‘**************************************************************************‘**************************************************************************’18 Write a program to Replace a word in a string with another word

Dim oStrDim oWord1Dim oWord2Dim fStr

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

58 of 165 8/12/2014 6:10 PM

Page 59: QTP Challenges 4 Experts _ Just Another WordPress

oStr=”Mercury Quick Test Professional”oWord1=”Mercury”oWord2=”HP”

fStr=replace(oStr,oWord1,oWord2)print fStr

‘**************************************************************************‘**************************************************************************’19 Check whether the string is a POLYNDROM

Dim oStr

oStr=”bob”fStr=StrReverse(oStr)If oStr=fStr ThenPrint “The Given String “&oStr&” is a Palindrome”elsePrint “The Given String “&oStr&” is not a Palindrome”End If‘**************************************************************************‘**************************************************************************’20 Verify whether given two strings are equalDim oStr1Dim ostr2

oStr1=”qtp”oStr2=”qtp”If oStr1=oStr2 ThenPrint “The Given Strings are Equal”elsePrint “The Given Strings are not Equal”End If‘**************************************************************************‘**************************************************************************’21 Print all values from an ArrayDim oArrayDim oCounteroArray=array(1,2,3,4,”qtp”,”Testing”)

For oCounter=lbound(oArray) to ubound(oArray)print oArray(oCounter)Next

‘**************************************************************************‘**************************************************************************’22 Sort Array elementsDim oArrayDim oCounter1Dim oCounter2

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

59 of 165 8/12/2014 6:10 PM

Page 60: QTP Challenges 4 Experts _ Just Another WordPress

Dim tmp

oArray=array(8,3,4,2,7,1,6,9,5,0)

For oCounter1=lbound(oArray) to ubound(oArray)

For oCounter2=lbound(oArray) to ubound(oArray)-1

If oArray(oCounter2)>oArray(oCounter2+1) Thentmp=oArray(oCounter2)oArray(oCounter2)=oArray(oCounter2+1)oArray(oCounter2+1)=tmpEnd If

Next

Next

For oCounter1=lbound(oArray) to ubound(oArray)print oArray(oCounter1)Next

‘**************************************************************************‘**************************************************************************’23 Add two 2X2 matricesDim oArray1(1,1)Dim oArray2(1,1)Dim tArray(1,1)

oArray1(0,0)=8oArray1(0,1)=9oArray1(1,0)=5oArray1(1,1)=-1

oArray2(0,0)=-2oArray2(0,1)=3oArray2(1,0)=4oArray2(1,1)=0

tArray(0,0)=oArray1(0,0)+ oArray2(0,0)tArray(0,1)=oArray1(0,1)+oArray2(0,1)tArray(1,0)=oArray1(1,0)+oArray2(1,0)tArray(1,1)=oArray1(1,1)+oArray2(1,1)‘**************************************************************************‘**************************************************************************

’24 Multiply Two Matrices of size 2X2

Dim oArray1(1,1)Dim oArray2(1,1)Dim tArray(1,1)

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

60 of 165 8/12/2014 6:10 PM

Page 61: QTP Challenges 4 Experts _ Just Another WordPress

oArray1(0,0)=8oArray1(0,1)=9oArray1(1,0)=5oArray1(1,1)=-1

oArray2(0,0)=-2oArray2(0,1)=3oArray2(1,0)=4oArray2(1,1)=0

tArray(0,0)=oArray1(0,0)* oArray2(0,0)+ oArray1(0,1)* oArray2(1,0)tArray(0,1)=oArray1(0,0)* oArray2(0,1)+ oArray1(0,1)* oArray2(1,1)tArray(1,0)=oArray1(1,0)* oArray2(0,0)+ oArray1(1,1)* oArray2(1,0)tArray(1,1)=oArray1(1,0)* oArray2(0,1)+ oArray1(1,1)* oArray2(1,1)

‘**************************************************************************‘**************************************************************************’25 Convert a String in to an array

Dim oStrDim iCounteroStr=”Quick Test Professional”StrArray=split(oStr)

For iCounter=0 to ubound(StrArray)print StrArray(iCounter)Next

‘**************************************************************************‘**************************************************************************’26 Convert a String in to an array using ‘i‘ as delimiter

Dim oStrDim iCounteroStr=”Quick Test Professional”StrArray=split(oStr,”i”)

For iCounter=0 to ubound(StrArray)print StrArray(iCounter)Next

‘**************************************************************************‘**************************************************************************’27 Find number of words in string

Dim oStrDim iCounteroStr=”Quick Test Professional”StrArray=split(oStr,” “)print “Theere are “&ubound(StrArray)+1&” words in the string”

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

61 of 165 8/12/2014 6:10 PM

Page 62: QTP Challenges 4 Experts _ Just Another WordPress

‘**************************************************************************‘**************************************************************************’28 Write a program to reverse the words of a given string.

Dim oStrDim iCounteroStr=”Quick Test Professional”StrArray=split(oStr,” “)

For iCounter=0 to ubound(StrArray)print strreverse(StrArray(iCounter))Next

‘**************************************************************************‘**************************************************************************’29 Print the data as a Pascal triangle‘The formulae for pascal triangle is nCr=n!/(n-r)!*r!

Dim PascalTriangleRowsDim nCrDim NumCountDim RowCount

PascalTriangleRows = 10For NumCount = 0 To PascalTriangleRowstoPrint= Space(PascalTriangleRows – NumCount)For RowCount = 0 To NumCountIf (NumCount = RowCount) ThennCr = 1ElsenCr = Factorial(NumCount) / (Factorial(NumCount – RowCount) * Factorial(RowCount))End IftoPrint=toPrint&nCr&” “Nextprint toPrintNext

Function Factorial(num)Dim iCounterFactorial = 1If num <> 0 ThenFor iCounter = 2 To numFactorial = Factorial * iCounterNextEnd IfEnd Function‘**************************************************************************‘**************************************************************************’30 Join elements of an array as a string

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

62 of 165 8/12/2014 6:10 PM

Page 63: QTP Challenges 4 Experts _ Just Another WordPress

Dim oStrDim iCounteroStr=”Quick Test Professional”StrArray=split(oStr,” “)

print join(StrArray,” “)

‘**************************************************************************‘**************************************************************************’31 Trim a given string from both sides

Dim oStr

oStr=” QTP “print trim(oStr)

‘**************************************************************************‘**************************************************************************’32 Write a program to insert 100values and to delete 50 values from an array

Dim oArray()Dim iCounter

ReDim oArray(100)

For iCounter=0 to ubound(oArray)oArray(iCounter)=iCounter‘Print total 100 Valuesprint(oArray(iCounter))Nextprint “******************************”print “******************************”ReDim preserve oArray(50)

For iCounter=0 to ubound(oArray)‘Print Values after deleting 50 valuesprint(oArray(iCounter))Next‘**************************************************************************‘**************************************************************************’33 Write a program to force the declaration of variables

Option explicit ‘ this keyword will enforce us to declare variables

Dim xx=10‘Here we get an error because i have not declared y,zy=20z=x+yprint z‘**************************************************************************

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

63 of 165 8/12/2014 6:10 PM

Page 64: QTP Challenges 4 Experts _ Just Another WordPress

‘**************************************************************************’34 Write a program to raise an error and print the error number.

On Error Resume NextErr.Raise 6 ‘ Raise an overflow error.print (“Error # ” & CStr(Err.Number) & ” ” & Err.Description)

‘**************************************************************************‘**************************************************************************’35 Finding whether a variable is an Array

Dim oArray()

if isarray(oArray) thenprint “the given variable is an array”elseprint “the given variable is not an array”End if‘**************************************************************************‘**************************************************************************’36 Write a program to list the Timezone offset from GMTDim objWMIServiceDim colTimeZoneDim objTimeZone

Set objWMIService = GetObject(“winmgmts:” & “{impersonationLevel=impersonate}!\.rootcimv2″)Set colTimeZone = objWMIService.ExecQuery(“Select * from Win32_TimeZone”)

For Each objTimeZone in colTimeZoneprint “Offset: “& objTimeZone.BiasNext‘**************************************************************************‘**************************************************************************’37 Retrieving Time Zone Information for a ComputerDim objWMIServiceDim colTimeZoneDim objTimeZone

Set objWMIService = GetObject(“winmgmts:” & “{impersonationLevel=impersonate}!\.rootcimv2″)Set colTimeZone = objWMIService.ExecQuery(“Select * from Win32_TimeZone”)

For Each objItem in colTimeZone

print “Bias: ” & objItem.Biasprint “Caption: ” & objItem.Captionprint “Daylight Bias: ” & objItem.DaylightBiasprint “Daylight Day: ” & objItem.DaylightDayprint “Daylight Day Of Week: ” & objItem.DaylightDayOfWeekprint “Daylight Hour: ” & objItem.DaylightHourprint “Daylight Millisecond: ” & objItem.DaylightMillisecond

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

64 of 165 8/12/2014 6:10 PM

Page 65: QTP Challenges 4 Experts _ Just Another WordPress

print “Daylight Minute: ” & objItem.DaylightMinuteprint “Daylight Month: ” & objItem.DaylightMonthprint “Daylight Name: ” & objItem.DaylightNameprint “Daylight Second: ” & objItem.DaylightSecondprint “Daylight Year: ” & objItem.DaylightYearprint “Description: ” & objItem.Descriptionprint “Se.ing ID: ” & objItem.Se.ingIDprint “Standard Bias: ” & objItem.StandardBiasprint “Standard Day: ” & objItem.StandardDayprint “Standard Day Of Week: ” & objItem.StandardDayOfWeekprint “Standard Hour: ” & objItem.StandardHourprint “Standard Millisecond: ” & objItem.StandardMillisecondprint “Standard Minute: ” & objItem.StandardMinuteprint “Standard Month: ” & objItem.StandardMonthprint “Standard Name: ” & objItem.StandardNameprint “Standard Second: ” & objItem.StandardSecondprint “Standard Year: ” & objItem.StandardYear

Next

‘**************************************************************************‘**************************************************************************’38 Write a program to Convert an expression to a dateDim StrDateDim actualDateDim StrTimeDim actualTime

StrDate = “October 19, 1962″ ‘ Define date.actualDate = CDate(StrDate) ‘ Convert to Date data type.print actualDateStrTime = “4:35:47 PM” ‘ Define time.actualTime = CDate(StrTime) ‘ Convert to Date data type.print actualTime

‘**************************************************************************‘**************************************************************************’39 Display current date and Time

print now‘**************************************************************************‘**************************************************************************’40 Find difference between two dates.

‘Date difference in Yearsprint DateDiff(“yyyy”,”12/31/2002″,Date)

‘Date difference in Monthsprint DateDiff(“m”,”12/31/2002″,Date)

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

65 of 165 8/12/2014 6:10 PM

Page 66: QTP Challenges 4 Experts _ Just Another WordPress

‘Date difference in Daysprint DateDiff(“d”,”12/31/2002″,Date)

‘**************************************************************************‘**************************************************************************’41 Add time interval to a date

print DateAdd(“m”, 1, “31-Jan-95″)

‘**************************************************************************‘**************************************************************************’42 Print current day of the week

Print day(date)‘**************************************************************************‘**************************************************************************’43 Find whether current month is a long monthDim oCurrentMonthDim ocurrentYearDim oDaysinMonths

oCurrentMonth = Month(date)ocurrentYear = Year(date)oDaysinMonths=Day(DateSerial(ocurrentYear, oCurrentMonth + 1, 0))print oDaysinMonths&” Days in Current Month”If oDaysinMonths=31 Thenprint “Current Month is a long month”elseprint “Current Month is not a long month”End If‘**************************************************************************‘**************************************************************************’44 Find whether given year is a leap year

‘1st Method

‘The rules for leap year:‘1. Leap Year is divisible by 4 (This is mandotory Rule)‘2. Leap Year is not divisible by 100 (Optional)‘3. Leap Year divisble by 400 (Optional)

Dim oYear

oYear=1996

If ((oYear Mod 4 = 0) And (oYear Mod 100 <> 0) Or (oYear Mod 400 = 0)) thenprint “Year “&oYear&” is a Leap Year”elseprint “Year “&oYear&” is not a Leap Year”End If

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

66 of 165 8/12/2014 6:10 PM

Page 67: QTP Challenges 4 Experts _ Just Another WordPress

’45. 2nd Method‘ Checking 29 days for February month in specified yearDim oYearDim tmpDate

oYear=1996tmpDate = “1/31/” & oYearDaysinFebMonth = DateAdd(“m”, 1, tmpDate)

If day(DaysinFebMonth )=29 thenprint “Year “&oYear&” is a Leap Year”elseprint “Year “&oYear&” is not a Leap Year”End If

‘**************************************************************************‘**************************************************************************’46 Format Number to specified decimal places

Dim oNumDim DecimaPlacestobeFormatoNum = 3.14159DecimaPlacestobeFormat=2print Round(oNum , DecimaPlacestobeFormat)

‘**************************************************************************‘**************************************************************************’47 Write a program to Generate a Random Numbers‘This script will generate random numbers between 10 and 20Dim rStartRangeDim rEndRange

rStartRange=10rEndRange=20

For iCounter=1 to 10print Int((rEndRange – rStartRange + 1) * Rnd + rStartRange)Next‘**************************************************************************‘**************************************************************************’48 Write a program to show difference between Fix and Int

‘Both Int and Fix remove the fractional part of number and return the resulting integer value.‘The difference between Int and Fix is that if number is negative, Int returns the first negative integer lessthan or equal to number,‘whereas Fix returns the first negative integer greater than or equal to number.‘For example, Int converts -8.4 to -9, and Fix converts -8.4 to -8.

print Int(99.8) ‘ Returns 99.print Fix(99.2) ‘ Returns 99.

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

67 of 165 8/12/2014 6:10 PM

Page 68: QTP Challenges 4 Experts _ Just Another WordPress

print Int(-99.8) ‘ Returns -100.print Fix(-99.8) ‘ Returns -99.print Int(-99.2) ‘ Returns -100.print Fix(-99.2) ‘ Returns -99.

‘**************************************************************************‘**************************************************************************’49 Write a program to find subtype of a variable

Dim oVarDim oDatatypesoVar=”QTP”oVartype=Typename(oVar)print oVartype

‘**************************************************************************‘**************************************************************************’50 Write a program to print the decimal part of a given numberDim oNumoNum=3.123oDecNum=oNum- int(oNum)print oDecNum‘**************************************************************************‘**************************************************************************

Working with ADODB connections using QTP

30 MAY 2009 Leave a comment

by vsprasad2k in QTP ADODB Tags: QTP ADODB

How to open a password-protected database.

Example:

Dim FlightNumber

Dim dbexample

‘ Create the conection object.

Set dbexample = CreateObject(“ADODB.Connection”)

‘Set the connection string and open the connection

dbexample.ConnectionString = “DBQ=D:Program FilesMercuryInteractiveWinRunnersamplesflightappflight32.mdb;DefaultDir=D:Program FilesMercury

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

68 of 165 8/12/2014 6:10 PM

Page 69: QTP Challenges 4 Experts _ Just Another WordPress

InteractiveWinRunnersamplesflightapp;Driver={Microsoft Access Driver (*.mdb)};DriverId=281;FIL=MSAccess;MaxBufferSize=2048;MaxScanRows=8;PageTimeout=5;SafeTransactions=0;Threads=3;UserCommitSync=Yes;”

dbexample.Open

‘or use this method if a DSN entry was created.

‘dbexample.Open(“DSN=Flight32″)

flflightnumber = 6195

‘ Get the recordset returned from a select query.

Set recordset = dbexample.Execute(“SELECT * from Orders WHERE Flight_Number = ” &flightnumber)

‘ Display the results of the query.

msgbox recordset.GetString

‘ Close the database connection.

dbexample.Close

Set dbexample = Nothing

If your query returns several columns, you can use the Fields method to retrieve data from specifiedcolumns in the returned record set.

Example:

‘ Connect to the Flight32 database

Set dbexample = CreateObject(“ADODB.Connection”)

dbexample.Open(“DSN=Flight32″)

‘ Perform a query

Set recordset = dbexample.Execute(“SELECT * from Orders”)

‘ Get the values from the Customer_Name column

while (NOT recordset.EOF)

MsgBox recordset.Fields(“Customer_Name”)

‘ Move to the next value in the record set

recordset.MoveNext

wend

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

69 of 165 8/12/2014 6:10 PM

Page 70: QTP Challenges 4 Experts _ Just Another WordPress

‘ Close the database connection.

dbexample.Close

Set dbexample = Nothing

Does QuickTest Professional (QTP) / Unified Functional

Testing (UFT) support Microsoft Virtual PC?

14 FEB 2013 Leave a comment

by vsprasad2k in QTP

Version QTP 9.2 QTP 9.5 QTP 10 QTP 11 UFT 11.5

Microsoft Virtual PC 2004 No Yes Yes Yes Yes (GUI Testing only)

Microsoft Virtual PC 2007 No Yes Yes Yes Yes (GUI Testing only)

Microsoft Virtual PC VMM 2008 No No Yes Yes Yes (GUI Testing only)

Protected: All posts in this Blog

09 FEB 2013 Enter your password to view comments.

by vsprasad2k in COM DCOM AOM, QTP, QTP ADODB, QTP Excel, QTP Patch, QTP QC ISSUES,QTP Registry, QTP Tricks, QTP VBScript, QTP WMI, Test Results, Web Extensibility Add-in, XMLCompare

Script to upload attachment in QC test lab

05 DEC 2012 Leave a comment

by vsprasad2k in Uncategorized

Dim oCurrentTest,oA.achment

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

70 of 165 8/12/2014 6:10 PM

Page 71: QTP Challenges 4 Experts _ Just Another WordPress

Set oCurrentTest = QCUtil.CurrentTest.A.achments

Set oA.achment = oCurrentTest.AddItem(Null)

oA.achment.FileName = “C:Results.xls”

oA.achment.Type = 1 oA.achment.Post

oA.achment.Refresh Set

oA.achment =Nothing

Set oCurrentTest =Nothing

Working with WMI (Windows Management Infrastructure)

16 JUL 2012 Leave a comment

by vsprasad2k in challenges, QTP, QTP Tricks, QTP WMI, Uncategorized

Dim flag, AllProcess, AppToRunAppToRun = “ixplore.exe”Flag = FlaseSet AllProcess = GetObject(“winmgmts:”)

For Each Process In AllProcess.InstancesOf(“Win32_process”)If (Instr ((Process.Name), AppToRun) = 1) ThenPrint “Internet Explorer is running..”Flag = TureExit ForEnd IfNext

If Flag = Flase ThenPrint “Internet Explorer not is running..”SystemUtil.Run AppToRunEnd If

You can do the same for any process/application. You just need to change the value of AppToRunvariable.

VBScript Code Snippets for storing the QTP Test Results at

:)

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

71 of 165 8/12/2014 6:10 PM

Page 72: QTP Challenges 4 Experts _ Just Another WordPress

our desired central location [FrmWrk-Folder Structure]

11 JUL 2012 Leave a comment

by vsprasad2k in QTP, QTP VBScript, Test Results

launch QTP in such way that it starts by saving results in the desired lcoation…here QTPResultspath isthe location that has been created in QTPResults folder and then QTP is invoked and initiated to saveresults in the predetermined location….

qtResultsOpt.ResultsLocation = QTPResultspathApp.Test.Run qtResultsOpt‘App.Test.Run

‘___________________CODE________________MasterFolder = “C:TestAutomation”Dim App, qtResultsOpt, fso, fSet App = CreateObject(“QuickTest.Application”)If App.Launched = False ThenApp.LaunchEnd IfApp.Visible = TrueApp.Options.Run.ImageCaptureForTestResults = “Always”App.Options.Run.RunMode = “Fast”App.Options.Run.ViewResults = TrueApp.Open MasterFolder&”TestsEFiles”,False,FalseApp.Test.Se.ings.Resources.Libraries.RemoveAllApp.Test.Se.ings.Resources.Libraries.Add MasterFolder&”Business FunctionsTestScripts.vbs”

‘__________________ START of creating a result folder _________________Temp = NowTemp1 = Replace (Temp, “/”,”-“)Temp2 = Replace(Temp1,” AM”,””)Temp3 = Replace(Temp2,” PM”,””)Temp4 = Replace(Temp3,”:”,””)FolderName = Replace(Temp4,” “,”_”)‘QTPResultspath = “C:TestAutomationQTPResults”&FolderNameQTPResultspath = MasterFolder&”QTPResults”&FolderName

Set fso = CreateObject(“Scripting.FileSystemObject”)If Not fso.FolderExists(QTPResultspath) ThenSet f = fso.CreateFolder(QTPResultspath)End IfSet f = nothingSet fso = nothing‘__________________ END of creating a result folder _________________

Set qtResultsOpt = CreateObject(“QuickTest.RunResultsOptions”)

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

72 of 165 8/12/2014 6:10 PM

Page 73: QTP Challenges 4 Experts _ Just Another WordPress

qtResultsOpt.ResultsLocation = QTPResultspath

App.Test.Run qtResultsOpt‘App.Test.RunSet App = nothingSet qtResultsOpt = Nothing

Working with Excel using VB Script Code Snippets

31 MAY 2012 Leave a comment

by vsprasad2k in QTP, QTP ADODB, QTP Excel, QTP VBScript

Add Data to a Spreadsheet Cell

Demonstration script that adds the words “Test Value” to cell 1,1 in a new spreadsheet.Set objExcel = CreateObject(“Excel.Application”)

objExcel.Visible = TrueobjExcel.Workbooks.AddobjExcel.Cells(1, 1).Value = “Test value”

Add Formatted Data to a Spreadsheet

Demonstration script that adds the words “test value” to a new spreadsheet, then formats the cellcontaining the value.

Set objExcel = CreateObject("Excel.Application")

objExcel.Visible = True

objExcel.Workbooks.Add

objExcel.Cells(1, 1).Value = "Test value"

objExcel.Cells(1, 1).Font.Bold = TRUE

objExcel.Cells(1, 1).Font.Size = 24

objExcel.Cells(1, 1).Font.ColorIndex = 3

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

73 of 165 8/12/2014 6:10 PM

Page 74: QTP Challenges 4 Experts _ Just Another WordPress

Create User Accounts Based on Information in a Spreadsheet

Demonstration script that creates new Active Directory user accounts based on information stored in anExcel spreadsheet.

Set objExcel = CreateObject("Excel.Application")

Set objWorkbook = objExcel.Workbooks.Open _

("C:ScriptsNew_users.xls")

intRow = 2

Do Until objExcel.Cells(intRow,1).Value = ""

Set objOU = GetObject("ou=Finance, dc=fabrikam, dc=com")

Set objUser = objOU.Create _

("User", "cn=" & objExcel.Cells(intRow, 1).Value)

objUser.sAMAccountName = objExcel.Cells(intRow, 2).Value

objUser.GivenName = objExcel.Cells(intRow, 3).Value

objUser.SN = objExcel.Cells(intRow, 4).Value

objUser.AccountDisabled = FALSE

objUser.SetInfo

intRow = intRow + 1

Loop

objExcel.Quit

Format a Range of Cells

Demonstration script that adds data to four different cells in a spreadsheet, then uses the Range object toformat multiple cells at the same time.

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

74 of 165 8/12/2014 6:10 PM

Page 75: QTP Challenges 4 Experts _ Just Another WordPress

Set objExcel = CreateObject("Excel.Application")

objExcel.Visible = True

objExcel.Workbooks.Add

objExcel.Cells(1, 1).Value = "Name"

objExcel.Cells(1, 1).Font.Bold = TRUE

objExcel.Cells(1, 1).Interior.ColorIndex = 30

objExcel.Cells(1, 1).Font.ColorIndex = 2

objExcel.Cells(2, 1).Value = "Test value 1"

objExcel.Cells(3, 1).Value = "Test value 2"

objExcel.Cells(4, 1).Value = "Tets value 3"

objExcel.Cells(5, 1).Value = "Test value 4"

Set objRange = objExcel.Range("A1","A5")

objRange.Font.Size = 14

Set objRange = objExcel.Range("A2","A5")

objRange.Interior.ColorIndex = 36

Set objRange = objExcel.ActiveCell.EntireColumn

objRange.AutoFit()

List Active Directory Data in a Spreadsheet

Demonstration script that retrieves data from Active Directory and then displays that data in an Excelspreadsheet.

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

75 of 165 8/12/2014 6:10 PM

Page 76: QTP Challenges 4 Experts _ Just Another WordPress

Const ADS_SCOPE_SUBTREE = 2

Set objExcel = CreateObject("Excel.Application")

objExcel.Visible = True

objExcel.Workbooks.Add

objExcel.Cells(1, 1).Value = "Last name"

objExcel.Cells(1, 2).Value = "First name"

objExcel.Cells(1, 3).Value = "Department"

objExcel.Cells(1, 4).Value = "Phone number"

Set objConnection = CreateObject("ADODB.Connection")

Set objCommand = CreateObject("ADODB.Command")

objConnection.Provider = "ADsDSOObject"

objConnection.Open "Active Directory Provider"

Set objCommand.ActiveConnection = objConnection

objCommand.Properties("Page Size") = 100

objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE

objCommand.CommandText = _

"SELECT givenName, SN, department, telephoneNumber FROM " _

& "'LDAP://dc=fabrikam,dc=microsoft,dc=com' WHERE " _

& "objectCategory='user'"

Set objRecordSet = objCommand.Execute

objRecordSet.MoveFirst

x = 2

Do Until objRecordSet.EOF

objExcel.Cells(x, 1).Value = _

objRecordSet.Fields("SN").Value

objExcel.Cells(x, 2).Value = _

objRecordSet.Fields("givenName").Value

objExcel.Cells(x, 3).Value = _

objRecordSet.Fields("department").Value

objExcel.Cells(x, 4).Value = _

objRecordSet.Fields("telephoneNumber").Value

x = x + 1

objRecordSet.MoveNext

Loop

Set objRange = objExcel.Range("A1")

objRange.Activate

Set objRange = objExcel.ActiveCell.EntireColumn

objRange.Autofit()

Set objRange = objExcel.Range("B1")

objRange.Activate

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

76 of 165 8/12/2014 6:10 PM

Page 77: QTP Challenges 4 Experts _ Just Another WordPress

Set objRange = objExcel.ActiveCell.EntireColumn

objRange.Autofit()

Set objRange = objExcel.Range("C1")

objRange.Activate

Set objRange = objExcel.ActiveCell.EntireColumn

objRange.Autofit()

Set objRange = objExcel.Range("D1")

objRange.Activate

Set objRange = objExcel.ActiveCell.EntireColumn

objRange.Autofit()

Set objRange = objExcel.Range("A1").SpecialCells(11)

Set objRange2 = objExcel.Range("C1")

Set objRange3 = objExcel.Range("A1")

List Excel Color Values

Demonstration script that displays the various colors — and their related color index — available whenprogrammatically controlling Microsoft Excel.

Set objExcel = CreateObject("Excel.Application")

objExcel.Visible = True

objExcel.Workbooks.Add

For i = 1 to 56

objExcel.Cells(i, 1).Value = i

objExcel.Cells(i, 1).Interior.ColorIndex = i

Next

List Service Data in a Spreadsheet

Demonstration script that retrieves information about each service running on a computer, and thendisplays that data in an Excel spreadsheet.

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

77 of 165 8/12/2014 6:10 PM

Page 78: QTP Challenges 4 Experts _ Just Another WordPress

Set objExcel = CreateObject("Excel.Application")

objExcel.Visible = True

objExcel.Workbooks.Add

x = 1

strComputer = "."

Set objWMIService = GetObject _

("winmgmts:\" & strComputer & "rootcimv2")

Set colServices = objWMIService.ExecQuery _

("Select * From Win32_Service")

For Each objService in colServices

objExcel.Cells(x, 1) = objService.Name

objExcel.Cells(x, 2) = objService.State

x = x + 1

Next

Open an Excel Spreadsheet

Demonstration script that opens an existing Excel spreadsheet named C:ScriptsNew_users.xls.

Set objExcel = CreateObject("Excel.Application")

Set objWorkbook = objExcel.Workbooks.Open("C:ScriptsNew_users.xls")

Read an Excel Spreadsheet

Demonstration script that reads the values stored in a spreadsheet named C:ScriptsNew_users.xls.

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

78 of 165 8/12/2014 6:10 PM

Page 79: QTP Challenges 4 Experts _ Just Another WordPress

Set objExcel = CreateObject("Excel.Application")

Set objWorkbook = objExcel.Workbooks.Open _

("C:ScriptsNew_users.xls")

intRow = 2

Do Until objExcel.Cells(intRow,1).Value = ""

Wscript.Echo "CN: " & objExcel.Cells(intRow, 1).Value

Wscript.Echo "sAMAccountName: " & objExcel.Cells(intRow, 2).Value

Wscript.Echo "GivenName: " & objExcel.Cells(intRow, 3).Value

Wscript.Echo "LastName: " & objExcel.Cells(intRow, 4).Value

intRow = intRow + 1

Loop

objExcel.Quit

Reference:

http://www.activexperts.com/activmonitor/windowsmanagement/scripts/msoffice/excel/ (http://www.activexp

Excel Get Used Range Count and Insert Picture using

VB Scripting

31 MAY 2012 Leave a comment

by vsprasad2k in QTP, QTP Excel, Uncategorized

Set objXL = CreateObject(“Excel.Application”)objXL.visible = TrueobjXL.DisplayAlerts = falseSet wkb = objXL.Workbooks.Open(ExcelFilePath)Set ws = wkb.Sheets(“Sample”)Used_RowCount = ws.UsedRange.Rows.CountUsed_ColumnCount = ws.UsedRange.Rows.Count

Next_Row_Range = Used_RowCount +3Add_Column_Range = Used_ColumnCount + 10

Cell_Range = “A” & Next_Row_Range &”:G” & Add_Column_Range

Set objRng = ws.Range(Cell_Range)

‘Insert Picture..objRng.MergeSet Picture = ws.Pictures.Insert(ImageFilePath)With Picture

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

79 of 165 8/12/2014 6:10 PM

Page 80: QTP Challenges 4 Experts _ Just Another WordPress

.Top = objRng.Top

.Left = objRng.Left

.Width = objRng.Width

.Height = objRng.HeightEnd With

‘Insert text …ws.Cells(Cell_Range).Value = “Test value”

wkb.SaveAs ExcelFilePathwkb.CloseobjXL.Quit

‘********************************************************

Function FindLastCell()Dim lRow As Long, lCol As Integer, mRow As Long, mCol As IntegerlCol = ActiveSheet.UsedRange.Columns.CountmRow = 0For i = 1 To lCollRow = Range(Cells(rows.count, i), Cells(rows.count, i)).End(xlUp).RowIf lRow > mRow ThenmRow = lRowmCol = iElseEnd IfNext iFindLastCell = Range(Cells(mRow, mCol), Cells(mRow, mCol)).AddressEnd Function

BPT running in an infinite loop hen using QTP 11 QC11

15 APR 2012 Leave a comment

by vsprasad2k in challenges, QTP, QTP Patch, QTP Tricks Tags: bpt, QTP 11.0 Patch

BPT’s running in an infinite loop? Going crazy trying to figure out the solution for it?Its Patch QTP_00821

HP has just released a critical patch for people using QuickTest Professional 11 and ALM/QC 11.00 withBPT. The patch resolves an issue with se.ings that were setup for normal QTP test were sometimesincorrectly applied to a Business Process Test run. These se.ing caused the BPT to run in an infinite

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

80 of 165 8/12/2014 6:10 PM

Page 81: QTP Challenges 4 Experts _ Just Another WordPress

loop.

Patch QTP_00821 (h.p://support.openview.hp.com/selfsolve/document/FID/DOCUMENTUM_QTP_00821) can be downloaded from HP.

Web Automation Testing Tools

07 APR 2012 Leave a comment

by vsprasad2k in challenges, COM DCOM AOM, QTP Tricks, QTP VBScript Tags: Automation TestingTools

Web Testing Tools

RedBot (h.p://mnot.github.com/redbot/)- An open source robot that checks HTTP resources to see howthey’ll behave, pointing out common problems and suggesting improvements. Although it is not aHTTP conformance tester, it can find a number of HTTP-related issues. Interacts with the resource at theprovided URL to check for a large number of common HTTP problems, including: Invalid syntax inheaders, ill-formed messages (e.g., bad chunking, incorrect content-length), incorrect gzip encoding,missing headers. Additionally, it will tell how well your resource supports such HTTP features ascaching, negotiation for compression, last-Modified and ETag validation, partial content. Supports h.pbut not h.ps.

Webpagetest (h.p://www.webpagetest.org/)- A tool that was orginially developed by AOL for useinternally and was open-sourced in 2008. The online version atwww.webpagetest.org(h.p://www.webpagetest.org/) is an industry collaboration with various companies providing thetesting infrastructure for testing your site from across the globe. Provides web page content analysis,performance analysis, various performance scores. API’s availabel for scripting.

Page Speed (h.p://code.google.com/speed/page-speed/)- An open-source project started at Google tohelp developers optimize their web pages by applying web performance best practices. Started as anopen-source Firefox/Firebug add-on and is now deployed in third-party products such asWebpagetest.org, Show Slow and Google Webmaster Tools. Page Speed family of tools includes PageSpeed Firefox/Firebug add-on which allows you to evaluate the performance of web pages and to getsuggestions on how to improve them, and the mod_pagespeed Apache module which automaticallyrewrites pages and resources to improve their performance.

Speed Tracer (h.p://code.google.com/webtoolkit/speedtracer/)- An open source tool to help youidentify and fix performance problems in your web applications. It visualizes metrics that are takenfrom low level instrumentation points inside of the browser and analyzes them as your application runs.Speed Tracer is available as a Chrome extension and works on all platforms where extensions are

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

81 of 165 8/12/2014 6:10 PM

Page 82: QTP Challenges 4 Experts _ Just Another WordPress

currently supported (Windows and Linux). Using Speed Tracer you are able to get a be.er picture ofwhere time is being spent in your application. This includes problems caused by JavaScript parsing andexecution, layout, CSS style recalculation and selector matching, DOM event handling, network resourceloading, timer fires, XMLH.pRequest callbacks, painting, and more.

ShowSlow (h.p://www.showslow.org/)- An open source tool that helps monitor various websiteperformance metrics over time by collecting web performance data and showing it in aggregated formfor be.er business understanding. Captures the results of YSlow and Page Speed rankings and graphsthem, to help you understand how various changes to your site affect its performance.

Blaze (h.p://www.blaze.io/)- An online service from From Blaze Software Inc. for optimizing websitespeed by optimizing Front End Performance. Blaze’s automated optimization combined with it’sContent Delivery Network partner can maximize the potential performance of your web site.

Fitnium (h.p://www.magneticreason.com/tools/fitnium/fitnium.html)- Fitnium fromMagneticreason.com provides the ability to write and execute Selenium tests using theFitNesse (h.p://fitnesse.org/)framework but without the need to write code. Based on a FitNesseDoFixture, provides an English language interpretation of the Selenium API that you would normallycall from Java, Ruby, Python, Perl or C#. In this instance it allows developers, testers, and customers towrite UI driven automated acceptance tests. All API’s available to Java, Ruby, Python, Perl or C#developers is now available as an easily understand English phrase that anyone can use to develop theirown tests.

Sauce OnDemand (h.p://saucelabs.com/)- Runs Selenium tests in parallel across multiple browsers inthe cloud; from SauceLabs Inc. Acts as a drop-in replacement for Selenium RC, allowing simpleconfiguring of scripts to use Sauce OnDemand. Unlimited browser instances enables testing as manyapps across as many browsers as needed; live remote control views of tests running in SauceOnDemand enables faster test debugging cycles; run FireFox Custom Profiles in the Cloud; test appssecurely behind a firewall with Sauce Tunnel – connects a VM on your internal webserver to SauceOnDemand via SSH, with only the Sauce Labs machines actively running the tests having access andwhen a test is finished, access is revoked.

JSView (h.ps://addons.mozilla.org/en-US/firefox/addon/2076?collection_uuid=6fa2752d-f181-3d1d-bccf-508f5ff7c939)- Firefox plugin enables ability to view the source code of external files. Most websitesstore their javascripts and style sheets in external files and then link to them within a web page’s sourcecode. JSView enables access to these files from the context menu, from the toolbar, from the view menu,or from the status bar. If the website you are viewing contains any external js/css files, an icon willappear that says “SS”, “JS”, or both. Each individual file can then be viewed by clicking on the filename.The file will be opened in a new window. You can also choose to open all external files by clicking on“View All”.

Flash-Selenium (h.p://code.google.com/p/flash-selenium/)- The Flash-selenium open source projectextends the Selenium RC clients for adding Flash communication capabilities. Enables direct testing ofthe UI components of a Flex application.

Selenium-Flex API (h.p://code.google.com/p/sfapi/)- The Selenium-Flex API allows automation of Flexapplications using the popular test automation tool Selenium. The API is easy to set up and can be donewith only basic working knowledge of either Flex or Selenium. Requires Firefox and inclusion of theSelenium-Flex API in Flex app build.

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

82 of 165 8/12/2014 6:10 PM

Page 83: QTP Challenges 4 Experts _ Just Another WordPress

Virtu-El.com Spell Checker (h.p://virtu-el.com/) Online free spell checker and link checker from C#computing.

HTTPDebugger (h.p://www.h.pdebugger.com/)- HTTP Traffic Analyzer tool from MadeForNet.comthat enable effective debugging of h.p headers and h.p content. Analyze HTTP headers, POST data,cookies, error codes and SOAP envelopes; measure the size, execution and downloading time ofdynamic web pages; view the traffic from browser add-ons, ActiveX components and Java applets;decode HTTPS connections and gzip/chunked encodings; see complete stats in charts and diagrams.Supports a variety of browsers.

WebWait (h.p://webwait.com/)- Free online web site timer from Michael Mahemof; use to benchmarkyour website or test the speed of your web connection; pulls down the entire website into your browser,so it takes into account Ajax/Javascript processing and image loading which other tools ignore.

Cucumber (h.p://cukes.info/)- Cucumber is a tool that can execute plain-text functional descriptions asautomated tests. The language that Cucumber understands is called Gherkin. While Cucumber can bethought of as a “testing” tool, the intent of the tool is to support BDD (Behavior-Driven Development).This means that the “tests” (plain text feature descriptions with scenarios) are typically wri.en beforeanything else and verified by business analysts, domain experts, etc. non technical stakeholders. Theproduction code is then wri.en outside-in, to make the stories pass. Cucumber itself is wri.en in Ruby,but it can be used to “test” code wri.en in Ruby or other languages including but not limited to Java, C#and Python. Requires only minimal use of Ruby scripting, so cucumber can be utilized in testingcontexts where the application code is not Ruby.

Aptimize Website Accelerator (h.p://www.aptimize.com/)- An ISAPI filter for Microsoft IIS, or aDaemon and module for Linux Apache, that automates performance tuning by dynamically optimizingweb pages for high performance at runtime – just before a page is sent from web server to browser. ForWin and Linux platforms.

Spello (h.p://spello.codeplex.com/)- Open source web site spell checker; run as a windows form orcommand line. Supports English (US and UK), French, German and Spanish (Spain and Mexico)dictionaries. More dictionaries can be downloaded from h.p://wiki.services.openoffice.org/wiki/Dictionaries (h.p://wiki.services.openoffice.org/wiki/Dictionaries). Html based log file. Wri.en inC#, requires Microsoft.Net 3.5 SP1, the setup program has a bootstrapper to install it.

eggPlant (h.p://www.testplant.com/)- An image-based, low-overhead, non-invasive black-box testautomation tool. Does not reside on the system-under-test and is technology agnostic, so it can test inmany situations that other tools cannot by using image capture and advanced search techniques. Doesnot interact with the underlying code, and can test any application including those that can causeproblems for other tools such as Flash, Silverlight, etc. Works

T-Plan Robot (h.p://www.t-plan.com/robot/)- A black box automated testing tool developed on genericimage based testing principles; provides a human-like approach to software testing and performs insituations where other tools may fail. Support of Java test scripts as well as a proprietary scriptinglanguage; record & replay capability; support of testing over the RFB protocol (be.er known as VNC);ability to perform black box GUI testing of mobile phones (Windows Mobile, Symbian, iPhone); openarchitecture with a generic plugin interface and well documented programming interfaces. Platformindependent (Java); runs on, and automates major systems, such as Windows, Linux, Unix, Solaris andcertain mobile platforms.

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

83 of 165 8/12/2014 6:10 PM

Page 84: QTP Challenges 4 Experts _ Just Another WordPress

Browsershots (h.p://browsershots.org/)- Free online cross browser/OS comparison testing. Choosebrowser OS, browser, and versions of interest and submit URL and site responds with a collection ofscreen shots.

Multi-Browser Viewer (h.p://www.multibrowserviewer.com/faq.asp)- Cross browser testing solutionfrom TWD Solutions Pte Ltd. includes a wide variety of standalone virtualized browsers, multiplestandalone mobile browsers or simulators, 58 screen capture image browsers; Screenshot comparisonfunction (“Onion Skin” or “Side-by-Side”); available in multiple languages.

IE collection at Final Builds site (h.p://finalbuilds.edskes.net/iecollection.htm) – Enables installingstandalone IE browser versions for comparison/testing, MS IE versions 1.0 thru 8.0.

BrowserSeal (h.p://browserseal.com/)- Multi browser website screenshot tool – capture an image ofweb site under multiple browsers Supports multiple versions of IE, Firefox, Google Chrome, Opera,Safari. Optimized for speed. Comes with standalone versions of all major browsers to verify site layoutissues and troubleshoot functionality issues. The Automated edition adds the ability to automaitcallycapture miltuple URLs without user intervention, and command-line control enabling use in automationscripts. For Windows platforms.

LiteTest (h.p://www.litetest.com/)- Web analysis and evaluation reports of your website usability andother aspects; you test other users websites, and they test yours. Complete a website evaluation reportfor three other sites and you will then be guaranteed a minimum of three web analysis reports on yourown site. Registration and evaluations are free.

System Shephard (h.p://www.absolute-performance.com/)- An IT Performance Monitoring andOperations Management Platform for web and other systems; from Absolute Performance Inc. Modulesinclude StressWalk and WebWalk. Delivers an enterprise-wide view of system performance and alertstatus; supplies analysis and reports based on real-time, recent, and historical data

Spydermate (h.p://spydermate.com/)- Free online SEO analysis tool from MentorMate that gives anumerical and visual representation of a website’s online marketing effort by using a variety of graphsand statistics. Other capabilities: page-specific on-site keyword analysis; side-by-side comparisons ofyour own website against a competitor.

Twill (h.p://twill.idyll.org/)- Simple open source Python-based scripting language for web browsercontrol from a command-line interface. Navigate through Web sites that use forms, cookies, and moststandard Web features. Supports automated Web testing

Firefox Web Testing Add-ons (h.ps://addons.mozilla.org/en-US/firefox/search?q=test&cat=1%2C4&as=true&vfuz=true&appid=1&lver=1.0&hver=any&atype=0&pid=0&lup=&pp=20&sort=weeklydownloads)- Includes many tools that can be useful for testing such as iMacros for Firefox,WASP, Fireshot, Window Resizer, Selenium IDE, Web Developer, SwitchProxy, IE Tab, Molybdenum,HackBar, and many more.

Web Testing Plugin collection (h.p://agilewebdevelopment.com/plugins/category/3)- Large collection oflinks to and short descriptions of open source utilities and tools for web testing, unit testing, assertions,mocks, fixture utilities, reporting, validators, code coverage, etc. Mostly for Ruby, maintained byBenjamin Curtis

UTE (h.p://www.mindd.com/)- Automated ‘usability testing environment’ from Mind Design Systems,Inc. Assists in quantitative usability evaluation of websites and web applications; automates capture of

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

84 of 165 8/12/2014 6:10 PM

Page 85: QTP Challenges 4 Experts _ Just Another WordPress

usability data in detail not easily done by a human observer. Consists of a) a ‘UTE Manager’ which helpsset up test scenarios (tasks) as well as survey and demographic questions, and compiles results andproduces customized reports and summary data; and b) a ‘UTE Runner’ which presents test participantswith test scenarios (tasks) as well as any demographic and survey questions; the runner also tracksactions of the subject throughout the test including clicks, keystrokes, and scrolling.

Venkman Javascript Debugger (h.ps://addons.mozilla.org/en-US/firefox/addon/216)- Firefox extension;open source JavaScript debugging environment for Mozilla based browsers.

XPather (h.p://xpath.alephzarro.com/)Firefox add-on by Viktor Zigo. Has rich XPath generator, editor,inspector and simple extraction tool. Requires the standard DOM inspector plugin for FF3.

FlexMonkey (h.p://code.google.com/p/flexmonkey/)- A testing framework for Flex apps. Capabilitiesinclude capture, replay and verification of Flex UI functionality. Can generate ActionScript-based testingscripts that can easily be included within a continuous integration process. Uses the Flex AutomationAPI and was created by extending Adobe’s sample automation adapter, AutoQuick. Donated to the Flexcommunity by Gorilla Logic. Site also lists info and links to three other open source Flex testtools/frameworks: FlexUnit, Selenium-Flex, and FunFx.

UnmaskParasites (h.p://unmaskparasites.com/)- A free online service that checks web pages for hiddenillicit content (invisible spam links, iframes, malicious scripts and redirects). By Denis Sinegubko. Justtype in the URL of the web site to be checked.

TestArmy (h.p://www.testarmy.com/)- TestArmy provides cheap access to a large, flexible base oftesters with a wide range of hardware. Test applications thoroughly in a variety of environments, atlower cost, using crowd-sourcing. Enable more efficient testing on the end user hardware and softwareplatforms that have proliferated, particularly for mobile and web applications. Developed by PeterGeorgeson.

Rasta (h.p://rasta.rubyforge.org/)- Rasta is a keyword-driven open source test framework by HughMcGowan using spreadsheets to drive testing. Loosely based on FIT, where data tables defineparameters and expected results. The spreadsheet can then be parsed using your test fixtures. For theunderlying test harness, Rasta uses RSpec so in addition to reporting results back to the spreadsheet youcan take advantage of RSpec’s output forma.ers and simultaneously export into other formats such asHTML and plain text. Since Rasta utilizes Ruby, it can work well with Watir (listed elsewhere in thispage).

File Comparators (h.p://www.foldermatch.com/fmcompetitors.htm)- Web testing – or any type oftesting – often involves verification of data vs expected data. While this is simple enoughprogrammatically for single data points or small data sets, comparison of large amounts of data can bemore challenging. This site, maintained by FolderMatch/Salty Brine Software, a windows file/foldercomparator tool vendor, lists a large number of Win data comparators. An old (2003) but still usefullisting of mostly non-Windows data comparator tools is maintained by Danny Faught in his OpenTestware Reviews site’s Data Comparator Survey (h.p://tejasconsulting.com/open-testware/feature/data-comparator-survey.html).

TMX (h.p://www.critical-logic.com/)- Keyword driven test automation product from Critical Logic,provides automated, fully annotated, executable scripts for QTPro, Watir, TestPartner, and SilkTest.Imports the objects that make up an application (radio bu.ons, entry fields, etc.) and builds an ObjectTree containing all elements and a.ributes subject to testing. Then automatically generates the

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

85 of 165 8/12/2014 6:10 PM

Page 86: QTP Challenges 4 Experts _ Just Another WordPress

executable test scripts and test documentation. ‘Virtual Objects’ allow building of test scripts fromrequirements in parallel with code development.

Google’s Website Optimizer (h.p://www.google.com/websiteoptimizer)- Google’s service for testingvariations in site design (titles, images, content, etc) to determine impacts on conversions, user actions,traffic, or other goals.

YSlow (h.p://developer.yahoo.com/yslow/)- Free open source tool analyzes web pages and explainswhy they’re slow based on rules for high performance web sites. A Firefox add-on integrated with theFirebug web development tool. Includes a Performance report card, HTTP/HTML summary, list ofcomponents in page and related info, tools including JSLint. Generates a grade for each rule and anoverall grade, lists suggested specific changes to improve performance, calculates total size of page forempty and primed cache scenarios, cookie info. Can also view HTTP response headers for anycomponent.

ItsNat (h.p://itsnat.sourceforge.net/)- Open source Java AJAX component-based web developmentframework provides a natural approach to web development; leverages ‘old’ tools to build new AJAXbased Web 2.0 applications. Server centric using an approach called TBITS, “The Browser Is The Server”:simulates a Universal W3C Java Browser at the server mimicing the behavior of a web browser,containing a W3C DOM Level 2 node tree and receiving W3C DOM Events. Contains significant built infunctional web test support.

HTT (h.p://sourceforge.net/projects/h.)- Open source scriptable HTTP test tool for testing andbenchmarking web apps and for HTTP server development. Can act as client (requesting) and server(backend for reverse proxys). Pa.ern matching answers (both server and client) to test validity. Supportschunking in request and response.

Web Page Analyzer (h.p://www.websiteoptimization.com/)- Free online website performance tool andpage speed analysis from Website Optimization. Calculate page size, composition, and download time.,size of individual elements and sums up each type of web page component. Then offers advice onimproving page load time.

HTTPWatch (h.p://h.pwatch.com/)- An HTTP viewer and debugger plugin for MS Internet Explorerfor HTTP and HTTPS monitoring without leaving browser window. Real-time page and request leveltime charts;millisecond accurate timings and network level data. Includes automation interface that canbe used by most programming languages. Supports filtering of requests by criteria such as contenttypes, response codes, URLs, headers and content. Basic free and paid versions available.

IBM Rational Policy Tester Accessibility Edition (h.p://www-306.ibm.com/software/awdtools/tester/policy/accessibility/)- Helps ensure Web site accessibility to all users by monitoring for over 170comprehensive accessibility checks. It helps determine the site’s level of compliance with governmentstandards, including the U.S. government’s Section 508 and guidelines such as the World Wide WebConsortium’s Web Content Accessibility Guidelines (W3C WCAG), the UK’s Disability DiscriminationAct, and France’s AccessiWeb.

IBM Rational Policy Tester Privacy Edition (h.p://www-306.ibm.com/software/awdtools/tester/policy/privacy/)- Reports on form, form controls, and Form GET inventory, pages collecting PersonallyIdentifiable Information (PII) and privacy policy links. Generates inventory of site privacy policies andchecks and checks for secure pages and encryption and third-party data sharing policies; maps technicalchecks to specific online requirements of laws and regulations, such as U.S. Children’s Online Privacy

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

86 of 165 8/12/2014 6:10 PM

Page 87: QTP Challenges 4 Experts _ Just Another WordPress

Protection Act (COPPA), Gramm-Leach-Bliley Act (GLBA) Privacy Rules, HIPAA, California SB1386 &AB1950 and AB1 950; Safe Harbor re European Community’s Directive on Data Protection; and U.S.Section 208.

TextTrust (h.p://www.tex.rust.com/)- Online service for one time or periodic full site spell checking;report includes listing of each text error with URL, built-in spelling mistake highlighter; correct yourerrors with Google suggestion lookup. System learns as it checks, detects industry terms and buzzwordssuch that only real errors are reported.

WireShark (h.p://www.wireshark.org/)- Network protocol analyzer available under the GNU GeneralPublic License. Capabilities include deep inspection of hundreds of protocols, live capture and offlineanalysis, standard three-pane packet browser, runs on most platforms. Captured network data can bebrowsed via a GUI, or via the TTY-mode TShark utility; rich VoIP analysis; read/write a very widevariety of different capture file formats. Live data can be read from Ethernet, IEEE 802.11, PPP/HDLC,ATM, Bluetooth, USB, Token Ring, Frame Relay, FDDI, and others. Decryption support for manyprotocols, including IPsec, ISAKMP, Kerberos, SNMPv3, SSL/TLS, WEP, and WPA/WPA2. Coloringrules can be applied to the packet list for quick, intuitive analysis. Output can be exported to XML,PostScript, CSV, or plain text

TPTest (h.p://sourceforge.net/projects/tptest)- An open source software suite for testing networkthroughput and Internet services. It consists of a software library with test functions that can beimplemented in test client and server applications. Reference client/server apps are also included.

BWMeter (h.p://www.desksoft.com/BWMeter.htm) – Bandwidth meter, monitor and traffic controller,which measures, displays and controls all traffic to/from computer(s) or on your network. Can analyzethe data packets (where they come from, where they go, which port and protocol they use). ForWindows platforms. Shareware.

Fiddler (h.p://www.fiddlertool.com/fiddler/) – HTTP Debugging Proxy which logs all HTTP trafficbetween your computer and the Internet. Fiddler allows you to inspect all HTTP Traffic, set breakpoints,and “fiddle” with incoming or outgoing data. Fiddler includes a powerful event-based scriptingsubsystem, and can be extended using any .NET language. Can debug traffic from virtually anyapplication. For Windows platforms. Freeware.

HTTP Interceptor (h.p://www.siliconwold.com/interceptor/interceptor_home.htm)- Low cost pseudoProxy server that performs h.p diagnostics and enables viewing of the two way communicationbetween browser and the Internet. View h.p, asp, h.p header, data headers, responses. Demo versionFree and paid versions available.

Expecco (h.p://www.expecco.net/)- A component based, modular test and quality assurance platformfrom eXept Software AG, which aims at the consolidation of tests and partial test systems into anautomated, interactive test center. Enables productivity improvement in creation and maintenance oftest scenarios, includes extensive debug features and flexible integration into existing enterprises.Features include utilization of UML 2.0 and Selenium libraries.

Aptixia IxLoad (h.p://www.ixiacom.com/)- Highly scalable, integrated test solution from Ixia Inc. forassessing the performance of Triple Play (Voice, Video and Data services) networks and devices. IxLoademulates IPTV and Triple Play subscribers and associated protocols to ensure subscriber Quality ofExperience (QoE). Protocols supported include video protocols like IGMP, MLD, and RTSP; voiceprotocols like SIP and MGCP; and data protocols like HTTP, FTP, and SMTP. Can be used to test critical

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

87 of 165 8/12/2014 6:10 PM

Page 88: QTP Challenges 4 Experts _ Just Another WordPress

aspects of the infrastructure like DNS, DHCP, RADIUS, and LDAP services, as well generate malicioustraffic to test for security. Also available are a wide variety of other related performance test tools to helpaccelerate the migration of communications and entertainment to IP.

Internet Explorer Developer Toolbar (h.p://www.microsoft.com/downloads/details.aspx?FamilyID=e59c3964-672d-4511-bb3e-2d5e1db91038&displaylang=en)- Microsoft add-on forIE that includes some tools for that can be useful for web testing. Includes tools to explore a page’sdocument object model (DOM), locate and select specific elements on a Web page through a variety oftechniques, view HTML object class names, ID’s, and details such as link paths, tab index values, andaccess keys; validate HTML, CSS, WAI, and RSS web feed links; view the forma.ed and syntax coloredsource of HTML and CSS; and more.

Web Service Scheduler (h.p://www.wsscheduler.com/)- WSS is an online cron service that can executecustom scripts remotely, for websites hosted on a web server with no access to a scheduling utility likecron or task scheduler. To use, just login and add the URL of the web service or script (PHP, ASP, CGI)and the time you would like the service to run. Basic account is free.

Chickenfoot (h.p://groups.csail.mit.edu/uid/chickenfoot/index.php)- An open source Firefox extensionfrom MIT that creates a programming environment in the Firefox sidebar, enables wrting of scripts tomanipulate web pages and automate web browsing. Scripts are wri.en in a superset of Javascript thatincludes special functions specific to web tasks.

WebAii (h.p://www.telerik.com/automated-testing-tools.aspx)- Free web automation framework fromTelerik that helps developers easily write functional tests for AJAX and Silverlight applications. Theframework offers one consistent API that allows users to automate the UI of web applications as part ofregression testing. Besides Silverlight support, a key benefit of WebAii Testing Framework is thebrowser abstraction, which allows developers to create a test once and execute it against all majorbrowsers – IE, FF, and Safari for Windows are currently supported.

sketchPath (h.p://www.sketchpath.com/)- Free XPath Editor and XML analysis and testing tool by PhilFearon supporting XPath 1.0 and 2.0. Capabilities includes: Provides integrated graphical environmentfor viewing XML files, developing and testing XPath expressions against them and managing theexpressions in file libraries. Auto-Generate XPath locations by selecting from XPath result list, regularexpression result list, element tree view, element nodes list, XML text editor, etc. Import XPathExpressions from an XML source (eg. XSLT). auto-complete uses ‘Look-Ahead’ to list available locationand value nodes when typing, XSD schema validation with fully-navigable invalid elements list. Useregular expressions to resolve XPath locations. And more. For Windows platforms.

soapUI (h.p://www.soapui.org/)- A free, open source desktop application from Eviware Software ABfor inspecting, invoking, developing, simulating/mocking and functional/load/compliance testing ofweb services over HTTP. It is mainly aimed at developers/testers providing and/or consuming webservices (java, .net, etc). Functional and Load-Testing can be done both interactively in soapUI or withinan automated build/integration process using the soapUI command-line tools. Mock Web Services canbe created for any WSDL and hosted from within soapUI or using the command-line MockServicerunner. IDE-plugins available for eclipse, IntelliJ IDEA, NetBeans and a specialized eclipse-plugin forJBossWS. Paid ‘pro’ version available with professional support and extended functionality.

SOAPscope Server (h.p://www.mindreef.com/products/coral/)- Web services test tool from MindreefInc./Progress Software; create test scenarios automatically by recording actions; share these with othertesters in collaborative server-baaed UI. View WSDL and SOAP messages in Pseudocode ViewTM.

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

88 of 165 8/12/2014 6:10 PM

Page 89: QTP Challenges 4 Experts _ Just Another WordPress

Create complex tests including passing values from a response to subsequent requests, perform batchtesting and validate results all without coding. Simulate web services that don’t yet exist, or newscenarios for those that do.

Parasoft SOAtest (h.p://www.parasoft.com/)- Scriptless web services test tool from Parasoft. Automatictest creation from WSDL, WSIL, UDDI and HTTP Traffic. Capabilities include WSDL validation, loadand performance testing; graphically model and test complex scenarios. Automatically creates securitypenetration tests for SQL injections, XPath injections, parameter fuzzing, XML bombs, and externalentities. Data-driven testing through data sources such as Excel, CSV, DB queries, etc. Support for JMS;MIME a.achment support.

QEngine (h.p://www.manageengine.com/)- ManageEngine QEngine Web Service Functional Test toolautomates functional testing of web services that are bound with the SOAP/HTTP binding.Automatically generates test scripts from a WSDL document and validates every operation published inthe WSDL document. The responses to each SOAP/HTTP request can be validated against the datasources such as CSV or Database.

Fault Factory (h.p://extradata.com/products/FaultFactory/)- API-level fault injection tool from fromExtradata Technologies; injects HTTP/SOAP/Socket faults into an application – no code changes, noproxies required. Injects two types of faults: socket API failures and arbitrary HTTP responses (that canbe used to imitate a wide range of conditions, including SOAP faults). Can be used standalone or incombination with a debugger. Language-neutral. For Windows platforms.

XML-Simulator (h.p://www.xml-simulator.com/)- Black-box test tool from Elvior for applications usingasynchronous XML messaging to communicate with different systems. Customizable to support anyXML protocol.

Tools4Internet (h.p://www.tools4internet.com/)- Free on-the-web tools for determination/testing ofvarious web page/site characteristics; results presented in convenient tabbed summary format. Includesbrowser/server security information tool for viewing details of h.p headers sent from web server andbrowser, along with other information obtainable via javascript and other publicly available means. WebContent Analysis capability includes response time, web page code comments lines, anchors, scripts, etc.

Firebug (h.p://www.getfirebug.com/)- Open source add-on tool for Firefox – allows editing,debugging, and monitoring of CSS, HTML, and JavaScript live in any web page. Monitor networkactivity, visualize CSS metrics, information about errors in JavaScript, CSS, and XML. Includes DOMexplorer; execute JavaScript on the fly.

GH Tester (h.p://www.greenhatsoftware.com/)- Middleware test automation tool, from Green HatConsulting Limited, for testing systems that do not have graphical user interfaces including webservices, JMS, IBM MQ, Sonic MQ, TIBCO, TCP/IP, UDP/IP and SmartSockets. Includes an API enablingwriting of your own transports. Schema-aware message editors for XML (DTD and XSD), SOAP (WSDL)and AE. Other capabilities: automatically create test plan documentation, record and playbackmessages, integrate with databases to simulate adapters by querying or changing rows, producedetailed reports on actual test results and expectations, including any differences

Filemon (h.p://www.microsoft.com/technet/sysinternals/utilities/filemon.mspx)- Free tool fromMicrosoft monitors and displays Windows file system activity on a system in real-time. Timestampingfeature shows when every open, read, write or delete, happens, and its status column indicates outcome.Useful in security testing, monitoring/testing of web servers etc. Also available (links available on

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

89 of 165 8/12/2014 6:10 PM

Page 90: QTP Challenges 4 Experts _ Just Another WordPress

Filemon page): RegMon – a Registry monitor; Process Monitor – a process and thread monitor; DiskMon– a hard disk monitor.

AceLive (h.p://www.opnet.com/)- Tool from OpNet Technologies Inc. for end-user experiencemonitoring and application performance management. Spans network monitoring, measurement, anddetection of SLA violations, and can bridges seamlessly into integrated and detailed transaction-leveltroubleshooting with OPNET’s ACE Analyst.

Charles (h.p://www.xk72.com/)- An HTTP proxy/monitor/Reverse Proxy that enables viewing allHTTP traffic between browser and the Internet, including requests, responses and HTTP headers (whichcontain the cookies and caching information). Capabilities include HTTP/SSL and variable modemspeed simulation. Useful for XML development in web browsers, such as AJAX (AsynchronousJavascript and XML) and XMLHTTP, as it enables viewing of actual XML between the client and theserver. Can autoconfigure browser’s proxy se.ings on MSIE, Firefox, Safari. Java application from XK72Ltd.

Paessler Site Inspector (h.p://www.paessler.com/)- A web browser that combines MSIE andMozilla/Gecko into one program; it’s Analyzing Browser allows switching between the two browserengines with the click of a mouse to compare. Freeware.

CookiePie Firefox Extension (h.p://nektra.com/oss/firefox/extensions/cookiepie/)- Firefox extensionfrom Sebastian Wain enabling maintenance of different cookies in different tabs and windows. Forexample developers working on web software supporting multiple users or profiles can use CookiePieto simultaneusly test their software with each user without needing to open a different browser.

Broken Link Preventer (h.p://www.siliconglen.com/software/links.html)- Link checker that reports onbroken links, reports statistics on user a.empts to access broken links, and enables broken linkprevention. Runs on server and constantly monitors site links.

JsUnit (h.p://www.jsunit.net/)- An open-source unit testing framework for client-side (in-browser)JavaScript in the tradition of the XUnit frameworks

Web Performance Advanced Server Analysis (h.p://www.webperformance.com/)- Add-on module forthe Web Performance Inc. Load Tester tool from Web Performance Inc. Automatically points outperformance problems in your operating system or application server; tracks performance counters inthe operating system or application server during a load test, marking those statistics that are obviouslyout of spec so you can quickly identify obvious performance problems. Statistics can be viewed duringthe test and reviewed later in reports for more detailed analysis.

Eclipse TPTP Testing Tools Project (h.p://www.eclipse.org/tptp/index.html)- TPTP (Test & PerformanceTools Platform) is a subproject of Eclipse, an open platform for tool integration. TPTP providesframeworks for building testing tools by extending the TPTP Platform. The framework contains testingeditors, deployment and execution of tests, execution environments and associated execution historyanalysis and reporting. The project also includes exemplary tools for JUnit based component testingtool, Web application performance testing tool, and a manual testing tool. The project supports the OMGUML2 Test Profile.

Test Architect (h.p://www.logigear.com/products/testarchitect/)- Keyword-driven test automation toolfrom LogiGear helps increase test coverage. Built-inplayback support for web-based application and other platforms.

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

90 of 165 8/12/2014 6:10 PM

Page 91: QTP Challenges 4 Experts _ Just Another WordPress

Networking and Server Test Utilities (h.p://www.hq42.net/net_tools/)- Small collection of web serverand other test utilities provided byhq42.net (h.p://hq42.net/).

Morae (h.p://www.techsmith.com/)- Usability test tool for web sites and software, from TechSmithCorp. for automated recording, analyzing and sharing of usability data. Consists of 3 components. ARecorder records and synchronizes video and data, creating a digital record of system activity and userinteraction. A Remote Viewer enables geographically dispersed observers to watch usability tests fromany location; it displays test user’s computer screen along with a picture-in-picture window displayingthe test participant’s face and audio; Remote Viewer observers can set markers and add text notes. TheManager component includes integrated editing functionality for assembly of important video clips toshare with stakeholders.

AutoTestFlash (h.p://osflash.org/autotestflash)- Freeware tool by Tiago Simoes for recording andplaying back UI Tests in flash applications. Source code also available.

Repro (h.p://www.reprosoftware.com/)- Manual testing ‘helper’ tool that records desktop video,system operations in 7 different categories, system resource usage, and system configurationinformation. Allows user to save and review relevant information for bug reports, and compress theresult into a very small file to replay, upload to a bug tracking system, and share with others.Instruments in memory the target application at runtime so no changes are required to applicationunder test. For Windows.

TestGen (h.p://testgen.tigris.org/)- Free open-source web test data generation program that allowsdevelopers to quickly generate test data for their web-services before publicly or internally releasing theweb service for production.

EngineViewer and SiteTimer (h.p://www.webscale.com/)- Free basic services: EngineViewer – reportson how a search engine may view a webpage, from how it breaks down the HTML, to which links itextracts, how it interprets page’s robot exclusion rules and more. SiteTimer service – Find out how longit takes various connection types to get a page, check all the graphical links to ensure they’re correct,examine server’s HTTP headers, more.

Fiddler (h.p://www.fiddlertool.com/fiddler/)- An HTTP Debugging tool by Eric Lawrence. Acts as anHTTP Proxy running on port 8888 of local PC. Any application which accepts an HTTP Proxy can beconfigured to run through Fiddler. Logs all HTTP traffic between between computer and the Internet,and allows inspection of the HTTP data, set breakpoints, and “fiddle” with incoming or outgoing data.Designed to be much simpler than using NetMon or Achilles, and includes a simple but powerfulJScript.NET event-based scripting subsystem. Free, for Windows.

FREEping (h.p://www.tools4ever.com/)- Free ping software utility from Tools4ever which will ping allyour Windows-based servers (or any other IP address) in freely-definable intervals. Will send a popupwhen one of the servers stops responding.

IP Traffic Test and Measure (h.p://www.omnicor.com/netest.htm)- Network traffic simulation and testtool from Omnicor Corp. can generate TCP/UDP connections using different IP addresses; data creationor capture and replay; manage and monitor throughput, loss, and delay.

VisitorVille (h.p://www.visitorville.com/)- Site traffic monitoring tool from World Market Watch Inc.that depicts website visitors as animated characters in a virtual village; users can watch their web traffic

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

91 of 165 8/12/2014 6:10 PM

Page 92: QTP Challenges 4 Experts _ Just Another WordPress

as if they’re watching a movie.

Sandra (h.p://www.sisoftware.co.uk/)- ‘System ANalyser, Diagnostic and Reporting Assistant’ utilityfrom SiSoftware. Provides large variety of information about a Windows system’s hardware andsoftware. Includes CPU, mainboard, drives, ports, processes, modules, services, device drivers, ODBCsources, memory details, environment se.ings, system file listings, and much more. Providesperformance enhancing tips, tune-up wizard, file system and memory bandwidth benchmarking, more.Reporting via save/print/fax/email in text, html, XML, etc. Free, Professional, and other versionsavailable in multiple languages.

Deque (h.p://www.deque.com/)- Deque Ramp is a cross-platform solution for testing and remediatingwebsites and Web-based applications for integrated accessibility and Section 508 compliance. Audits andcorrects accessibility violations and helps organizations develop long-term practices to enhanceaccessibility for users with disabilities. Available versions include Ramp Personal Edition, Ramp Grade,and Ramp Ascend. Ramp PE version is free for some user categories such as non-profit organizations.Other products include Worldspace Online, an online accessibility test and repair tool.

Browser Cam (h.p://www.browsercam.com/)- Service from Gomez Inc./Compuware for webdevelopers and testers; it creates screen captures of web pages loaded in any browser, any version, anyoperating system. Check javascripts, DHTML, forms and other dynamic functionality on any platform.Allows viewing of web page appearance on Windows, Linux, Macintosh, in most versions of everybrowser ever released.

Dummynet (h.p://info.iet.unipi.it/%7Eluigi/ip_dummynet/)- Flexible tool developed by Luigi Rizzo,originally designed for testing networking protocols, can be used in testing to simulate queue andbandwidth limitations, delays, packet losses, and multipath effects. Can be used on user’s workstations,or on FreeBSD machines acting as routers or bridges.

HTTP Interceptor (h.p://allh.p.com/interceptor/) – A real-time HTTP protocol analysis andtroubleshooting tool from AllHTTP.com. View all headers and data that travel between your browserand the server. Split-screen display and dual logs for request and response data. Interceptor also allowschanging of select request headers on-the-fly, such as “Referrer” and “User Agent”.

SpySmith (h.p://agilethinking.net/qualityforge/)- Simple but powerful diagnostic tool from QualityForge; especially useful when testing web sites and web-based applications. It allows the user to peekinside I.E. Browser-based Documents (including those without a ‘view source’ command) to extractprecise information about the DOM elements in an HTML source. SpySmith can also spy on Windowsobjects. For Windows. Free 90-day trial.

Co-Advisor (h.p://coad.measurement-factory.com/)- Tool from The Measurement Factory for testingquality of protocol implementations. Co-Advisor can test for protocol compatibility, compliance,robustness, security, and other quality factors. Has modules for HTTP (RFC 2616) and ICAP (RFC 3507)protocols . Other info: runs on FreeBSD packages, Linux RPMs, Windows (on-demand); available ason-line service, binaries, or source code.

PocketSOAP (h.p://www.pocketsoap.com/)- Packet-capture tool by Simon Fell, with GUI; captures anddisplays packet data between local client and specified web server. Can log captures to disk. ForWindows; binaries and source available; freeware. Also available is PocketXML-RPC and PocketHTTP.

TcpTrace (h.p://www.pocketsoap.com/)- Tool by Simon Fell acts as a relay between client and server

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

92 of 165 8/12/2014 6:10 PM

Page 93: QTP Challenges 4 Experts _ Just Another WordPress

for monitoring packet data. Works with all text-based IP protocols. For windows; freeware

ProxyTrace (h.p://www.pocketsoap.com/)- Tool by Simon Fell acts as a proxy server to allow tracing ofHTTP data; can be used by se.ing browser to use it as a proxy server and then can monitor all traffic toand from browser. Freeware.

tcptrace (h.p://irg.cs.ohiou.edu/software/tcptrace/tcptrace.html)- Tool wri.en by Shawn Ostermann foranalysis of TCP dumpfiles, such as those produced by tcpdump, snoop, etherpeek, HP Net Metrix, orWinDump. Can produce various types of output with info on each connection seen such as elapsedtime, bytes, and segments sent and received, retransmissions, round trip times, window advertisements,throughput, and various graphs. Available for various UNIX flavors, for Windows, and as source code;freeware.

MITS.Comm (h.p://www.omsphere.com/)- Tool from Omsphere LLC for simulating virtually anysoftware interface (internal or external). Allows testing without pitfalls associated with live connectionsto other systems (TCP/IP, Ethernet, FTP, etc). Allows developers to test down to the unit level bysimulating the internal software interfaces (message queues, mailboxes, etc.) Tool can learn whatrequest/response scenarios are being tested for future tests and can work with any protocol, anymessage definitions, and any network. Also available: MITS.GUI

XML Conformance Test Suite (h.p://www.w3.org/XML/Test/)- XML conformance test suites from W3Cand NIST; contains over 2000 test files and an associated test report (also in XML). The test reportcontains background information on conformance testing for XML as well as test descriptions for each ofthe test files. This is a set of metrics for determining conformance to the listed W3C XMLRecommendation.

Certify (h.p://www.worksoft.com/)- Test automation management tool from WorkSoft, Inc. Formanaging and developing test cases and scripts, and generating test scripts. For automated testing ofWeb, client/server, and mainframe applications. Runs on Windows platforms.

HiSoftware AccVerify (h.p://www.hisoftware.com/)- Tool for testing site accessibility, usability,searchability, privacy and Intellectual Property policy verification; from HiSoftware Inc. Also customchecks and test suites to meet organization’s standards. Can crawl a site and report errors; can alsoprogrammatically fix most common errors found. Runs on Windows.

HiSoftware Web Site Monitor (h.p://www.hisoftware.com/)- Tool allows user to monitor servers andsend alerts, allows monitoring web sites for changes or misuse of intellectual property in metadata or inthe presented document; link validation. From HiSoftware Inc.

Web Optimizer (h.p://www.v-tech.ws/products/wo.htm)- Web page optimizing tool from VisionaryTechnologies intelligently compresses web pages to accelerate web sites without changing site’sappearance. Removes unnecessary information in HTML, XML, XHTML, CSS, and Javascript andincludes GIF and JPEG optimizer techniques.

HTML2TXT (h.p://www.hdse.org/html2txt/)- Conversion utility that converts HTML as rendered inMS Internet Explorer into ASCII text while accurately preserving the layout of the text. Included withsoftware are examples of using the control from within Visual Basic, Visual C++, and HTML.

Team Remote Debugger (h.p://www.remotedebugger.com/default_trd.asp)- Debugging tool fromSpline Technologies allows tracing of any number of code units of any kind ( ASP, MTS, T-SQL, COM+,ActiveX Exe, DLL, COM, Thread, CFML ), wri.en in any language ( ASP, VB, VC++, Delphi, T-SQL, VJ,

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

93 of 165 8/12/2014 6:10 PM

Page 94: QTP Challenges 4 Experts _ Just Another WordPress

CFML ) residing on multiple shared and dedicated servers at the same time, without ever a.aching toprocess. Remote code can pass messages and dialogs directly to your local machine via Team RemoteDebugger component, and developers can then debug their respective code independently of oneanother no ma.er if the code units reside on the same servers or on different servers or on anycombination thereof.

Datatect (h.p://www.datatect.com/)- Test data generator from Banner Software generates data to a flatfile or ODBC-compliant database; includes capabilities such as scripting support that allows user towrite VBScripts that modify data to create XML output, data generation interface to Segue SilkTest,capability to read in existing database table structures to aid in data generation, wide variety of datatypes and capabilities for custom data types. For Windows.

Triometric Performance Analyzer Suite (h.p://www.triometric.net/)- Suite of software protocolanalyzers from Triometric accurately calculates end-to-end download speeds for each transaction, notjust samples; produces a range of configurable reports that breaks down info into network and serverspeeds, errors, comparison to SLA’s, performance for each server, client, URL, time period, etc.

WebBug (h.p://www.cyberspyder.com/) – Debugging tool from Aman Software for monitoring HTTPprotocol sends and receives; handles HTTP 0.9/1.0/1.1; allows for entry of custom headers. Freeware.

WebMetrics (h.p://zing.ncsl.nist.gov/WebTools/)- Web usability testing and evaluation tool suite fromU.S. Govt. NIST. Source code available. For UNIX, Windows.

MRTG (h.p://oss.oetiker.ch/mrtg/) – Multi Router Traffic Grapher – free tool by Tobi Oetiker utilizingSNMP to monitoring traffic loads on network links; generates reports as web pages with GIF graphicson inbound and outbound traffic. For UNIX, Windows.

Automate your repetative tasks on windows

05 SEP 2011 1 Comment

by vsprasad2k in challenges, QTP, QTP Tricks, Uncategorized

AutoHotkey is a free, open-source utility for Windows. With it, you can:

Automate almost anything by sending keystrokes and mouse clicks. You can write a mouse orkeyboard macro by hand or use the macro recorder.Create hotkeys for keyboard, joystick, and mouse. Virtually any key, bu.on, or combination canbecome a hotkey.Expand abbreviations as you type them. For example, typing “btw” can automatically produce “bythe way”.Create custom data-entry forms, user interfaces, and menu bars. See GUI for details.Remap keys and bu.ons on your keyboard, joystick, and mouse.Respond to signals from hand-held remote controls via the WinLIRC client script.Run existing AutoIt v2 scripts and enhance them with new capabilities.Convert any script into an EXE file that can be run on computers that don’t have AutoHotkey

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

94 of 165 8/12/2014 6:10 PM

Page 95: QTP Challenges 4 Experts _ Just Another WordPress

installed.

For Download use:h.p://www.autohotkey.com (h.p://www.autohotkey.com)

Message Box closes automatically using windows shell

05 SEP 2011 Leave a comment

by vsprasad2k in challenges, QTP, QTP Tricks, Uncategorized

Dim msgmsg = “Message Box automatically close in 5 second”Set oShell = CreateObject(“WScript.Shell”)oShell.Popup msg,10, “QTP Challenges”In above statement, there are three arguments -msg – the content/string of the message box10 – the time in seconds“QTP Challenges” – the title of the message box

Working with WMI (Windows Management Infrastructure)

05 SEP 2011 Leave a comment

by vsprasad2k in challenges, QTP, QTP Tricks, Uncategorized

Dim flag, AllProcess, AppToRunAppToRun = “ixplore.exe”Flag = FlaseSet AllProcess = GetObject(“winmgmts:”)

For Each Process In AllProcess.InstancesOf(“Win32_process”)If (Instr ((Process.Name), AppToRun) = 1) ThenPrint “Internet Explorer is running..”Flag = TureExit ForEnd IfNext

If Flag = Flase ThenPrint “Internet Explorer not is running..”SystemUtil.Run AppToRun

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

95 of 165 8/12/2014 6:10 PM

Page 96: QTP Challenges 4 Experts _ Just Another WordPress

End If

You can do the same for any process/application. You just need to change the value of AppToRunvariable.

History of Quick Test Professional

05 SEP 2011 Leave a comment

by vsprasad2k in challenges, QTP, QTP Tricks, Uncategorized

QTP 5.5v – 2002

QTP 6.5 v & 7.6 – (2003 -2004)

QTP8.0 & 8.2 – 2005

QTP9.0 – 2008

QTP 9.2 & 9.5 – 2009

QTP 10 – 2009

QTP 11 – 2010

QTP 11 Installation Issues/Errors

05 SEP 2011 Leave a comment

by vsprasad2k in challenges, QTP, QTP Tricks, Uncategorized

Notes and Limitations

This section includes the following:

Before You Install

Supplemental Information

:)

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

96 of 165 8/12/2014 6:10 PM

Page 97: QTP Challenges 4 Experts _ Just Another WordPress

Before You Install

This section includes information that is important for you to know before you install QuickTest.

You cannot install QuickTest when a McAfee Anti-Virus application is running.

Workaround: Disable the antivirus application during the QuickTest installation process.

QuickTest Professional supports the Sentinel RMS License Manager version 8.3.0 as its concurrentlicense server. Earlier versions of the concurrent license server are not supported.

QuickTest does not support Windows user names with non-English le.ers. If you log in to Windowsusing a user name (with administrative privileges) that contains non-English characters and theninstall QuickTest, the installation may complete successfully, but you may not be able to openQuickTest or it may not behave correctly.

The path in which installation files for QuickTest are located, and the path in which QuickTest isinstalled, can contain only English characters.

When upgrading to QuickTest 11.00 from a QuickTest 9.5 or 10.00 installation on which a LanguagePack (localized version of QuickTest) was previously installed, you may get an error message whenopening QuickTest after the upgrade.

Workaround: Repair the installation:

In the Control Panel, select Add/Remove Programs and select the HP QuickTest Professional entry.

Click the Change bu.on.

In the installation wizard that opens, choose the Repair option and follow the on-screen instructions.

If you install QuickTest 11.00 while the QTPNET_00015 patch (a QuickTest 10.00 patch) is installedon your computer, QuickTest may behave unexpectedly.

Workaround:

Open the Add/Remove Programs dialog box from the Control Panel.

Display the installed patches by selecting the Show updates check box (or click the View InstalledUpdates bu.on, depending on your operating system version.)

Locate HP QuickTest Professional in the list and check whether QTPNET_00015 for HP QuickTestProfessional 10.00 QFE is listed as an installed update.

If it is installed, click Remove to uninstall this patch before you install QuickTest 11.00.

If you want to work with .NET 4.0, it is best to install it before you install QuickTest. If you install.NET 4.0 after you install QuickTest, you must manually register two .NET DLLs as follows:

In <QuickTest installation folder>\GlobalAssemblyCache\Net4, execute the following commands:

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

97 of 165 8/12/2014 6:10 PM

Page 98: QTP Challenges 4 Experts _ Just Another WordPress

..\..\bin\GACRegUtil4x86.exe -i Mercury.QTP.Agent.dll

..\..\bin\GACRegUtil4x86.exe -i Mercury.QTP.WpfAgent.dll

In Windows XP and Windows 2003, if you install the Oracle Add-in, the Windows Remote ShellService (rshsvc.exe) may fail and display an error message every time you restart the computer. Thisoccurs only if the Remote Shell Service is configured to run automatically.

Supplemental Information

Use the information in this section as a supplement to the product documentation.

Additional troubleshooting information, guidelines, and feature-specific limitations are described in therelevant locations of the installation and product documentation. Make sure you are aware of thoseissues when working with the relevant features.

This section includes the following:

Installation

Operating Systems

General

Web Add-in

Silverlight Add-in

Quality Center and Business Process Testing

Documentation

Internationalization

Installation

When you install a new QuickTest 11.00 installation and you specify a single concurrent licenseserver in the License Wizard, QuickTest now automatically specifies the server in an LSFORCEHOSTenvironment variable, to optimize performance. However if you perform an upgrade from QuickTest10.00, and you already had an LSHOST variable defined, the upgrade installation does not changethe se.ing to LSFORCEHOST.

Workaround: If desired, set the LSFORCEHOST variable manually, as described in the HP FunctionalTesting Concurrent License Server Installation Guide.

If you manually set an LSHOST environment variable to a particular server (or upgrade from a

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

98 of 165 8/12/2014 6:10 PM

Page 99: QTP Challenges 4 Experts _ Just Another WordPress

previous version of QuickTest where the LSHOST variable was set), QuickTest sometimes gets itslicense from another server, even when the specified server has the required licenses available.

Workaround: To ensure that a specific server will be used, specify an LSFORCEHOST environmentvariable instead.

Operating Systems

If you work with QuickTest on a Windows 7 operating system with User Account Control (UAC) turnedon, and you open a test from a protected location (such as Program Files), it is opened in read-onlymode and a message is displayed that you do not have permissions to open it in read-write mode.

General

When you save a test using the Save Test with Resources option, it also saves any tests containingcalled external actions. However, to preserve space, these called tests contain only the called actions,and not all of the actions from the original test. Therefore, you cannot open these called tests inQuickTest from the local copy.

Workaround: If you need to have full access to the called tests as well as the main test that you saveusing the Save Test with Resources option, then you must manually save all required tests locally andthen manually edit all references to the relevant actions from the main test to the actions it calls.

Web Add-in

The If Handler option in the Web Event Recording Configuration dialog box works on MozillaFirefox browsers only if the handler is assigned as an a.ribute (for example, <A onclick = “somecode”/>) and not if it is assigned as a property (for example, aObj.onclick = function() {some code})

Silverlight Add-in

When Silverlight applications are opened in two tabs sequentially (without QuickTest performingany operations on the first one before the second opens), QTP will use a custom server to supportcontrols only in the first application with which you interact. The same is true when two tabs arerefreshed sequentially.

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

99 of 165 8/12/2014 6:10 PM

Page 100: QTP Challenges 4 Experts _ Just Another WordPress

Workaround: Perform an operation (for example, use the Object Spy) with the first tabopened/refreshed before opening/refreshing the second one.

If a Web page contains a Silverlight application that is windowless and is scrolled out of view whenthe page opens the first time, QuickTest will not be able to make this application visible. (Forexample, in this scenario, QuickTest will not be able to perform an SlvWindow.MakeVisible step).

Quality Center and Business Process Testing

When comparing two baselines, if the only change in a resource is its association to a test orcomponent, the Asset Comparison Tool does not indicate any change in the resource even thoughHP ALM or Quality Center may indicate that the resource is Modified.

If an HP ALM or Quality Center user manually changes the status of a test instance run, HPALM/Quality Center creates something called fast run results to record the change of the test status.The fast run results are not valid QuickTest run results files. However, when you try to select resultsto open or delete in the Run Results Viewer or Run Results Deletion tool, the fast run results areavailable in the list.

After you run a component locally in QuickTest, you cannot use the Jump to Step in QuickTestoption from the Run Results Viewer.

You cannot perform a remote execution of a business process test on a Windows 2008 R2 QuickTestcomputer.

Documentation

The QuickTest Help Index tab contains only reference items, such as objects, methods, properties,and functions. It does not contain any entries from the user guides.

To search for information from all the documents in the QuickTest Documentation Library, use theSearch tab.

On some operating systems or after installing certain Windows service packs or updates, you maynot be able to view the content of some Help files.

Workaround:

Right-click the CHM file in <QTP installation folder)\help, and click Properties.

In the dialog box that opens, click Unblock.

For details, see h.p://support.microsoft.com/kb/902225 (h.p://support.microsoft.com/kb/902225)

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

100 of 165 8/12/2014 6:10 PM

Page 101: QTP Challenges 4 Experts _ Just Another WordPress

Internationalization

If you are working with a QuickTest User Interface Pack, install it before running QuickTest for thefirst time, if possible.

If you install a QuickTest User Interface Pack after running QuickTest, the following items may remainin English after installing the User Interface Pack:

Menus and toolbars in the Object Repository window (in QuickTest or in the Object RepositoryManager)

The Find dialog box in the Expert View

Workaround: Close QuickTest and delete the folder: %APPDATA%\HP\QuickTest Professional(For example, C:\Documents and Se%ings\<username>\Application Data\HP\QuickTest Professional).

When working on an operating system using a Spanish locale, you may get an assertion errormessage at the beginning of the QuickTest installation.

Workaround: Modify the sLanguage registry key value as follows:

In the Start > Run dialog box, type: regedit.

Go to the registry path: HKEY_CURRENT_USER\Control Panel\International

Change the sLanguage value from ES to ESN

If the above steps do not solve the problem, restart your computer and try again.

Run the QuickTest installation again.

Selecting the View Sample Snapshot option in the QuickTest Asset Comparison Tool opens awindow containing a sample image of the selected element in QuickTest. The image displays theEnglish user interface.

The Add-in Extensibility SDKs are not localized.

Hello world!

01 SEP 2011 1 Comment

by vsprasad2k in Uncategorized

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

101 of 165 8/12/2014 6:10 PM

Page 102: QTP Challenges 4 Experts _ Just Another WordPress

Welcome to WordPress.com (h.p://wordpress.com/). After you read this, you should delete and writeyour own post, with a new title above. Or hit Add New (/wp-admin/post-new.php) on the left (of theadmin dashboard (/wp-admin)) to start a fresh post.

Here (h.p://learn.wordpress.com/) are some suggestions for your first post.

You can find new ideas for what to blog about by reading the Daily Post

(h.p://dailypost.wordpress.com/).

1.

Add PressThis (/wp-admin/tools.php) to your browser. It creates a new blog post for you about any

interesting page you read on the web.

2.

Make some changes to this page (/wp-admin/post.php?post=1&action=edit), and then hit preview on

the right. You can always preview any post or edit it before you share it to the world.

3.

Over and above features provided with QTP 8.2 to QTP9.5

23 AUG 2011 Leave a comment

by vsprasad2k in QTP

Over and above features provided with QTP 9.0 , QTP 9.2 provides following

features:

Mercury Screen Recorder : Dynamic Management of Object Repositories:

Mercury Screen Recorder:Capture your entire run session in a movie clip or capture only the segments with errors, and then viewyour movie from the Test Results window.Dynamic Management of Object Repositories:QuickTest now has a new Repositories Collection reserved object that you can use to programmaticallymanage the set of object repositories that are associated with an action during a run session.

Over and above features provided with QTP 8.2 , QTP 9.0 provides following

features:

Object Repository Manager: XML Object Repository Format:

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

102 of 165 8/12/2014 6:10 PM

Page 103: QTP Challenges 4 Experts _ Just Another WordPress

Object Repository Merge Tool: Function Library Editor:

Multiple Object Repositories per Action: Handling Missing Actions and

Resources:

Object Repository Manager:You can use the Object Repository Manager to manage all of the shared object repositories in yourorganization from one, central location. This includes adding and defining objects, modifying objectsand their descriptions, parameterizing test object property values, maintaining and organizingrepositories, and importing and exporting repositories in XML format.You can open multiple object repositories at the same time. Each object repository opens in its ownresizable document window. This enables you to compare the content of the repositories, to copy ormove objects from one object repository to another, and so forth.Object Repository Merge Tool:You can use the Object Repository Merge Tool to merge the objects from two shared object repositoriesinto a single shared object repository. You can also use the Object Repository Merge Tool to mergeobjects from the local object repository of one or more actions or components into a shared objectrepository.

When you merge objects from two source object repositories, the content is copied to a new, target objectrepository, ensuring that the information in the source repositories remains unchanged.

If any conflicts occur during the merge, for example, if two objects have the same name and test objectclass, but different test object descriptions, the relevant objects are highlighted in the source repositories,and the Resolution Options pane details the conflict and possible resolutions.Multiple Object Repositories per Action or Component:QuickTest provides several options for storing and accessing test objects. You can store the test objectsfor each action or component in its corresponding local object repository, which is unique for each actionand component. You can also store test objects in one or more shared object repositories that can be usedin multiple actions and components. Alternatively, you can use a combination of objects from the localobject repository and one or more shared object repositories. You choose the combination that matchesyour testing needs.XML Object Repository Format:QuickTest now enables you to import and export object repositories from and to XML format. Thisenables you to modify object repositories using the XML editor of your choice and then import themback into QuickTest. You can import and export files either from and to the file system or a QualityCenter project (if QuickTest is connected to Quality Center).Function Library Editor:QuickTest now has a built-in function library editor, which enables you to create and edit functionlibraries containing VBScript functions, subroutines, modules, and so forth, and then call their functionsfrom your test or component.

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

103 of 165 8/12/2014 6:10 PM

Page 104: QTP Challenges 4 Experts _ Just Another WordPress

Handling Missing Actions and Resources:Whenever a testing document (test, component, or application area) contains a resource that cannot befound, QuickTest opens the Missing Resources pane and lists the missing resource(s). For example, a testmay contain an action or a call to an action that cannot be found; a testing document may use a sharedobject repository that cannot be found; or a testing document may use a object repository parameter thatdoes not have a default value. In all of these cases, QuickTest indicates this in the Missing Resourcespane, enabling you to map a missing resource to an existing one, or remove it from the testingdocument, as required.

Working with XML files using QTP

22 AUG 2011 Leave a comment

by vsprasad2k in Uncategorized, XML Compare Tags: QTP XML Comparision

Extracting XML from a URL or WebBrowser

‘open internet explorer with xml url

SystemUtil.Run “iexplore.exe”, “h.p://mywebsite/set.xml&#8221 (h.p://mywebsite/set.xml&#8221);

Browser(“creationtime:=0″).sync

‘ Get XML Document

Set xmlDoc = Browser(“creationtime:=0″).WebXML(“micClass:=WebXML”).GetData()

‘Save the document locally

xmlDoc.SaveFile “C:\File1.xml”

Compare two XML Documents:

‘We can also use XMLUtil in an exteranal VBScript by using the following QTP COM object

Set XMLUtil = CreateObject(“Mercury.XMLUtil”) ‘QTP XMLData object

‘Load both XMLs

Set xmlDoc1 = XMLUtil.CreateXMLFromFile (“C:\File1.xml”)

Set xmlDoc2 = XMLUtil.CreateXMLFromFile (“C:\File2.xml”)

‘Use the compare method fo the XML to check if they are equivalent

isEqual = xmlDoc1.Compare(xmldoc2,xmlResults)

‘If return value of compare method is 1 that mean the files are equal

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

104 of 165 8/12/2014 6:10 PM

Page 105: QTP Challenges 4 Experts _ Just Another WordPress

If isEqual =1 Then

Msgbox “The documents match”

Else

Msgbox “The documents don’t match”

End if

QTP Implement Web Extensibility Add-in

21 AUG 2011 Leave a comment

by vsprasad2k in Uncategorized, Web Extensibility Add-in Tags: QTP Web Extensibility Add-in

Using Web Add-in Extensibility, you can implement full support for all QuickTest features for yourcontrols. You can implement Web Add-in Extensibility support for a set of controls (also referred to as atoolkit or custom toolkit) by developing a toolkit support set.

Implementing Web Add-in Extensibility consists of the following stages:

1. Planning the Toolkit Support Set

- Determine the set of Web controls that comprise your custom toolkit.

- Define the test object model by determining which test objects and operations you want to supportbased on the controls and business processes supported by your toolkit.

2. Developing the Toolkit Support Set: A Web Add-in Extensibility toolkit support set is comprised ofthe following files:

- One test object configuration file, which describes the test object model for your toolkit to QuickTest.

- One toolkit configuration file, which describes which test object class represents each control in thetoolkit and how QuickTest interacts with each control.

- One or more files containing JavaScriptsthat QuickTest can call to perform operations on the customcontrols.3. Deploying the Toolkit Support Set: To deploy your toolkit support set and enable QuickTest tosupport your controls, you need to copy the files you created to specific locations within the QuickTestinstallation folder folder.

After you deploy the toolkit support set, when QuickTest opens, it displays your toolkit name as a childnode under the Web Add-in node in the Add-in Manager. If you select the check box for your toolkit,QuickTest supports the controls in this toolkit using the toolkit support set that you developed.

4. Enhancing the Toolkit Support Set: After you have created and tested basic Web Add-in Extensibility

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

105 of 165 8/12/2014 6:10 PM

Page 106: QTP Challenges 4 Experts _ Just Another WordPress

support for your controls you can enhance your toolkit support set by using some of the more complexoptions to fine-tune your support.

When you develop a Web Add-in Extensibility toolkit support set, you can start by creating a simple andbasic support set and deploying it to QuickTest. This enables QuickTest to recognize your controlscorrectly and enables QuickTest user to create and run testson the controls. You can then enhance yoursupport to enable more complex capabilities, such as filtering the child objects learned with a controland more advanced handling of events when recording a test.

Exporting the Results of a Query to DataTable

21 AUG 2011 Leave a comment

by vsprasad2k in challenges, QTP, QTP Tricks

‘fifirst create a datatable to export the data

Set outsheet = DatTable.addsheet(“output”)

Dim adoRecordSet = adoCon.Execute(strSQL)

dim fld

‘Loop through each field and get the name to create the data table parameters

For each fld in adoRecordSet.Fields

outSheet.AddParameter Replace(fld.name,””,”_”)

Next

‘Loop through all the rows of the query

While adoRecordSet.eof()

For each fld in adoRecordSet.Fields

outSheet.GetParameter(Replace(fld.name,””,”_”)).value=fld.value

Next

adoRecordSet.MoveNext ‘Move on to the next record

Wend

Set adoRecordSet = Nothing

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

106 of 165 8/12/2014 6:10 PM

Page 107: QTP Challenges 4 Experts _ Just Another WordPress

Note:

We can even execute a Stored DB procedure using ADODB.Command

Exp:

Set adoCommand = CreateObject(“ADODB.Command”)

With adoCommand

.ActiveConnection =adoCon

.CommandTimeout = 30

.CommandType = 4 ‘adCmdStoredProc

.CommandText = “Authentication”

Working with Document Object Model(DOM)

21 AUG 2011 Leave a comment

by vsprasad2k in Uncategorized

What is Document object Model?

A platform- and language-independent standard

object model for representing HTML or XML and

related formats.

For QTP’s sake, I would redefine it to make it simpler. DOM is a method for QTP engineers to access thesource (IE –> View –> Source) of any webpage direct through VB Scripting.

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

107 of 165 8/12/2014 6:10 PM

Page 108: QTP Challenges 4 Experts _ Just Another WordPress

When can we use DOM?

One of the very important places you can use it is when a QTP web table checkpoint doesn’t show youthe desired content in a cell. I mean the content in the cell is in a format that is not supported by the webtable checkpoint. Another use can be when you want to access all the HTML tags used in a webpage.You can get the names, the innertext, innerHTML property of all these tags. The possibilities are endless.

How can we use DOM to access the source page?

We can access the source page of any webpage using .objectnotation.

Any practical example of using DOM?

I have created a demo web page to show you document object model in action. Say you want to find thefont color used for writing HappyHolidays Everyone in cells of the webtable given on this page. Thealgorithm would be:

Access the DOM of webtable using .object notation.1.

Access the tagname corresponding to the property you wish to find out. In our case tagname is

“font” and property to be explored is “color”.

2.

Find the count of total number of tags and loop it find out the font-color.3.

QuickTestProfessional 11-New Features

21 AUG 2011 Leave a comment

by vsprasad2k in challenges, QTP, QTP Tricks Tags: QTP11 New Features

QuickTest 11-New Features (h.p://qtpchallenge.files.wordpress.com/2011/08/quicktest-11-new-features.doc)

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

108 of 165 8/12/2014 6:10 PM

Page 109: QTP Challenges 4 Experts _ Just Another WordPress

Reading data from excel at one go using vb scripting

12 AUG 2011 Leave a comment

by vsprasad2k in Uncategorized

Dim intArray ‘ stores the data as array

intArray =xlworksheet.UsedRange ‘Get the range which has data

rowcount = UBound(intArray,1) ‘Ge.ing the size of the array

colCount=UBound(intArray,2)

‘Loop through the array

For i = LBound(iArray,1) to rowCount

For j=LBound(iArray,2) to colcount

Msgbox intArray(i,j)

Next

Next

Features and Tips of QTP 10.0v

12 AUG 2011 Leave a comment

by vsprasad2k in challenges, QTP, QTP Tricks

You can create multiple application areas to suit different components.1.

NEW!! Business components associated with an application area use only the resources and

se.ings that are defined in the application area. In previous versions of QuickTest Professional,business components could have custom se.ings.

2.

The RegisterUserFunc statement now has an optional argument that you can use to set a function

as the default operation for a test object.

3.

You can use the new Function Definition Generator to easily generate user-defined functions

(Insert > Function Definition Generator).

4.

Iterations for a business component are defined in Quality Center.5.

The Operation item appears in the Keyword View only when functions are defined in function

library files associated with the component’s application area.

6.

1.

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

109 of 165 8/12/2014 6:10 PM

Page 110: QTP Challenges 4 Experts _ Just Another WordPress

NEW!! You can manage the availability of keywords used to create keyword-driven components

using the new Keywords pane in the application area of QuickTest Professional.

7.

The Function Definition Generator enables you to add documentation that specifies exactly what

a step using your function does. This description is shown in the Documentation column of theKeyword View for steps that use the function.

8.

NEW!! You can associate a function library with the open test by opening the function library and

choosing File > Associate Library ‘library_name’ with ‘test_name’.

9.

NEW!! You can check syntax errors by clicking CTRL + F7. If your script contains errors you can

view them in the new Information pane.

10.

When adding a new step using the Keyword View or Step Generator, you can select a new object

from your application and it is automatically added to your object repository.

11.

You can specify which columns you want to display in the Keyword View. Choose Tools > View

Options or right-click any column header in the Keyword View.

12.

You can specify the order in which columns are displayed in the Keyword View. Choose Tools >

View Options or drag a column header to a new location in the Keyword View.

13.

You can print the contents of the Keyword View to your Windows default printer, or preview it

on screen before printing. Click the Print bu.on or choose File > Print.

14.

You can copy and paste or drag and drop steps in order to move them to a different location

within the Keyword View.

15.

You can enter a comment about a step in the Keyword View by clicking in the Comment cell. You

can also enter a comment on a new line below the currently selected step by choosing Insert >Comment.

16.

You can view the Documentation column in the Keyword View to read a summary of what the

step does, in an easy-to-understand sentence.

17.

NEW!! You can copy the content of the Documentation column to the Clipboard by right-clicking

any column header in the Keyword View and choosing Copy Documentation to Clipboard.

18.

The Select Object for Step dialog box enables you to select a new object from your application. If

you select an object in your application that is not in the object repository, the object is added tothe object repository when you insert the new step.

19.

If you are connected to Quality Center, you can view the current Quality Center connection by

pointing to the Quality Center icon in the status bar. To open the Quality Center Connectiondialog box, double-click the Quality Center icon.

20.

If a Quality Center test or shared file (such as a shared object repository or Data Table file) is open

when you disconnect from Quality Center, then QuickTest closes it.

21.

To access QuickTest tests or components from Quality Center, select the ‘Allow other Mercury

products to run tests and components’ check box (Tools > Options) and install the QuickTestAdd-in for Quality Center (from the QuickTest Professional CD-ROM).

22.

NEW!! If a business component is currently open, clicking the New toolbar bu.on creates a new

business component document (and not a new test document). This also applies if an applicationarea or function library is open.

23.

NEW!! You can open a recently used business component, application area, or function library by

selecting it from the Recent Files list in the File menu.

24.

You can specify test, action, or component parameters to pass values to and from your test or

business component, and between actions in your test.

25.

You can define test or action parameter variables using the Parameter object and its methods in

the Expert View.

26.

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

110 of 165 8/12/2014 6:10 PM

Page 111: QTP Challenges 4 Experts _ Just Another WordPress

You can create test, action, or component parameter output values that retrieve values during the

run session and store them for use at another point in the run session. You can then use theseoutput values to parameterize a step in your test or business component.

27.

NEW!! You can create object repository parameters. When associating an object repository to a

test asset, you map this parameter to a constant or a test asset parameter (test, action, or businesscomponent).

28.

You can select an object in the object repository and locate it quickly in your application using the

Highlight bu.on in the ORM or ORE.

29.

NEW!! You can locate an object in the object repository by pointing to an object in your

application. If the object exists in the object repository, it is highlighted.

30.

NEW!! You can now add new objects to the object repository using filtering capabilities. For

example, you can choose to add only a selected type of object residing in a window or a webpage/frame.

31.

NEW!! You can now associate multiple object repositories with an action or application area. In

previous versions of QuickTest Professional, you could associate only a single object repositorywith a test asset.

32.

NEW!! You can export object repository content to an XML file and import a new object

repository from an XML file.

33.

The list of Utility objects available when you open the Step Generator from the Keyword View is

a sub-group of the list available when you open the Step Generator from the Expert View.

34.

Open XML format used for report information now enables you to easily customize run reports

and integrate result information with other applications. Refer to the QuickTest onlinedocumentation for a detailed description of the report’s XML elements.

35.

You can export test results to an HTML file to easily view the test results when you are not

working in a QuickTest environment.

36.

You can write automation scripts to control virtually every QuickTest feature and capability using

the objects, methods, and properties included in the QuickTest Professional automation objectmodel.

37.

Test object and method names are not case sensitive.38.

When you type VBScript keywords in the Expert View, the relevant VBScript syntax or blocks are

added to the test script.

39.

You can now locate specified text strings in the Expert View, and replace them with text strings

that you specify. You can search for literal text or use advanced options to fine-tune your search.

40.

NEW!! You can select a block in the Expert View and press CTRL + M to comment this block.

Press SHFT + CTRL + M to uncomment the block.

41.

NEW!! You can select a block in the Expert View and indent or outdent it by clicking the Indent or

Outdent toolbar bu.ons.

42.

NEW!! You can control the layout of the QuickTest Professional Window by dragging and

dropping panes to a dockable, floating, and tabbed mode.

43.

NEW!! To move a dockable pane without snapping it into place, press CTRL while dragging it to

the required location.

44.

NEW!! To auto-hide all the tabbed panes, select the title bar of the active tabbed pane, right-click

and choose Auto Hide.

45.

NEW!! When you rename a test object, you can choose whether to automatically update all

occurrences of the test object, or manually change the names in steps that use the renamed testobjects.

46.

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

111 of 165 8/12/2014 6:10 PM

Page 112: QTP Challenges 4 Experts _ Just Another WordPress

NEW!! You can copy objects from a shared object repository to the local object repository in order

to modify them.

47.

NEW!! You can use the Object Repository Merge Tool to merge objects from two shared object

repositories into a single object repository.

48.

NEW!! You can associate shared object repositories with multiple actions simultaneously, using

the Associate Repositories dialog box.

49.

NEW!! You can resolve missing resources (such as missing object repositories and actions), using

the new Missing Resources pane.

50.

You can print a single action or business component from the Keyword View (in table format) or

the from the Expert View (in statement format).

51.

In addition to Data Table output values, you can output values to environment variables or store

a retrieved value in a test, action, or component parameter.

52.

You can use the Advanced Windows Applications Options dialog box to modify how QuickTest

records and runs tests on Windows applications. Choose Tools > Options > WindowsApplications tab > Advanced.

53.

You can save the resulting data from the run-time Data Table to a file by inserting a

DataTable.Export statement to the end of your test.

54.

To instruct QuickTest to wait for an object to open or appear during test run, use an Exist or Wait

statement.

55.

To stop an analog step in the middle of a test run, click Ctrl + Esc, then click the Stop toolbar

bu.on.

56.

If you want to create a bitmap checkpoint of multiple objects, select the object in the Object

Selection dialog box that includes all the objects you want your bitmap checkpoint to contain.

57.

If you need to recover Active Screen files after you save a test without Active Screen files,

re-record the necessary steps or use the Update Run option to recapture screens for all steps inyour test.

58.

You can use a PathFinder.Locate statement in your test to retrieve the complete path that

QuickTest uses for a specified relative path based on the folders specified in the Folders tab.

59.

To maximize performance, load only the add-ins you need.60.

You can define a recovery scenario to handle unexpected behavior during your run session.61.

You can add new objects to the Object Repository from the Active Screen or using the Add

Objects option in the Object Repository dialog box and pointing to the object in your application.

62.

To record keyboard input, mouse clicks, and the exact path the mouse travels, switch to Analog

Recording mode or Low Level Recording mode.

63.

If it takes time for an object you are checking to load all of its data, you can increase the

checkpoint timeout.

64.

You can insert XML output values to your script.65.

You can verify that your XML is structured according to a specific schema.66.

You can specify a relative path when calling actions, functions, and other external files associated

with or referenced by a test or business component.

67.

NEW!! You can create library files (containing VBScript functions, subroutines, classes, modules,

and so forth) in QuickTest Professional and associate them with your test or application area. Youcan then call these functions (or other elements) from within your test assets.

68.

NEW!! You can debug functions, subroutines and classes defined in a function library file in

QuickTest Professional.

69.

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

112 of 165 8/12/2014 6:10 PM

Page 113: QTP Challenges 4 Experts _ Just Another WordPress

You can create a user-defined function and register it as a test object method in order to overwrite

or add to existing test object functionality.

70.

You can use the Data Driver Wizard to automatically parameterize constants in your action or

business component.

71.

You can use the Reporter object to disable or enable messages to the Test Results.72.

You can record a test on one version of Microsoft Internet Explorer and then run it on other

browsers or versions.

73.

To transfer control to the application while spying or inserting checkpoints on objects, press the

CTRL key.

74.

You can check the content of an image in a Web page when you create an image checkpoint using

the Compare Image Content option.

75.

You can use the Data Table to run the test several times, each time using different data.76.

By default, in order to conserve disk space, QuickTest does not save screen captures with your

test results for steps that pass. You can change the default se.ing in the Tools > Options > Runtab.

77.

The Active Screen loads faster if you clear the Load Images check box in the Web Page

Appearance dialog box (Tools > Options > Active Screen tab > Advanced bu.on).

78.

You can create a custom report message from the Keyword View by choosing Insert > Report.79.

You can teach QuickTest to recognize any area of your application as an object by defining it as a

virtual object.

80.

From QuickTest, you can run WinRunner tests and call TSL functions in compiled modules. The

results of the WinRunner test or function are integrated into the QuickTest test results.

81.

To modify the text used for a text checkpoint, click the Configure bu.on in the Text Checkpoint

Properties dialog box.

82.

You can configure an action for repeated use in your test and in other tests. Select the Reusable

Action check box in the Action Properties dialog box (Edit > Action > Action Properties).

83.

You can use the ExitAction statement to terminate an action before it finishes running, based on

conditions you specify in your test.

84.

You can run QuickTest tests from a Quality Center project and pass parameter values to the test.85.

You can set breakpoints in your test, and then use the Debug Viewer pane to view, set, or modify

the current value of objects or variables.

86.

You can call methods and retrieve and set COM object properties from the Expert View using the

.Object property.

87.

You can configure how QuickTest records events in Web applications. Choose Tools > Web Event

Recording Configuration.

88.

You can define custom environment variables for use in your test. 89.

You can add logic to a checkpoint by using a Data Table formula.90.

You can set a parameter to use a random numeric value.91.

You can use the Window Script Host and the VBScript Runtime Library to further extend your

test. For more information choose Help > QuickTest Professional Help > VBScript Reference.

92.

You can use the Object Identification dialog box to configure the way QuickTest learns and

recognizes objects.

93.

You can run your test in Update mode to update values in your test or business component. You

can choose to update checkpoint data, Active Screen images, and/or the descriptions of the objectsin the object repository. Choose Automation > Update Run Mode.

94.

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

113 of 165 8/12/2014 6:10 PM

Page 114: QTP Challenges 4 Experts _ Just Another WordPress

94.You can choose a Web server accessible via a Local Area Network (LAN) or a Wide Area Network(WAN) when connecting to Quality Center. Click the Quality Center Connection bu.on or chooseFile > Quality Center Connection.

The Open Test from Quality Center Project dialog box displays icons that indicate the version

control status of each test in your project.

1.

If you want to add the same comment to every action that you create, you can add the comment

to an action template.

2.

Sample QTP Certification Questions Part1

12 AUG 2011 Leave a comment

by vsprasad2k in challenges, QTP, QTP Tricks

To use a specific property to identify your object, but that property is not listed in the properties list.

Then how do you identify that object?

1.

Add the specific property to the list1.

Use the Default property2.

Use some other property to identify your object3.

The list of test objects and their properties and values are stored in the2.

Object Repository1.

Object Identification2.

To retrieve the current property value of the objects in your application during the run session.3.

GetVisibleText1.

GetROProperty2.

SetROProperty3.

GetTOProperty4.

Bitmap checkpoint is supported in VB environment.4.

True1.

False2.

What is the shortcut key that is used for a Standard Checkpoint?5.

F121.

F22.

F103.

F74.

To compares the values of the specified property during a run session with the values stored for the6.

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

114 of 165 8/12/2014 6:10 PM

Page 115: QTP Challenges 4 Experts _ Just Another WordPress

same test object property within the test.

Checkpoint1.

All the above2.

Output Value3.

Compare the object property4.

You will use the recording mode for an object not recognized by QuickTest.7.

Low-Level Recording Mode1.

Normal recording Mode2.

Analog Mode3.

The statement that calls the recorded analog file is8.

RunAnalog1.

CallAnalog2.

ExecuteAnalog3.

An action can be called by other tests or actions is9.

Call Action1.

SplitAction2.

Reusable Action3.

You can replace the page in your Active Screen tab10.

False1.

True2.

QuickTest adds a checkpoint statement in the Expert View as11.

Check Checkpoint1.

Checkpoint2.

A Checkpoint checks that a text string is displayed within a defined area in a Windows application is12.

Accessibility1.

Text Area2.

Standard3.

Text4.

In ActiveX environment an “Accessibility checkpoint” is supported.13.

No1.

Yes2.

The key that is used to Start/End analog recording mode?14.

F31.

SHIFT+ALT+F32.

CTRL+SHIFT+F33.

F104.

15.

The toolbar enables you to view the details of an individual action or the entire test flow is16.

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

115 of 165 8/12/2014 6:10 PM

Page 116: QTP Challenges 4 Experts _ Just Another WordPress

Testing toolbar1.

None of the above2.

Action toolbar3.

Test Pane4.

Answers:

c1.

B2.

A3.

A4.

B5.

A6.

A7.

A8.

A9.

A10.

C11.

B12.

A13.

B14.

A15.

A16.

1.

HP QTP 11.0 Sample Questions for Certifications

04 AUG 2011 Leave a comment

by vsprasad2k in challenges, QTP, QTP Tricks

1. How can you add recordable or non-recordable operations to your test? (Select three.)A. Use the Step Generator.B. Insert through Keyword View.C. Drag objects from the object repository.D. Drag objects from the Active Screen.E. Drag objects from Available Keywords.F. Drag objects from the Data Table.Answer: ABE

2. What is a QuickTest Professional test comprised of?A. calls to actionsB. calls to actions (reusable only)C. calls to QuickTest Professional tests

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

116 of 165 8/12/2014 6:10 PM

Page 117: QTP Challenges 4 Experts _ Just Another WordPress

D. calls and copies of actionsAnswer: A

3. Which names are used to identify the status of your application before and after your automatedtest executes? (Select two.)A. initial conditionB. static stateC. end conditionD. down conditionE. done conditionAnswer: AC

4. During the planning phase, you decide to create multiple actions that can be combined and reusedto achieve testing goals. Which element is critical for identifying the actions to be recorded and howto combine them?A. input dataB. parametersC. initial and end conditionsD. visual cuesAnswer: C

5. What are the default add-ins installed with QuickTest Professional? (Select three.)A. .NETB. ActiveXC. HTMLD. WebE. JavaF. OCXG. Visual BasicAnswer: BDG

6. Which Quick Test Professional View Option will show you the repositories associated with eachaction?A. ResourcesB. InformationC. Script RepositoryD. Active ScreenAnswer: A

7. Where can you reset the add-in manager if it does not display when you launch QuickTestProfessional?A. General OptionsB. Run OptionsC. Test PropertiesD. Test Se.ingsAnswer: A

8. You set your Record and Run se%ings to Record, and then run a test on any open browser. Whichapplications will be recorded? (Select two.)A. Firefox

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

117 of 165 8/12/2014 6:10 PM

Page 118: QTP Challenges 4 Experts _ Just Another WordPress

B. SafariC. SilverlightD. ChromeE. Internet ExplorerAnswer: AE

HP AIS Certification on QTP 11.0 and QC 11.0

04 AUG 2011 Leave a comment

by vsprasad2k in challenges, QTP, QTP Tricks Tags: AIS, HP, HP QTP 11.0 Certification

HP Brings New Certification Exams for QTP 11.0 & QC 11.0 from July 2011

HP has phased out the AIS – HP Quality Center v10 certification from 01 July 2011.

Let us see a quick comparison as to what was the situation earlier versus what is now.

Sr.     What was Earlier? What is available Now?

1. AIS – HP Quality Centercertification used tobe awarded after clearing two exams like1) QTP 10.0&2) QC 10.0

HP AIS certification is now being awardedupon clearing just a single exam eitherfocussing on 1) QTP 11.0or2) Quality Center 11.0.

2. HP QuickTest Professional 10.0 Software(Exam Code: HP0-M39)

HP Functional Testing 11.x software (ExamCode: HP0-M47)Short name – FTv11

3. HP Quality Center 10.0 Software (Exam Code:HP0-M31)

HP Application Lifecycle Management 11.xSoftware (Exam Code: HP0-M46)Short name– ALM v11

4.Certification exams had been active till 31

st

July 2011Certification exams are active from 15

th May

2011

Summary of New Certifications:

HP AIS (Accredited Integration Specialist) certification is now being awarded upon clearing just a singleexam focussing either on QTP 11.0 or Quality Center 11.0.

For ge%ing AIS HP certifications, following two independent paths are available now.

1) For aspirants willing to get certification focussing on QTP 11.0 – the available exam is HPO-M47(Functional Testing 11.x software).

2) For aspirants willing to get certification focussing on QC 11.0 – the available exam is HPO-M46 (HP

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

118 of 165 8/12/2014 6:10 PM

Page 119: QTP Challenges 4 Experts _ Just Another WordPress

Application Lifecycle Management 11.x Software).

A)Highlights ofNew QTP 11.0 Exam: New exam HP0-M47 replaces old HP QuickTest Professional 10.0exam HP0-M39.

a) The new certification is now being called HP AIS – Functional Testing v11

b) Exam details:

# Number of Questions: 72# Type of Question: multiple choice, drag-and-drop, and point and click# Exam time: 105 minutes# Passing score: 75%

The following testing objectives represent the specific areas of content covered in the exam.

The exam HPO-M47 measures the candidates understanding of these areas.

Coverage %     Sections / Objectives

10% Automated test planning# Plan for general testing and automation.# Plan for QTP testing.# Identify and describe features and se.ings.# Explain QTP licensing and packaging.

19% Basic test creation and how QTP works with objects# Create the basic test.# Explain how QTP works with objects.# Add steps without recording.# Explain the purpose and operation of Smart Identification feature.

24% Basic test verification and enhancement# Add standard and customverification points.# Enhance tests with parameters.# Add custom checkpoints.# Add database checkpoints.# Add bitmap checkpoints.# View test results.

11% Modular automated test builds# Explain how to build modular QTP tests withActions.# I Use a Shared Object Repository.

7% QTP and ALM integration # Explain the QTP/ALM connection.# Define ALM management of QTP resources.# Explain versioning features in QTP

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

119 of 165 8/12/2014 6:10 PM

Page 120: QTP Challenges 4 Experts _ Just Another WordPress

10% Automated test troubleshooting# Troubleshoot Object Recognition problems.# Use Recovery scenarios.# Use the Debugging Tool.# Measure System Performance.# Configure log tracking.

4% Advanced QTP Scripting# Import and export Excel sheets.# Get and set object properties.# Identify descriptive programming to bypass repository.

7% Expert View# Describe Expert View features.# Describe dynamic object programming.# Identify and describe VBScript elements.

8% Web applications# Recognize Web Add-in Extensibility.# Describe Web event recording use and configuration.# Identify new web testing capabilities.

New Features of QuickTest Professional

# Visual Relation Identification

# Log Tracking

# Improved Regular Expressions

# New Results Viewer

# GUI and GUI-Less Testing

# Loading Function Libraries at Run-Time

B)Highlights ofNew QC 11.0 Exam: New exam HP0-M46 replaces old HP Quality Center 10.0 examHP0-M31

The new certification is now being called HP AIS – Application Lifecycle Management v11 known by anabbreviation ALM v11.

HP Application Lifecycle Management provides a centralized platform for managing and automatingthe application lifecycle, from inception to retirement. It empowers application teams to plan, build andrelease be.er-quality applications with fewer delays.

New Features of QC / ALM v11

Sr.     New Features Details

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

120 of 165 8/12/2014 6:10 PM

Page 121: QTP Challenges 4 Experts _ Just Another WordPress

1. Project Planning &Tracking

# Track & measure project milestones and KPIs# Release Milestones & KPIs# Master Plan

# Scorecard

# Dashboard

2. RequirementsManagementenhancements

# Business Process Model -INTEGRATION# New Rich TextEditor

# Requirements Templates

3. Test Management # Test Configurations

4. HP Sprinter (ManualTesting)

# Connects directly to HP Quality Center# Test Execution

# Screen Annotation and Tools

# Log defects in QC

# Data Injection

# Exploratory Testing

# Mirror Testing

5. DevelopmentManagement

# Key Developer Integration and Collaboration

6. Reporting enhancements # Generate Reports# Embedded Web Scorecards & Graphs

7. Administration andIntegration andPerformance

# Side by Side Clients:Allows running multiple clientsconnecting to different versions of ALM and QC Servers (ALM11; QC 9.2, 10.0, 11.0)# Client Installation: User can install clienton desktop without system administration rights

# REST APIs: New web services technology for simpleintegration with ALM platform. The ALM Synchronizer nowleverages the REST APIs.

# QC Sense: Internal monitoring tool that collects data andreports on user actions performed in the user interface, and allclient and server activity resulting from those actions

# Smart Repository: Optimized repository system, that createsbe.er performance for common actions, and reduces the size ofthe file system

Features in Nutshell:

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

121 of 165 8/12/2014 6:10 PM

Page 122: QTP Challenges 4 Experts _ Just Another WordPress

When you earn the HP AIS – HP Application Lifecycle Management v11 certification, you prove thatyou have mastered the skills to be able to:

# Centrally manage and track all application projects

# A.ain real-time visibility into the application lifecycle

# Centrally manage and enforce consistent work-flows and processes

# Reduce duplication of effort across projects

# Provide an aggregated, cross-application project view of quality status and defect trends

# Facilitate collaboration and communication among internal and external stakeholder groups, acrossmultiple projects

Test Automation Challenges in Agile Environment

01 AUG 2011 Leave a comment

by vsprasad2k in challenges, QTP, QTP Tricks

Test Automation Challenges in Agile Environment

In this article let us analyze some of challenges we face while implementing Automation with Agilemethodologies. Automated testing in the Agile environment stands a risk of becoming chaotic,unstructured and uncontrolled.

Agile Projects present their own challenges to the Automation team; Unclear project scope, Multipleiterations, Minimal documentation, early and frequent Automation needs and active stakeholderinvolvement all demand lot of challenges from the Automation Team. Some of these challenges are:

Challenge 1: Requirement Phase Challenge 4: Resource Management

Challenge 2: Selecting the Right Tools Challenge 5: Communication

Challenge 3: Script Development Phase Challenge 6: Daily Scrum Meeting

Challenge 7: Release Phase

Challenge 1: Requirement PhaseTest Automation developer captures requirements in the form of “user stories”, which are briefdescriptions of customer-relevant functionality.

Each requirement has to be prioritized as follows:

High: These are mission critical requirements that absolutely have to be done in the first releaseMedium: These are requirements that are important but can be worked around until implemented.

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

122 of 165 8/12/2014 6:10 PM

Page 123: QTP Challenges 4 Experts _ Just Another WordPress

Low: These are requirements that are nice-to-have but not critical to the operation of the software.

Once priories are established, the release “iterations” are planned. Normally, each Agile release iterationtakes between 1 to 3 months to deliver. Customers/software folks take liberty to make too many changesto the requirements. Sometimes, these changes are so volatile that the iterations are bumped off. Thesechanges are greater challenges in implementing Agile Automation testing process.

Challenge 2: Selecting the Right Tools

Traditional, test-last tools with record-and-playback-features force teams to wait until after the softwareis done. More over, traditional test automation tools don’t work for an Agile context because they solvetraditional problems, and those are different from the challenges facing Agile Automation teams.Automation in the early stages of an agile project is usually very tough, but as the system grows andevolves, some aspects se.le and it becomes appropriate to deploy automation. So the choice of testingtools becomes critical for reaping the efficiency and quality benefits of agile.

Challenge 3: Script Development Phase

The Automation testers, developers, business analysts and project stakeholders all contribute to kick-offmeetings where “user-stories” are selected to next sprint. Once the “user-stories” are selected for thesprint, they are used as the basis for a set of tests.

As functionality grows with each iteration, regression testing must be performed to ensure that existingfunctionality has not been impacted by the introduction of new functionality in each iteration cycle. Thescale of the regression testing grows with each sprint and ensures that this remains a manageable taskthe test team use the test automation for the regression suite.

Challenge 4: Resource Management

The Agile approach requires a mixture of testing skills, that is, test resource will be required to defineunclear scenarios and test cases, conduct manual testing alongside developers, write automatedregression tests and execute the automated regression packages. As the project progresses, specialistskills will also be required to cover further test areas that might include integration and performancetesting. There should be an appropriate mix of domain specialist who plan and gather requirements.The challenging part in the Resource management is to find out test resources with multiple skills andallocate them.

Challenge 5: Communication

Good communication must exist among Automation testing team, developers, business analysts andstake holders. There must be highly collaborative interaction between client and the delivery teams.More client involvement implies more suggestions or changes from the client. It implies morebandwidth for communication. The key challenge is that the process should be able to capture andeffectively implement all the changes and data integrity needs to be retained. In traditional testing,developers and testers are like oil and water, but in agile environment, the challenging task is that theyboth must work together to achieve the target.

Challenge 6: Daily Scrum Meeting

Daily Scrum Meeting is one of the key activities in Agile Process. Teams do meet for 15 minutes standup sessions. What is the effectiveness of these meetings? How far these meetings help Automation

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

123 of 165 8/12/2014 6:10 PM

Page 124: QTP Challenges 4 Experts _ Just Another WordPress

practice Developers?

Challenge 7: Release Phase

The aim of Agile project is to deliver a basic working product as quickly as possible and then to gothrough a process of continual improvement. This means that there is no single release phase for aproduct. The challenging part lies in integration testing and acceptance testing of the product.

If we can meet these challenges in a well optimized manner, then Automated Regression Testing inAgile environment is an excellent opportunity for QA to take leadership of the agile processes. It isbe.er placed to bridge the gap between users and developers, understand both what is required, how itcan be achieved and how it can be assured prior to deployment. Automation practice should have avested interest in both the how and the result, as well as continuing to assure that the whole evolvingsystem meets business objectives and is fit for purpose.

How To Be a Good Team Mentor, Coach and a True

Team-Defender in an Agile Testing World? – The Inspiration

You must be impressed with the ‘Idea’ AD and this time it is back with the ‘Walk when you talk’ idea.Abhishek Bacchan, who appears as a doctor in ‘Walk when you talk’ AD, this is a definitely out of anordinary AD, but then, I wouldn’t expect anything else from the “Idea” AD; I love to see the AD and it’sone of my favorite AD since it’s place in line with my emotion and I hope with some of yours emotion aswell.

Is it just an AD in changing the health and mind-set of people or an AD to increase the mobileconnection sales?

How to Deliver High Value Software Features in a Short

Time Period using Agile Scrum Process

What is agile scrum (sprint) process?

Scrum is a software development process. In today’s rapid world stakeholders want immediate returnon their investments. They don’t want to wait for longer periods to get full featured product. As a result,nowadays new software development and testing framework is catching momentum i.e. Scrumapproach.

In scrum, projects are divided in small features to be developed and tested in specific time-frames calledas sprint (small cycles). Features should get developed and tested in specified small time-frames. This

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

124 of 165 8/12/2014 6:10 PM

Page 125: QTP Challenges 4 Experts _ Just Another WordPress

agile scrum team is handled by scrum master.

Working with DLLs using QTP

01 AUG 2011 Leave a comment

by vsprasad2k in Uncategorized

What is a DLL?

Dynamic Linked Library is MS implementation of shared library concept in Windows. To understandthis term more clearly, DLL can be broken down into Dynamic Link(ed) + Library

Dynamic Link means that the subroutines of a library are loaded into an application program atruntime (h.p://en.wikipedia.org/wiki/Runtime), rather than being linked in at compile time(h.p://en.wikipedia.org/wiki/Compile_time), and remain as separate files on disk.Library is a collection of subroutines

How to know about the functions in a DLL?

It is assumed that if you intend to call a DLL, you should know the function to be called from inside andwhat that function does. If you are clueless about how to get the function names you can get downloadMicrosoft Dependency Walker (h.p://en.wikipedia.org/wiki/Dependency_walker) or a 3rd party utilitycalled PE Explorer (h.p://www.heaventools.com/PE_Explorer_Exports_Viewer.htm) which can helpyou to find the functions.

How can the functions inside DLL be called from QTP?

This part is actually simple and a two step process…

Declare the method using Extern.Declare

ExampleExtern.Declare micHwnd, “FindWindow”, “user32.dll”, “FindWindowA”, micString, micStringwhere:

micHwnd -the data type of value returned by methodFindWindow -the user supplied procedure name. You can set it to anything as long as it’s a validsyntax.user32.dll -the DLL from where you wish to call the methodFindWindowA -The actual method name inside the DLLLast two are the data types of the arguments that will be passed to the procedure

Call the method

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

125 of 165 8/12/2014 6:10 PM

Page 126: QTP Challenges 4 Experts _ Just Another WordPress

Example:

Extern.FindWindow(“Notepad”, vbNullString)

To show the above process in action, here is an example to change the title of the Notepad window bycalling the user32.dll

1: ‘Declare FindWindow method

2: Extern.Declare micHwnd, “FindWindow”, “user32.dll”, “FindWindowA”, micString, micString

3:’Declare SetWindowText method5: Extern.Declare micLong, “SetWindowText”, “user32.dll”, “SetWindowTextA”, micHwnd, micString

7: ‘Get HWND of the Notepad window8: hwnd = Extern.FindWindow(“Notepad”, vbNullString)10: if hwnd = 0 then12: MsgBox “Notepad window not found”

14: end if

16: ‘Change the title of the notepad window17: res = Extern.SetWindowText(hwnd, “LearnQTP.com”)

Simple copy-paste the code above in your QTP ‘Expert View’. Open a blank notepad window. Run thiscode. You will now see that the name has changed from Untitled-Notepad to LearnQTP.com

Working on E-mails in Outlook using QTP

31 JUL 2011 Leave a comment

by vsprasad2k in challenges, QTP, QTP Tricks

Looking for an E-mail in Outlook

QuickTest Professional does not have special support for the Outlook application, so there is no built-inmethod that will locate an e-mail and allow you to view the a.achments. However, Microsoft does havean Object Model for Outlook that can be used to automate many of the features. You can refer to“Microsoft Outlook 2000 Object Model” for a complete listing of Outlook methods and properties thatcan be used within a QuickTest Professional (QTP) script. You can use these Outlook object methodswithin a QTP script to send e-mails, access address libraries, access mail folders, etc.

For a complete listing of Outlook object’s methods and properties, refer to MSDN Library – MicrosoftOutlook Object Model.

Below is an example of a very simple VBScript function. This will work on the “Inbox” items. The script

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

126 of 165 8/12/2014 6:10 PM

Page 127: QTP Challenges 4 Experts _ Just Another WordPress

will list how many items you have in the inbox, whether those are read or unread and also the subject.

Note:

In the code below, the GetDefaultFolder() function uses a constant. If you want to work with otherfolders, here are the constants (the code will not work with the Personal folder):

DeletedItems = 3

Outbox = 4

SentMail = 5

Inbox = 6

Calendar = 9

Contacts = 10

Journal = 11

Notes = 12

Tasks = 13

Drafts = 16

AllPublicFolders = 18

Example:

const olMailItem = 0

Set objOutlook = CreateObject(“Outlook.Application”) ‘ Create an Outlook object to interact with.

Set myNameSpace = objOutlook.GetNameSpace(“MAPI”)

Set ClientFolder = myNameSpace.GetDefaultFolder(6)

msgbox(ClientFolder.Items.Count)

Set myItems = ClientFolder.Items

Set myItem = myItems.GetFirst

for i=1 to ClientFolder.Items.Count

msgbox(myItem.UnRead)

msgbox(myItem.Subject)

Set myItem = myItems.GetNext

next

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

127 of 165 8/12/2014 6:10 PM

Page 128: QTP Challenges 4 Experts _ Just Another WordPress

Types of Automation Framework

31 JUL 2011 Leave a comment

by vsprasad2k in Uncategorized

Types of Test Automation Frameworks

You may be aware that using only a capture tool to create your automated tests has its drawbacks, butyou may not be aware of the alternatives you have available to you. In this article I will briefly outlinesome of the frameworks for test automation that I’m aware of. These include test script modularity, testlibrary architecture, keyword-driven/table-driven testing, data-driven testing, and hybrid testautomation. Each of these frameworks has it’s own strengths and weaknesses. What I hope toaccomplish in this article is to establish a starting point from which you can spend some time lookingmore heavily into the framework you think may be right for you.

Frameworks for Test Automation

Test Script Modularity

The test script modularity framework is the most basic of the frameworks. This framework builds onthe concept of abstraction.It’s a well-known programming strategy to build an abstraction layer in front of a component to hidethe component from the rest of the application.This insulates the application from modifications in the component and provides modularity in theapplication design.When working with test scripts (in any language or proprietary environment) this can be achievedby creating small, independent scripts that represent modules, sections, and functions of theapplication-under-test.You then take these small scripts and combine them in a hierarchical fashion to construct larger tests.The use of this framework will yield a higher degree of modularization and add to the overallmaintainability of your scripts. This framework being what it is, I did not see fit to include anyexamples.

Test Library Architecture

Following the same rule of abstraction, one can also implement a test library architecture framework.This framework offers the same advantages as script modularity, but it divides the application-under-test into procedures and functions (or objects and methods depending on yourimplementation language)instead of scripts.This framework requires the creation of library files that represent modules, sections, and functionsof the application-under-test.These library files are then called directly from your test case scripts. Much like script

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

128 of 165 8/12/2014 6:10 PM

Page 129: QTP Challenges 4 Experts _ Just Another WordPress

modularization this framework also yields a high degree of modularization and adds to the overallmaintainability of your tests.Like the last framework, I did not see fit to include any examples for this framework either.

Keyword-Driven or Table-Driven Testing

The terms keyword-driven testing and table-driven testing are interchangeable and refer to one typeof an application-independent automation framework.This framework requires the development of data tables and keywords, independent of the testautomation tool used to execute them and the test script code that “drives” the application-under-test and the data. Keyword-driven tests look very similar to manual test cases.In a keyword-driven test, the functionality of the application-under-test is documented in a table aswell as in step-by-step instructions for each test.

As an example, if we were to map out the actions we would perform while testing the Open function inWord, we could create the following table. The Window column refers to which application window weare performing the mouse action on. The Control column refers to the type of control that the mousewill be clicking. The Action column is the action taken with the mouse (or by you the tester). And theArguments column is there reference a specific control.

Window Control Action ArgumentsWord Menu File, OpenWord Pushbu.on Click Folder NameWord Pushbu.on Click Folder NameWord Pushbu.on Click Folder NameWord Pushbu.on Click OpenWord Verify ResultWord Menu File, Close

These tables can be made as needed in order to represent a series of tests. Each table should representone complete test. Once you’ve created your data tables, you simply write a program or a set of scriptsthat reads in each step executes the step based on the keyword contained the Action field, performserror checking, and logs any relevant information. This program or set of scripts would look similar tothe pseudocode below:

Main Script / ProgramConnect to data tables.Read in row and parse out values.Pass values to appropriate functions.Close connection to data tables.Menu ModuleSet focus to window.Select the menu pad option.Pushbu.on ModulePush the bu.on based on argument.

Return.Etc…

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

129 of 165 8/12/2014 6:10 PM

Page 130: QTP Challenges 4 Experts _ Just Another WordPress

From this example you can see that this framework requires very li.le code togenerate many test cases. The data tables are used to generate the individual testcases while the same code is reused over and over again.

Data-Driven Testing

A data-driven framework is where test input and output values are read from data files (ODBCsources, cvs files, Excel files, DAO objects, ADO objects, and such) and are loaded into variables incaptured or manually coded scripts.In this framework, variables are used for both input values and output verification values.Navigation through the program, reading of the data files, and logging of test status and informationare all coded in the test script.This framework is similar to table-driven testing in that the test case is contained in the data file andnot in the script; the script is just a “driver,” or delivery mechanism, for the data. Unlike in table-driven testing, though, the navigation data isn’t contained in the table structure.In data-driven testing, only test data is contained in the data files. This framework tends to reducethe overall number of scripts you need in order to implement all of your test cases, and it offers thegreatest flexibility when it comes to developing workarounds for bugs and performing maintenance.Much like table-driven testing, data-driven testing requires very li.le code to generate many testcases.This framework is very easy to implement using most any toolset, and there’s a lot of detaileddocumentation available with how-tos and examples online.

Hybrid Test Automation

It is a combination of all of the above techniques, pulling from their strengths and trying to mitigatetheir weaknesses.A hybrid test automation framework is what most frameworks evolve into over time and multipleprojects. You can implement modularity by nesting test scripts and using the library files (or objects)to implement functions, procedures, or methods.You can implement whichever data-driven technique you choose and to the extent you find it useful.The trick is to use the best framework(s) for the job and the only way to figure that out is to jump inand start using them!

QTP – Not just for GUI anymore

19 MAY 2011 Leave a comment

by vsprasad2k in Uncategorized Tags: QTP

QTP – Not just for GUI anymore (h.p://qtpchallenge.files.wordpress.com/2011/05/qtp-not-just-for-gui-anymore.ppt)

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

130 of 165 8/12/2014 6:10 PM

Page 131: QTP Challenges 4 Experts _ Just Another WordPress

Hello world!

19 MAY 2011 1 Comment

by vsprasad2k in Uncategorized

Welcome to WordPress.com (h.p://wordpress.com/). After you read this, you should delete and writeyour own post, with a new title above. Or hit Add New (/wp-admin/post-new.php) on the left (of theadmin dashboard (/wp-admin)) to start a fresh post.

Here (h.p://learn.wordpress.com/) are some suggestions for your first post.

You can find new ideas for what to blog about by reading the Daily Post

(h.p://dailypost.wordpress.com/).

1.

Add PressThis (/wp-admin/tools.php) to your browser. It creates a new blog post for you about any

interesting page you read on the web.

2.

Make some changes to this page (/wp-admin/post.php?post=1&action=edit), and then hit preview on

the right. You can alway preview any post or edit you before you share it to the world.

3.

What are Component, Distributed Component, Automation

and Document Object Models

22 APR 2011 Leave a comment

by vsprasad2k in COM DCOM AOM, QTP, QTP Tricks Tags: AOM, COM, DCOM

Component Object Model

Microsoft COM (Component Object Model) technology in the Microsoft Windows-family of OperatingSystems enables software components to communicate. COM is used by developers to create re-usablesoftware components, link components together to build applications, and take advantage of Windowsservices. The family of COM technologies includes COM+, Distributed COM (DCOM) and ActiveXControls.

COM is used to give structured software architecture. COM objects are discrete components,each with a unique identity, which expose interfaces that allow applications and other components toaccess their features. COM objects are more versatile than Win32 DLLs because they are completelylanguage-independent, have built-in interprocess communications capability, and easily fit into anobject-oriented program design.

COM is used in applications such as the Microsoft Office Family of products. For example COM OLE

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

131 of 165 8/12/2014 6:10 PM

Page 132: QTP Challenges 4 Experts _ Just Another WordPress

technology allows Word documents to dynamically link to data in Excel spreadsheets and COMAutomation allows users to build scripts in their applications to perform repetitive tasks or control oneapplication from another.

Distributed Component Object Model

Distributed Component Object Model is an extension of the Component Object Model (COM) thatallows COM components to communicate across network boundaries. Traditional COM componentscan only perform interprocess communication across process boundaries on the same machine. DCOMuses the RPC mechanism to transparently send and receive information between COM components (i.e.,clients and servers) on the same network.

Automation Object Model

An object model is a structural representation of software objects (classes) that comprise theimplementation of a system or application. An object model defines a set of classes and interfaces,together with their properties, methods and events, and their relationships.

These Object Models are developed based on COM technology. The QTP Automation Object Model willgive structural representation of QTP classes. Using this we can access QTP options from any otherapplications by using a scripting or programming language. An Object Model will give a facility tocontrol the functionality of an application programmatically.

QTP Automation Object Model developed based on COM and DCOM. We can automate QTP operationsby writing VB scripts. It is possible because of COM. We can run our QTP scripts on a remote machinewhich is in the network. It is possible because of DCOM. To know how to run QTP Scripts on a remotemachine follow this path…

Go to QTP HELP by pressing F1 in QTP à QuickTest Advanced References à QuickTest ProfessionalAutomation Object Model àIntroduction à Learning the Basic Elements of a QuickTestAutomation à Running Automation Scripts on a Remote Computer

Document Object Model

Document Object Model (DOM), a programming interface developed by the World Wide WebConsortium (W3C) to create and modify HTML pages and XML documents.

With the Document Object Model, programmers can create and build documents, navigate theirstructure, and add, modify, or delete elements and content. Anything found in an HTMLor XML document can be accessed, changed, deleted, or added using the Document Object Model. TheDocument Object Model can be used with any programming or scripting languages.

How DOM is useful for Automation Testers?

DOM is useful when working with web applications. We go for DOM to access internal properties ormethods of a web application. “.Object” property is used to access internal properties or methods. To see

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

132 of 165 8/12/2014 6:10 PM

Page 133: QTP Challenges 4 Experts _ Just Another WordPress

available internal methods and properties, go to Object Spy à point to any web object à select Runtimeobject properties radio bu.on

For QTP 10 select Native Properties Radio bu.on

(h.ps://v9jjsg.bay.livefilestore.com/y1mUU4qLXxQqy6L7nQkVoQvApoCHeKe3wHAq5GMC43KGGsi_Boh36HkOkAVLvmhAZld5QvFgk3DABPUgqRpJ3c19ikj96FqBVsdxtx8d8gjlTwh3ZK0BGEeB2fWptA12kum0eSNc9VkCt-QC2Nc4CFKGQ/comdcom.bmp)

Below code is to get internal property or to access internal method of a web edit

Msgbox Browser(“Google”).Page(“Google”).webedit(“q”).object.value

Browser(“Google”).Page(“Google”).webedit(“q”).object.focus

Focus is a method and Value is a property for webedit.

Object is a property for every QTP web object to access internal properties or methods.

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

133 of 165 8/12/2014 6:10 PM

Page 134: QTP Challenges 4 Experts _ Just Another WordPress

QTP Unable to Recognize Object

15 APR 2011 Leave a comment

by vsprasad2k in challenges, QTP, QTP Tricks

QTP Unable to Recognize Object

1. Check the loaded add-ins:

It’s pre.y basic, but be sure you have the correct add-ins selected. If QTP is only recognizing yourobjects as standard WinObject this may be a sign that you need to use an add-in. Sometimes QTP’s‘Display Add-in’ Manager on start-up option, under ToolsOptionsGeneral may not be selected. Thisse.ing may cause you to start QTP on a machine and mistakenly assume that all of the correct add-inshave been chosen. Double-check by opening your script and selecting FileSe.ings under Properties‘Associated add-ins:’ verifying that all the needed add-ins are listed. Also make sure QTP is startedbefore the application under test. QTP will sometimes not recognize a web application if the browserwas opened before QTP.

(h.p://www.joecolantonio.com/wp-content/uploads/2010/08

/QTP_General2.jpg) (h.p://www.joecolantonio.com

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

134 of 165 8/12/2014 6:10 PM

Page 135: QTP Challenges 4 Experts _ Just Another WordPress

/wp-content/uploads/2010/08/QTP_Properties.jpg)

2. HP’s Knowledge base:

Research the issue. If your add-ins are fine, the next step is to search theHP’s Knowledge base. Again,this may seem obvious, but a surprising number of people fail to do this. There’s nothing worse thanspending hours on a script only to discover later that there is a patch (for example see patch thatresolves some QTP 11 object issues) (h.p://www.joecolantonio.com/?p=205) available or a postedsolution that will solve the problem. I’m sometimes hailed as an automation genius by fixing somethingthat an engineer may have been struggling with for days, based on information I found in the KB. Often,even after I tell the engineer how I solved the issue, they still don’t check the KB the next time they havea problem. Do me a favor — don’t be that guy (or gal)! Check the KB. (If nothing is found in the KB,another great resource to check is SQAForums (h.p://www.sqaforums.com/).

3. Using .Object:

Look at all the available object’s operations (both the “identification properties” and “native properties”methods). You’ll be surprised what you’ll find lurking around in an object’s properties that may help toautomate it. Using .Object try as many operations as possible–even ones that may not seem remotelyrelevant to the action you want to perform. For example: I was having a problem recognizing text on anapplication’s custom .NET grid. After spying on the object and trying several different methods thatsounded promising, I ended up trying an odd one, called GetViewStyleInfo, and surprisingly it worked!

(h.p://www.joecolantonio.com/wp-content/uploads/2010/08/GetViewStyleInfo1.gif)

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

135 of 165 8/12/2014 6:10 PM

Page 136: QTP Challenges 4 Experts _ Just Another WordPress

(h.p://www.joecolantonio.com/wp-content/uploads/2010/08/GetViewStyle_PRINTINFO.gif)

4. Try GetVisibleText:

Sometimes QTP does not recognize text in an object using the GetROProperty(“text”) method. As a lastresort, try using the GetVisibleText, GetTextLocation and Type methods. These methods really helpedme automate some old proprietary controls. Using a combination of QTP’s TYPE method andGetTextLocation, I created a very reliable rich edit box object function. For example:

(h.p://www.joecolantonio.com/wp-content/uploads/2010/08/RichEditBox.gif)

? (h.p://www.joecolantonio.com/2010/08/12/quicktest-object-recognition/#)

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

136 of 165 8/12/2014 6:10 PM

Page 137: QTP Challenges 4 Experts _ Just Another WordPress

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748

RichEditBoxICW "0","ENTER","=>","T","From date:"

wait 1

RichEditBoxICW "0","ENTER","Through","T^20","Through date:"

wait 1

RichEditBoxICW "0","ENTER","No=>","N","Do you want to queue this activity?"

'***********************************

'* RICHEDITBOX

'**********************************

'************************

'* ICW

'* @Documentation Used to perform valid actions on RichEdit objects.

'************************

Function RichEditBoxICW(index,action,lineText,valueToEnter,comment)

On Error Resume Next

'*****************************************

' SET OR PATH BASED ON ENV

'*****************************************

set strICWPath = Browser("CF").Page("CF").Frame("WorkSpace").SwfObject("IEController")

strParse = strings("PARSE",valueToEnter,"LEFT","","") 'this would return False string

does not contain ^

Select Case UCASE(action)

Case "ENTER"

intXY = getTextXY(lineText)

arrXY = Split(intXY,"^")

strICWPath.WinObject("regexpwndclass:=RichEdit20A").Click arrXY(0),arrXY(1)

If strParse = "False" Then

Reporter.Filter = rfEnableAll

strICWPath.WinObject("regexpwndclass:=RichEdit20A").Type micRight

strICWPath.WinObject("regexpwndclass:=RichEdit20A").Type valueToEnter

strICWPath.WinObject("regexpwndclass:=RichEdit20A").Type micReturn

strReportMsg = "ENTERED ->" & valueToEnter

ELSE

strEnterValue = geString("PARSE",strValueToEnter,"LEFT","","")'Get Value to Enter

strRightCount = geString("PARSE",strValueToEnter,"RIGHT","","")'Get # of right

keys to press before entering text

for nTabs = 1 to strRightCount

strICWPath.WinObject("regexpwndclass:=RichEdit20A").Type micRight

next

strICWPath.WinObject("regexpwndclass:=RichEdit20A").Type strEnterValue

strICWPath.WinObject("regexpwndclass:=RichEdit20A").Type micReturn

strReportMsg = "ENTERED ->" & strEnterValue

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

137 of 165 8/12/2014 6:10 PM

Page 138: QTP Challenges 4 Experts _ Just Another WordPress

4950515253545556575859606162636465666768697071

end select

End Function

'---------------------------------------------------------

'@Function Name: getTextXY

'@Documentation Return X and Y coordinates of text

'@Parameters: The text to find

'@Created By: Joe Colantonio

'@Return Values: X & Y coord separated by a ^

'@Example: intXY = getTextXY(strLineText)

'-------------------------------------------------------------

Function getTextXY(strTextToFindXYFor)

set strICWPath = Browser("CF").Page("CF").Frame("WorkSpace").SwfObject("IEController")

l = -1

t = -1

r = -1

b = -1

rc =

strICWPath.WinObject("regexpwndclass:=RichEdit20A").GetTextLocation(strTextToFindXYFor,

l, t, r, b)

getTextXY = r & "^" & t

End function

5. Developers are your friend:

The application’s developers can help you. Ask your developers to expose a method or add a propertythat will make automation easier. But before you ask — make sure you’ve exhausted all the abovesuggestions. Developers can be a tough bunch, and you really don’t want to annoy them with thingsyou could have resolved on your own. I work with some awesome programmers, and as long as I’mable to clearly explain to them what I need and why, they never hesitate to help.

6. Make sure there is not a patch that will help.

Sometimes there are known issues with object recognition that only a QTP patch will resolve. Also newpatches sometime include support for newer version of AUT like .NET or Browsers.

For an updated list of all patches available for QTP 11 check out the Patches section in my article:QTP 11Support Matrix with Patch Updates (h.p://www.joecolantonio.com/?p=382)

History of Quick Test Professional

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

138 of 165 8/12/2014 6:10 PM

Page 139: QTP Challenges 4 Experts _ Just Another WordPress

05 JAN 2011 Leave a comment

by vsprasad2k in challenges, QTP, QTP Tricks, Uncategorized

QTP 5.5v – 2002

QTP 6.5 v & 7.6 – (2003 -2004)

QTP8.0 & 8.2 – 2005

QTP9.0 – 2008

QTP 9.2 & 9.5 – 2009

QTP 10 – 2009

QTP 11 – 2010

Close browsers except QC before end script execution

24 DEC 2010 Leave a comment

by vsprasad2k in challenges, QTP, QTP Tricks, QTP VBScript

SystemUtil.Run “taskmgr”,””,”C:\”,””

Dialog(“text:=Windows Task Manager”).WinTab(“nativeclass:=SysTabControl32″).Select “Applications”

AllItems= Dialog(“text:=Windows Task Manager”).WinListView(“nativeclass:=SysListView32″).GetContentArr = Split(AllItems, VbLf)For i = 0 to UBound(Arr)title = Arr(i)If Instr(title, “Microsoft Internet Explorer”) <> 0 ThenIf InStr (title, “Quality Center”) = 0 ThenSystemUtil.CloseProcessByWndTitle titleWait 1End IfEnd IfNextDialog(“text:=Windows Task Manager”).Close

‘****************************************Alternatively***************************************************

Set Obj = Description.CreateObj(“micclass”).Value = “Browser”Set BrowserCollection = Desktop.ChildObjects(Obj)

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

139 of 165 8/12/2014 6:10 PM

Page 140: QTP Challenges 4 Experts _ Just Another WordPress

For i = BrowserCollection.Count-1 To 0 Step -1If Instr(1,BrowserCollection(i).GetRoProperty(“Name”),”Mercury Quality Center”)= 0 ThenBrowserCollection(i).CloseEnd IfNextSet Obj = Nothing

Difference between Error Handling & Recovery Scenario

24 NOV 2010 Leave a comment

by vsprasad2k in challenges, QTP

Recovery Scenario:

When executing scripts we may get some Unexpected errors.To recover the test and continue runningscript from these unexpected errors we use Recovery Scenarios.

What happens in Recovery Scenarios?

A recovery scenario consists of the following:

Trigger Event:

The event that interrupts your run session. For example a window that may pop up on screen.

Recovery Operations:

The operations to perform to enable QTP to continue running the test after the trigger event interruptsthe run session. For example, clicking an OK bu.on in a pop-up window.

Post-Recovery Test Run Option:

The instructions on how QTP should proceed after the recovery operations have been performed, andfrom which point in the test QTP should continue. For example, you may want to restart a test from thebeginning, or skip a step entirely and continue with the next step in the test. Recovery scenarios aresaved in recovery scenario files having the extension .qrs. A recovery scenario file is a logical collectionof recovery scenarios, grouped according to our specific requirements.

Recovery scenario manger can handle following four events:

1. Pop-up window: To handle unwanted pop ups.

2. Object state: To handle object related errors at runtime.

3. Test run error: To handle vb script statement errors at runtime.

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

140 of 165 8/12/2014 6:10 PM

Page 141: QTP Challenges 4 Experts _ Just Another WordPress

4. Application crash: To handle crashed applications at runtime.

1.Recovery Scenario for Popup Window:

Steps to follow to handle unwanted popups:

Trigger Event Steps:

Resources Menu –>Recovery Scenario Manager –>New –>Next –>Select “Popup Window” as Triggerevent –>Next –>Click on Hand Icon –>Show unwanted window with Hand icon –>Next –>Next–>(Continue below mentioned steps)

Recovery Operations steps:

Select function call as Recovery Operation –>Next {Open Notepad –>Save empty file with .vbsextension} –>Browse the .vbs fie path –>Next –>Uncheck Add another Recovery Operation –>Next–>(Continue below mentioned steps)

Post-Recovery Test Run Option Steps:

Select Post-Recovery Test Run Option {Repeat current step and continue, Proceed to Next step, Proceedto Next Action, Proceed to next test iteration, Restart current test run, Stop the Test Run} –>Next –>EnterScenario Name –>Next –>Select Option –> Finish –>Save the scenario with “.qrs” –>Record requiredRecovery Operation {Click ok, Click Cancel} take the script into function –>Save the library file –>ClickRun

2.Recovery Scenario for Object State:

Steps to follow to check Property values of an object in the application match specified values. User canspecify property values for each object in the hierarchy.

Trigger Event steps:

Resources Menu –> Recovery Scenario Manager –> New –> Next –> Select “Object state Window” asTrigger event –> Next –> Click on Hand Icon –> Show object with and icon –> Next –> Next–>selectobject property with value (enabled ,false)–>click next –> (Continue below mentioned steps)

Recovery Operations steps:

Select function call as Recovery Operation –> Next {Open Notepad –> Save empty file with .vbsextension} –> Browse the .vbs fie path –> Next –> Uncheck Add another Recovery Operation –> Next–>(Continue below mentioned steps)

Post-Recovery Test Run Option Steps:

Select Post-Recovery Test Run Option {Repeat current step and continue, Proceed to Next step, Proceedto Next Action, Proceed to next test iteration, Restart current test run, Stop the Test Run} –> Next–> EnterScenario Name –> Next –> Select Option –>Finish –> Save the scenario with “.qrs” –> Record requiredRecovery Operation {Click ok, Click Cancel} take the script into function –> Save the library file –> ClickRun

3.Recovery Scenario for Test Run Error:

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

141 of 165 8/12/2014 6:10 PM

Page 142: QTP Challenges 4 Experts _ Just Another WordPress

Steps to follow to check if test does not run successfully then Test Run Error can be raised.

Trigger Event steps:

Resources Menu –>Recovery Scenario Manager –>New –>Next –>Select “Testrunerror Window” asTrigger event –>Next –>select any error o –>Next –>Next –>(Continue below mentioned steps)

Recovery Operations steps:

Select function call as Recovery Operation –>Next {Open Notepad –>Save empty file with .vbsextension} –>Browse the .vbs fie path –>Next –>Uncheck Add another Recovery Operation –>Next–>(Continue below mentioned steps)

Post-Recovery Test Run Option Steps:

Select Post-Recovery Test Run Option {Repeat current step and continue, Proceed to Next step, Proceedto Next Action, Proceed to next test iteration, Restart current test run, Stop the Test Run} –>Next >EnterScenario Name >Next –>Select Option –> Finish >Save the scenario with “.qrs” –>Record requiredRecovery Operation {Click ok, Click Cancel} take the script into function –>Save the library file –>ClickRun

4.Recovery Scenario for Application Crash:

Steps to follow to check application failure during Test Run.

Trigger Event steps:

Resources Menu –> Recovery Scenario Manager–> Click New–> Click Next –>Select Application Crashas Trigger event–>Next –>Select selected executable application–>Next –> (Continue below mentionedsteps)

Recovery Operations and Post-Recovery Test Run Option Steps:

Select Recovery Operation {Keyboard, Mouse Operation,Close Application Process, function Call,Restart, Microsoft Windows} –>Next –>If you want to check Add another operation else uncheck–>Next–>Next –>Enter Scenario Name –>Next–>Select Option –>Finish –>Close –>Save the scenario with “.qrs”

When to use Error handling(on error resume next) vs Recovery Scenarios ?

If you can predict that a certain event may happen at a specific point in your test or component, it isrecommended to handle that event directly within your test or component by adding steps such as Ifstatements or optional steps or “on error resume next”, rather than depending on a recovery scenario.Using Recovery Scenarios may result in unusually slow performance of your tests.They are designed tohandle a more generic set of unpredictable events which CANNOT be handled programmatically.

Example:

A recovery scenario can handle a printer error by clicking the default bu.on in the Printer Errormessage box.You cannot handle this error directly in your test, since you cannot know at what point thenetwork will return the printer error. You could try to handle this event in your test by adding an Ifstatement immediately after the step that sent a file to the printer, but if the network takes time to returnthe printer error, your test may have progressed several steps before the error is displayed. Therefore,

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

142 of 165 8/12/2014 6:10 PM

Page 143: QTP Challenges 4 Experts _ Just Another WordPress

for this type of event,only a recovery scenario can handle it.

On error Statements

Following are error statements :

1. On Error Resume Next2. On Error Go to 03. err.number4. err.description

On Error Resume Next:

On Error Resume Next statement enables the Error handling in the code.If there is error in the code “Onerror Resume Next” ignores it and continue with next line of code.

On Error Go to 0:

On error got to 0 statement disables error handling we have previiously enabled it by using On Errorresume Next.

err.number and err.description:

Provides the error number and the description of the error

Example:

‘Call the function to divide

call division

Function division()

on error resume next

‘divide by zero

z=40/0

‘ Report the error occured. You can see the error number and description in result summary

If Err.number <> 0 then

Reporter.ReportEvent micWarning,”Error Occured”,”Error number is ” & err.number & ” anddescription is : ” & err.description

‘disables error handling

on error goto 0

End if

End function

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

143 of 165 8/12/2014 6:10 PM

Page 144: QTP Challenges 4 Experts _ Just Another WordPress

Run VB Script Code without using QTP

06 SEP 2010 Leave a comment

by vsprasad2k in Uncategorized

1. Just copy n paste below code to new notepad…‘To extract a number from alphanumeric text stringDim mystring, myLengthmystring = “This is QTP Challenges Website 4 Experts”myLength = Len(mystring)For i = 1 To myLength If Asc(Mid(mystring, i, 1)) <> 32 Then If Asc(Mid(mystring, i, 1)) >= 48 And Asc(Mid(mystring, i, 1)) <= 57 Then myNumber = myNumber & Mid(mystring, i, 1) End If Else msgbox(“no numeric”) End IfNextmsgbox(myNumber)2. Save file as “test.vbs” (with double quotes)3. It’ll display like this on your hard drive..

(h.p://qtpchallenge.files.wordpress.com/2011/09/vbs1.jpg?w=79)4. Now close the file and double click on the file icon.and it’s done!! Please note that it’ll work only if you don’t have any object in your script.

How can you quickly sort given VBScript array

25 APR 2010 Leave a comment

by vsprasad2k in challenges, QTP, QTP VBScript Tags: QTP VBScript

You could simply write your own sort algorithm (like a bubble sort) and encapsulate it in a function,however there’s another way that’s faster, while remaining very flexible. The key is using the JScriptarray’s highly efficient sort method. Since VBScript and JScript arrays aren’t directly interchangeable, wehave to incur some overhead passing them back and forth. But the overhead is usually worth it.

:)

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

144 of 165 8/12/2014 6:10 PM

Page 145: QTP Challenges 4 Experts _ Just Another WordPress

<%

for i = UBound(arrShort) - 1 To 0 Step -1

for j= 0 to i

if arrShort(j)>arrShort(j+1) then

temp=arrShort(j+1)

arrShort(j+1)=arrShort(j)

arrShort(j)=temp

end if

next

next %>

First we define a JScript function that accepts a VBArray (a safeArray type), changes it to a JScript arrayand sorts it:

<script language=JScript runat=server>

function SortVBArray(arrVBArray) {

return arrVBArray.toArray().sort().join('\b');

}

</script>

That’s all there is to, it but here’s the breakdown of the one line of code:return Tells the function to return whatever comes to the right of it as the output of the function.

arrVBArray.toArray() Calls the toArray() method of the VBArray to convert it to a JScript array

(this method is only available in JScript).

.sort() Since the expression to the left of this code evaluates to a Jscript array, we can now call the

sort() method of it, to perform a case-sensitive ascending sort.

.join('\b'); This now joins the JScript array into a delimited string. The ‘\b’ is a special non-printable

character that is used as the delimiter because it will (almost) never appear in a string unlike otherpotential delmiters such as the comma. This is how it will be passed back to VBScript.

Next you need a VBScript function to “finish off” what this function couldn’t do in JScript, convert theoutput to a VBScript array. It looks like this:

<%

Function SortArray(arrInput)

SortArray = Split(SortVBArray(arrInput), Chr(8))

End Function

%>

Again only one line, this function uses the VBScript Split function to reconstitue the VBArray, now in

sorted form. If you just wanted a sorted delimited string, you could call the SortVBArray() function

directly.

How to Reduce Test Execution Time in QTP

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

145 of 165 8/12/2014 6:10 PM

Page 146: QTP Challenges 4 Experts _ Just Another WordPress

24 APR 2010 Leave a comment

by vsprasad2k in QTP, QTP ADODB, QTP Tricks, QTP VBScript

QTP is used mainly for Regression Testing. The idea behind it is to reduce human errors and also toovercome the keying process. There is one more advantage of using QTP and that is to reduce executiontime. If we use QTP effectively we can reduce the test execution time drastically. While writing thescript, the time aspect has to be considered; otherwise we will finally end up with a script which willtake the same time if it is done manually. This document speaks about how to write script effectively toreduce the execution time.

Usual Approach

Usually a new script is created for each scenario. Few create a framework supported script. There aredifferent ways of creating framework supported script. One way is to create a separate Data table, Objectrepository for each scenario but will have one script to execute the entire scenario. This script can beused to run on any application. But a data table and object repository is necessary for the script toexecute. Also we need to import data table and object for each scenario, which will consume time. Inaddition it might require some configuration changes.

We can also create a separate script for each scenario and in order to reduce the execution time, we canuse the QTP Batch Process. Batch Process can be used to reduce execution time. The only disadvantagehere is, the result can’t be stored as we wish, by default it gets stored in the script folder.

Disadvantages of Normal Process:

•Lot of human work is required even after automating the process.

•Test execution time is almost the same as manual execution.

•May need to make configuration changes (depends on the way we write the script)

•For a small change in the UI we need to update each and every script to incorporate the change.

•Not possible to do a complete regression in time critical projects.

New Approach

This approach is based on the Data- driven Framework. The test data drives the business scenario. Thescript might get complex if not planned properly. But a planned process will reduce the execution timedrastically.

Step – 1

Proper planning needs to be done before starting to write the script. Get in touch with the business folksto know the possible business scenarios. A clear idea of the business scenario is required to write thedata-driven script. Finalize how many Actions/Reusable Actions are required to achieve the completebusiness flow. Try to create Actions based on the business functionality, don’t go by page wise (for webapps),

Example: For an Insurance Claims system, we can create the following Actions, based on theFunctionality, Login, Loss Details, Vehicle Details, Driver Details, Coverage Details and Payments and

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

146 of 165 8/12/2014 6:10 PM

Page 147: QTP Challenges 4 Experts _ Just Another WordPress

so on.

Step – 2

Keep the objects common for all scenarios in one Action. Split the business flow in to different Actionsbased on the functionality. This can be accomplished by using conditional statements. Whereverrequired parameterize the object value. Care should be taken while parameterzing, since the object inthe current Action cannot be accessed from any other Action. So objects value which is used acrossdifferent Actions has to be defined in the Global sheet.

Example: Policy Number might be required to execute all Actions available in the script, so whileParameterizing we should use the Global Sheet. Also when there is no payment associated with theClaim, we should not execute the “Payment” Action, which is accomplished by a Conditional check asmentioned below,

If DataTable (“Payment”, dtLocalSheet) <>”” Then

< Payment steps —

—- >

End If

Step – 3

First complete the end to end script for one business functionality. Then integrate the new functionalityscript to the existing one. Execute and test your integrated script, to make sure that each business flow isexecuted. Depending on the complexity of the application, lot of conditional statements may be requiredto be incorporated in the script. All the conditional check should be based on the data table values. Thuswe can say that the data drives the business flow.

Example:

If DataTable (“Coverage”, dtLocalSheet) = “COLL” Then

< Steps >

ElseIf DataTable (“Coverage”, dtLocalSheet) = “PD” Then

< Steps >

– – – – – – – -

– – – – – – -

End If

Step – 4

Finally you will end up with a script which can be used to test the complete functionality of theapplication. Try to run the script to execute all the business scenarios. One or two errors might occurwhile executing a huge number of scenarios. Create Recovery scenarios to over come the unexpected

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

147 of 165 8/12/2014 6:10 PM

Page 148: QTP Challenges 4 Experts _ Just Another WordPress

errors.

Example: At times, pop ups for Informational message might be displayed in the application, whichneed to be answered to proceed. A Recovery scenario can be created in QTP to answer the pop ups. Sowhenever pop up is displayed the recovery scenario will be invoked.

If the application under test has a Login page, we could skip login for each scenario. Only for the firsttime you need to login to the application, thereafter for the forthcoming scenarios we don’t have tologin, which would save time. Don’t forget to create a recovery scenario for login, which should betriggered whenever there is an error.

Sample Script:

Environment (“FirstIteration”) =”yes”

Environment (“TestStatus”) =”unknown”

If Environment (“FirstIteration”) = “yes” or Environment (“TestStatus”) =”failed” Then

Set IE = CreateObject (“InternetExplorer.Application”)

IE.Visible = true

URL = DataTable (“url”, dtGlobalSheet)

IE.Navigate URL

Browser (“Browser”).Page (“Page”).Sync

If Environment (“TestStatus”) = “failed” or Environment (“TestStatus”) =”unknown” Then

If Browser (“Browser”).Page (“Page”).link (“Logout”).Exist ([0]) Then

Browser (“Browser”).Page (“Page”).link (“Logout”).Click

Browser (“Browser”).Page (“Page”).Sync

End If

End If

Browser (“Browser”).Page (“Page”).Link (“Login”).Click

Browser (“Browser”).Page (“Login”).sync

Do while Browser (“Browser”).Page (“Login”).WebBu.on (“Log In”).Exist (1)

Browser (“Browser”).Page (“Login”).WebEdit (“j_username”).Set “xxxxx”

Browser (“Browser”).Page (“Login”).WebEdit (“j_password”).Set “yyyyy”

Browser (“Browser”).Page (“Login”).WebBu.on (“Log In”).Click

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

148 of 165 8/12/2014 6:10 PM

Page 149: QTP Challenges 4 Experts _ Just Another WordPress

Loop

‘Set FirstIteration as no and TestStatus as unknown

Environment (“FirstIteration”) =”no”

Environment (“TestStatus”) =”unknown”

Else

< Proceed with the application flow >

End If

Advantages of Data Driven Approach

Reduces the execution time drastically.Can be executed without human intervention.The script can be executed during the night hours, since there is no need for the resource to run thescript. Thus saving the normal works hours.Also we could schedule the run process, so that the execution will start at the scheduled time.Normally regression test will be performed on the last build before release. If we get any errors itbecomes difficult to fix it at the last minute. But if we use the Data driven script we could do aregression test on each build from construction to deployment, to ensure that all existingfunctionalities are not broken and to avoid the last minute surprises. Also if any bug is identified wewill have enough time to fix it. Also Debugging becomes easier.Very useful for testing application developed using Agile Methodology which will have frequentreleases.

QTP Start-up Tips

06 JAN 2010 Leave a comment

by vsprasad2k in challenges, QTP, QTP Tricks

1. Load only required Add-inns i.e. if working on window based application, do not load Web, Java etc.More then 3 Add-inns may slow down QTP.

2. Make sure that MS Script Debugger is installed on machine. Although it’s part of QTP installation but if your Internet connectivity is not proper while installing QTP, it might not be installed. It enables youto debug scripts and using breakpoints.

3. Open QTP first and then application. If application is already open, close it. Open QTP and then openapplication. (not true in few specific cases)

4. Check record se.ings..

a) Go to Test >> Record and Run Se.ings.

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

149 of 165 8/12/2014 6:10 PM

Page 150: QTP Challenges 4 Experts _ Just Another WordPress

b) Select the Windows Applications tab.c) Select the “Record and run test on any open Windows-based application” option.

5. Close all browsers before start recording.

6. Clear AutoComplete option in IE for user names and passwords

a) Tools >> Internet Options >> Content tab >> AutoComplete >> Se.ingsb) Clear “Usernames and passwords on form” checkbox

7. DataTable, Function Library and Object Repository are most common resources used in QTP. Makesure all these a.ached/managed properly.

8. By default, result is automatically open on completion of test execution. Close automatic result if youdon’t specifically require this.

a) Go to >> Tools >> Option >> Runb) Clear “Display Results after Iteration” checkbox

You can still open results whenever you want by clicking View >> Results.

9. Try to get good RAM (at least 2GB) on the machine. Be.er RAM you have, faster your QTP will be.

10. Clear temporary files frequently (once in a week).a) Restart Machineb) Go to Start >> Run >> type – %temp% >> Enterc) Delete all files and folders

QTP identifies Web objects as Window objects, doesn’t

record properly

06 JAN 2010 Leave a comment

by vsprasad2k in Uncategorized

Open QTP >> go to Automation >> Record and Run Se.ings >> select ‘Windows Applications’ tab >>Select the “Record and run test on any open Windows-based application” option. >> Click Apply.

Try if problem is solved. If problem still exists, check following se.ings in Internet Explorer (IE)-

1. Make sure to disable Protected mode in IE.Go to Tools >> Internet Options >> Security tab >> uncheck “Enable Protected Mode” >> Click Apply >>restart Internet Explorer.

2. Disable Tabbed Browsing (applicable in IE8 and la%er)Go to Tools >> Internet Options >> General Tab >> Click on Se.ing in Tabs section >> unchecked ‘EnableTabbed Browsing’ checkbox >> Click OK >> Restart IE

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

150 of 165 8/12/2014 6:10 PM

Page 151: QTP Challenges 4 Experts _ Just Another WordPress

Working on Regular Expressions in QTP

20 DEC 2009 Leave a comment

by vsprasad2k in QTP

Regular Expression:

♦ Regular Expressions enable Quick Test to identify objects and text strings with varying values.Regularexpressions areused when the objects value is dynamically changed.

♦ A regular expression is a string that specifies a complex search phrase. By using special characterssuch as a period (.),asterisk (*), caret (^), and brackets ([ ]), etc. you define the conditions of the search.

Steps to Specify Regular Expressions for an object in Object Repository:

1. Go to Object Repository. Navigation: Resources>>Object Repository.

2. Select the Object which you want to specify regular expression.

3. In the right side you can observe properties of that object.

4. Select the property which you want to specify regular expression.

5. Click on the property value of that property and the property value is editable. There is a configurebu.on appeared with thesymbol ”<#>”

6. Click on the configure bu.on or use Ctrl+F11 to open configure window.

7. Select Regular Expression check box.

a. If the property value is having any special characters then QTP will display a dialog with askingDo you want to add the backslash (\) before each special character in order to treat it literally?

b. If you click on yes QTP will automatically gives the backslash before every special character. So thatthe specialcharacters will be treated as literal.

8. Now specify the regular expression in constant edit box.

9. Click on OK.

10. Observe that a symbol “A.*” is added in property field. This means, that property is using regularexpression.

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

151 of 165 8/12/2014 6:10 PM

Page 152: QTP Challenges 4 Experts _ Just Another WordPress

11. Highlight the object in application to ensure that the provided regular expression is working fine.

In Dynamic descriptive programming we create a descriptive object using description.create.

While specifying properties we can give regular expressions. By default the properties will be treated asregular expression when you added to description object.

Set oDescription=Description.Create

oDescription(“micclass”).value= “Browser”

oDescription(“openurl”).value= “h.p://www.google.co.in&#8221 (h.p://www.google.co.in&#8221);

Here in this URL property there are three dots (.) which can be treated as regular expressions. Thesedots will work as regular expressions because by default the property values will be treated as regularexpressions.

There is a property called regularexpression for description object which is used to set the propertyvalues to work as regular expressions or as a literal string values.

In the Above example, set the regularexpression property to false to treat “h.p://www.google.co.in(h.p://www.google.co.in/)” as a literal string.

Set oDescription=Description.Create

oDescription(“micclass”).value= “Browser”

oDescription(“openurl”).value= “h.p://www.google.co.in&#8221 (h.p://www.google.co.in&#8221);

oDescription(“openurl”).regularexpression = False

oDescription(“openurl”).regularexpression = False

Note:

You can always use forward slash symbol (\) before every special character to treat a property value asliteral character.

Use of Regular Expression in QTP

We can use regular expressions in QTP when

1. Defining Properties of an Object

2. Verifying data using check points

3. Parameterize an object property or check pointNote:

♦ You can use regular expressions only for values of type string.

♦ By default all properties which you pass from object property are strings / Constants.

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

152 of 165 8/12/2014 6:10 PM

Page 153: QTP Challenges 4 Experts _ Just Another WordPress

♦ When using action parameters to parameterize a check point or an object repository, those actionparameters data typemust be string type. If you specify any other data type, that will not be treated as regular expression.

♦ We can assign property values to variables in QTP when using descriptive programming. Whenassigning regularexpression to any variable make sure that regular expression is in string format.

♦ When any special character in a regular expression is preceded by a backslash (\), QuickTest searchesfor the literalcharacter.

♦ If your searching for a character “*” in a string, then you need to give the pa.ern as “\*”

QTP Tips and Tricks

06 DEC 2009 Leave a comment

by vsprasad2k in challenges, QTP, QTP Tricks

Data Table

Two Types of data tablesGlobal data sheet: Accessible to all the actionsLocal data sheet: Accessible to the associated action only

Usage:DataTable(“Column Name”,dtGlobalSheet) for Global data sheetDataTable(“Column Name”,dtLocalSheet) for Local data sheet

If we change any thing in the Data Table at Run-Time the data is changed only in the run-time datatable. The run-time data table is accessible only

through then test result. The run-time data table can also be exported using DataTable.Export orDataTable.ExportSheet

How can i save the changes to my DataTable in the test itself?Well QTP does not allow anything for saving the run time changes to the actual data sheet. The onlywork around is to share the

spreadsheet and then access it using the Excel COM Api’s.

How can i check if a parameter exists in DataTable or not?The best way would be to use the below code:code:on error resume nextval=DataTable(“ParamName”,dtGlobalSheet)

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

153 of 165 8/12/2014 6:10 PM

Page 154: QTP Challenges 4 Experts _ Just Another WordPress

if err.number<> 0 then‘Parameter does not existelse‘Parameter existsend if

How can i make some rows colored in the data table?

Well you can’t do it normally but you can use Excel COM API’s do the same. Below code will explainsome expects of Excel COM APIs

code:Set xlApp=Createobject(“Excel.Application”)set xlWorkBook=xlApp.workbooks.addset xlWorkSheet=xlWorkbook.worksheet.addxlWorkSheet.Range(“A1:B10″).interior.colorindex = 34 ‘Change the color of the cellsxlWorkSheet.Range(“A1:A10″).value=”text” ‘Will set values of all 10 rows to “text”xlWorkSheet.Cells(1,1).value=”Text” ‘Will set the value of first row and first col

rowsCount=xlWorkSheet.Evaluate(“COUNTA(A:A)”) ‘Will count the # of rows which have non blankvalue in the column AcolsCount=xlWorkSheet.Evaluate(“COUNTA(1:1)”) ‘Will count the # of non blank columns in 1st row

xlWorkbook.SaveAs “C:Test.xls”xlWorkBook.CloseSet xlWorkSheet=NothingSet xlWorkBook=Nothingset xlApp=Nothing

SMART Identification

Smart Identification is nothing but an algorithm used by QTP when it is not able to recognize one of theobject. A very generic example as per the

QTP manual would be, A photograph of a 8 year old girl and boy and QTP records identificationproperties of that girl when she was 8, now when

both are 10 years old then QTP would not be able to recognize the girl. But there is something that is stillthe same, that is there is only one girl in

the photograph. So it kind of PI (Programmed intelligence) not AI.

When should i use SMART Identification?Something that people don’t think about too much. But the thing is that you should disable SI whilecreating your test cases. So that you

are able to recognize the objects that are dynamic or inconsistent in their properties. When the script hasbeen created, the SI should be enabled,

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

154 of 165 8/12/2014 6:10 PM

Page 155: QTP Challenges 4 Experts _ Just Another WordPress

so that the script does not fail in case of small changes. But the developer of the script should alwayscheck for the test results to verify if the SI

feature was used to identify a object or not. Sometimes SI needs to be disabled for particular objects inthe OR, this is advisable when you use

SetTOProperty to change any of the TO properties of an object and especially ordinal identifiers likeindex, location and creationtime.

Descriptive ProgrammingDescriptive programming is nothing but a technique using which operations can be performed on theAUT object which are not present in

the OR. For more details refer to h.p://bondofus.tripod.com/QTP/DP_in_QTP.doc(h.p://bondofus.tripod.com/QTP/DP_in_QTP.doc) (right click and use save as…)

Recovery Scenarios

What is a Recovery Scenario?Recovery scenario gives you an option to take some action for recovering from a fatal error in the test.The error could range in from

occasional to typical errors. Occasional error would be like “Out of paper” popup error while printingsomething and typical errors would be like

“object is disabled” or “object not found”. A test case have more then one scenario associated with it andalso have the priority or order in which it

should be checked.

What does a Recovery Scenario consists of?Trigger: Trigger is nothing but the cause for initiating the recovery scenario. It could be any popupwindow, any test error, particular state

of an object or any application error.Action: Action defines what needs to be done if scenario has been triggered. It can consist of amouse/keyboard event, close application, call a

recovery function defined in library file or restart windows. You can have a series of all the specifiedactions.Post-recovery operation: Basically defined what need to be done after the recovery action has beentaken. It could be to repeat the step, move

to next step etc….

When to use a Recovery Scenario and when to us on error resume next?Recovery scenarios are used when you cannot predict at what step the error can occur or when youknow that error won’t occur in your

QTP script but could occur in the world outside QTP, again the example would be “out of paper”, asthis error is caused by printer device driver. “On

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

155 of 165 8/12/2014 6:10 PM

Page 156: QTP Challenges 4 Experts _ Just Another WordPress

error resume next” should be used when you know if an error is expected and dont want to raise it, youmay want to have different actions

depending upon the error that occurred. Use err.number & err.description to get more details about theerror.

Library Files or VBScript FilesHow do we associate a library file with a test ?Library files are files containing normal VBScript code. The file can contain function, sub procedure,classes etc…. You can also use executefile

function to include a file at run-time also. To associate a library file with your script go toTest->Se.ings… and add your library file to resources

tab.

When to associate a library file with a test and when to use execute file?When we associate a library file with the test, then all the functions within that library are available to allthe actions present in the test. But

when we use Executefile function to load a library file, then the function are available in the action thatcalled executefile. By associated a library to

a test we share variables across action (global variables basically), using association also makes itpossible to execute code as soon as the script

runs because while loading the script on startup QTP executes all the code on the global scope. We canuse executefile in a library file associated

with the test to load dynamic files and they will be available to all the actions in the test.

Add-ins

Test and Run-time ObjectWhat is the difference between Test Objects and Run Time Objects ?Test objects are basic and generic objects that QTP recognize. Run time object means the actual object towhich a test object maps.Can i change properties of a test objectYes. You can use SetTOProperty to change the test object properties. It is recommended that you switchoff the Smart Identification for the

object on which you use SetTOProperty function.Can i change properties of a run time object?No (but Yes also). You can use GetROProperty(“outerText”) to get the outerText of a object but there isno function like SetROProperty to

change this property. But you can use WebElement().object.outerText=”Something” to change theproperty.

Action & FunctionsWhat is the difference between an Action and a function?

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

156 of 165 8/12/2014 6:10 PM

Page 157: QTP Challenges 4 Experts _ Just Another WordPress

Action is a thing specific to QTP while functions are a generic thing which is a feature of VB Scripting.Action can have a object repository

associated with it while a function can’t. A function is just lines of code with some/none parameters anda single return value while an action can

have more than one output parameters.

Where to use function or action?Well answer depends on the scenario. If you want to use the OR feature then you have to go for Actiononly. If the functionality is not about any

automation script i.e. a function like ge.ing a string between to specific characters, now this issomething not specific to QTP and can be done on

pure VB Script, so this should be done in a function and not an action. Code specific to QTP can also beput into an function using DP. Decision of

using function/action depends on what any one would be comfortable using in a given situation.

Checkpoint & Output valueWhat is checkpoint?Checkpoint is basically a point in the test which validates for truthfulness of a specific things in the AUT.There are different types of

checkpoints depending on the type of data that needs to be tested in the AUT. It can be text,image/bitmap, a.ributes, XML etc….What’s the difference between a checkpoint and output value?Checkpoint only checks for the specific a.ribute of an object in AUT while Output value can outputthose a.ributes value to a column in data

table.How can i check if a checkpoint passes or not?code:chk_PassFail = Browser(…).Page(…).WebEdit(…).Check (Checkpoint(“Check1″))if chk_PassFail thenMsgBox “Check Point passed”elseMsgBox “Check Point failed”end if

My test fails due to checkpoint failing, Can i validate a checkpoint without my test failing due tochecpoint failure?code:Reporter.Filter = rfDisableAll ‘Disables all the reporting stuffchk_PassFail = Browser(…).Page(…).WebEdit(…).Check (Checkpoint(“Check1″))Reporter.Filter = rfEnableAll ‘Enable all the reporting stuffif chk_PassFail thenMsgBox “Check Point passed”else

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

157 of 165 8/12/2014 6:10 PM

Page 158: QTP Challenges 4 Experts _ Just Another WordPress

MsgBox “Check Point failed”end if

EnvironmentHow can i import environment from a file on diskEnvironment.LoadFromFile “C:Env.xml”How can i check if a environment variable exist or not?When we use Environment(“Param1″).value then QTP expects the environment variable to be alreadydefined. But when we use

Environment.value(“Param1″) then QTP will create a new internal environment variable if it does notexists already. So to be sure that variable exist

in the environment try using Environment(“Param1″).value.

How to connect to a database?code:

Const adOpenStatic = 3Const adLockOptimistic = 3Const adUseClient = 3Set objConnection = CreateObject(“ADODB.Connection”)Set objRecordset = CreateObject(“ADODB.Recordset”)objConnection.Open “DRIVER={Microsoft ODBC for Oracle};UID=;PWD=“objRecordset.CursorLocation = adUseClientobjRecordset.CursorType = adopenstaticobjRecordset.LockType = adlockoptimisticObjRecordset.Source=”select field1,field2 from testTable”ObjRecordset.ActiveConnection=ObjConnectionObjRecordset.Open ‘This will execute your QueryIf ObjRecordset.recordcount>0 thenField1 = ObjRecordset(“Field1″).ValueField2 = ObjRecordset(“Field2″).ValueEnd if

Script to upload attachment in QC test lab

06 SEP 2009 Leave a comment

by vsprasad2k in Uncategorized

Dim oCurrentTest,oA.achment

Set oCurrentTest = QCUtil.CurrentTest.A.achments

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

158 of 165 8/12/2014 6:10 PM

Page 159: QTP Challenges 4 Experts _ Just Another WordPress

Set oA.achment = oCurrentTest.AddItem(Null)

oA.achment.FileName = “C:Results.xls”

oA.achment.Type = 1 oA.achment.Post

oA.achment.Refresh Set

oA.achment =Nothing

Set oCurrentTest =Nothing

How to perform Page Scroll using QTP

06 SEP 2009 Leave a comment

by vsprasad2k in Uncategorized

Syntax:object .doScroll(“Scrollingaction”)Scrolling Actions:1.Up2.down3.pageUp4.pageDown5.pageLeft6.pageRight and many more….Function Scroll()Browser(“micclass:=Browser”).Page(“micclass:=Page”).SyncSet oDoc=Browser(“micclass:=Browser”).Page(“micclass:=Page”).Object.BodyoDoc.doScroll(“pageDown”)Set oDoc=NothingEnd Function

Problem using ‘On Error Resume Next’

06 SEP 2009 Leave a comment

by vsprasad2k in challenges, QTP, QTP Tricks, QTP VBScript

Case: Login bu.on is not visible in AUTOn Error Resume NextBrowser(“browser”).Page(“page”).WebEdit(“loginname”).Set “Rajesh”

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

159 of 165 8/12/2014 6:10 PM

Page 160: QTP Challenges 4 Experts _ Just Another WordPress

Browser(“browser”).Page(“page”).WebEdit(“password”).SetSecure “mypassword”Browser(“browser”).Page(“page”).WebBu.on(“login”).clickOn Error GOTO 0Result : There will be no runtime error and because steps inside the ‘On error resume next’ are notoptional, it leads to incorrect result.So do we need to avoid using ‘On error resume next’?No, but remember.. Its useful when you intentionally don’t want to let some runtime errors occurduring script execution i.e. any temporary browser specific error or printer error which is not aboutAUT (application under test).

Working with DataBase Connections using QTP

06 SEP 2009 Leave a comment

by vsprasad2k in Uncategorized

Connect_DataBase() ‘Creates a new DB connection

Arguments passed to this function -

1. SessionName2. Connection_String – a connection string, for example the connection_string can be“DSN=SQLServer_Source;UID=SA;PWD=xyz123″.

Please note that the connection string will vary as per your database details.

Function to connect DataBase:

Function Connect_DataBase(strSessionName, strConnectionstring)Dim oConnectionon error Resume next‘ Opening connectionset oConnection = CreateObject(“ADODB.Connection”)If Err.Number <> 0 thenDataBase_Connection= “Error :- ” & CStr(Err.Number) & ” ” & Err.DescriptionErr.clearExit FunctionEnd If

oConnection.Open connection_stringoConnection.CommandTimeout = 120 ‘modify this value if needed.If Err.Number <> 0 thenConnect_DataBase= “Error := ” & CStr(Err.Number) & ” ” & Err.Descriptionerr.clearExit FunctionEnd If

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

160 of 165 8/12/2014 6:10 PM

Page 161: QTP Challenges 4 Experts _ Just Another WordPress

set sessionName = oConnectionConnect_DataBase = 0End Function

Function to retrieve data from record set:

Function db_get_field_value( myrs , rowNum, colNum )dim curRow

myrs.MoveFirstcount_fields = myrs.fields.count-1If ( TypeName(colNum)<> “String” ) and ( count_fields < colNum ) thendb_get_field_value = -1 ‘requested field index more than exists in recordsetElsemyrs.Move rowNumdb_get_field_value = myrs.fields(colNum).ValueEnd IfEnd Function

Use the above functions to connect and retrive data from DB:

Con = <name of the session>SQL=”SELECT * FROM Your_Table”con_string=”DSN=SQLServer_Source;UID=SA;PWD=xyz123″

isConnected = Connect_DataBase (Con , con_string)

‘Now check if connection is successful. Function will return zero if connection is successful.If isConnected = 0 then‘Execute your SQL statementset myrs = Con.Execute(SQL)

‘Retrieve values from the recordsetprint “val – row 0 col 0: ” & db_get_field_value( myrs , 0 , 0 )print “val – row 0 col 1: ” & db_get_field_value( myrs , 0 , 1 )End If

Con.closeSet Con = Nothing ‘Disconnect database

How to get text of Status Bar from QuickTest Professional

24 MAY 2009 1 Comment

by vsprasad2k in QTP, QTP Tricks

There are two ways:

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

161 of 165 8/12/2014 6:10 PM

Page 162: QTP Challenges 4 Experts _ Just Another WordPress

Object.StatusText property of Browser object1.

GetROProperty(“text”) method of WinStatusBar object2.

Ge%ing text of Status Bar using Object.StatusText property of Browser objectTo access text of

Status Bar, we use Browser’s Object object and its StatusText property.Browser(“bname”).Object is a reference to the Internet Explorer’s DOM object. To be more precise,it’s a reference to the Internet Explorer’s IWebBrowser2 interface.

Using Browser(“bname”).Object, you can access different methods and properties of IE, for example:

1.

# Statement Meaning

1 Browser(“bname”).Object.GoBack Navigates backward one item in the history list

2 Browser(“bname”).Object.LocationURL Gets the URL of the page that is currently displayed

3 Browser(“bname”).Object.StatusText Sets or gets the text in the status bar for the object

4 Browser(“bname”).Object.ToolBar Sets or gets whether toolbars for the object are visibl

So, our code is simpe enough:2.

sText = Browser(“QTP – How to get Status”).Object.StatusTextMsgBox sText

sText = Browser(“QTP – How to get Status”).WinStatusBar(“msctls_statusbar32″).GetROProperty(“text”)MsgBox sText

Working with ADODB connections using QTP

24 MAR 2009 Leave a comment

by vsprasad2k in QTP ADODB Tags: QTP ADODB

How to open a password-protected database.

Example:

Dim FlightNumber

Dim dbexample

‘ Create the conection object.

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

162 of 165 8/12/2014 6:10 PM

Page 163: QTP Challenges 4 Experts _ Just Another WordPress

Set dbexample = CreateObject(“ADODB.Connection”)

‘Set the connection string and open the connection

dbexample.ConnectionString = “DBQ=D:\Program Files\Mercury Interactive\WinRunner\samples\flight\app\flight32.mdb;DefaultDir=D:\Program Files\Mercury Interactive\WinRunner\samples\flight\app;Driver={Microsoft Access Driver (*.mdb)};DriverId=281;FIL=MSAccess;MaxBufferSize=2048;MaxScanRows=8;PageTimeout=5;SafeTransactions=0;Threads=3;UserCommitSync=Yes;”

dbexample.Open

‘or use this method if a DSN entry was created.

‘dbexample.Open(“DSN=Flight32″)

flflightnumber = 6195

‘ Get the recordset returned from a select query.

Set recordset = dbexample.Execute(“SELECT * from Orders WHERE Flight_Number = ” &flightnumber)

‘ Display the results of the query.

msgbox recordset.GetString

‘ Close the database connection.

dbexample.Close

Set dbexample = Nothing

If your query returns several columns, you can use the Fields method to retrieve data from specifiedcolumns in the returned record set.

Example:

‘ Connect to the Flight32 database

Set dbexample = CreateObject(“ADODB.Connection”)

dbexample.Open(“DSN=Flight32″)

‘ Perform a query

Set recordset = dbexample.Execute(“SELECT * from Orders”)

‘ Get the values from the Customer_Name column

while (NOT recordset.EOF)

MsgBox recordset.Fields(“Customer_Name”)

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

163 of 165 8/12/2014 6:10 PM

Page 164: QTP Challenges 4 Experts _ Just Another WordPress

‘ Move to the next value in the record set

recordset.MoveNext

wend

‘ Close the database connection.

dbexample.Close

Set dbexample = Nothing

Message Box closes automatically using windows shell

05 MAR 2009 1 Comment

by vsprasad2k in challenges, QTP, QTP Tricks, Uncategorized

Dim msgmsg = “Message Box automatically close in 5 second”Set oShell = CreateObject(“WScript.Shell”)oShell.Popup msg,10, “QTP Challenges”In above statement, there are three arguments -msg – the content/string of the message box10 – the time in seconds“QTP Challenges” – the title of the message box

Working with WMI (Windows Management Infrastructure)

05 FEB 2009 Leave a comment

by vsprasad2k in challenges, QTP, QTP Tricks, Uncategorized

Dim flag, AllProcess, AppToRunAppToRun = “ixplore.exe”Flag = FlaseSet AllProcess = GetObject(“winmgmts:”)

For Each Process In AllProcess.InstancesOf(“Win32_process”)If (Instr ((Process.Name), AppToRun) = 1) ThenPrint “Internet Explorer is running..”Flag = TureExit For

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

164 of 165 8/12/2014 6:10 PM

Page 165: QTP Challenges 4 Experts _ Just Another WordPress

End IfNext

If Flag = Flase ThenPrint “Internet Explorer not is running..”SystemUtil.Run AppToRunEnd If

You can do the same for any process/application. You just need to change the value of AppToRunvariable.

Blog at WordPress.com. • The Koi Theme.

Follow

Follow “QTP Challenges 4 Experts”

Powered by WordPress.com

:)

QTP Challenges 4 Experts | Just another WordPress.com site http://qtpchallenge.wordpress.com/

165 of 165 8/12/2014 6:10 PM