May 20th, 2009 admin Posted in Quick Test Professional, Uncategorized 3 Comments »
By Roshi Malhotra
(Continued from Updates about QTP 10 (I) … )
II. Report improvements
The native QTP report includes several new improvements:
Tracability: Selecting a report-node will automatically focus on the relevant code-line in the script. This may sound like a cool feature at first, but a closer look revels that it only works for actions (not functions); and that in any case, using a custom report function (as most of us do) completely nullifies the feature (since you’re always at the same code line when performing the report).
Exporting: The report now has a two-click export feature, which comes with a built-in ability to export to Word and PDF documents, as well as the ability to export through a custom XSL of your choosing. You can choose between Short and Long formats (corresponding to PShort.XSL and PDetails.XSL) to get a document relevant to your needs. This blessed feature has one major flaw – It has no API support. This means that you cannot export the results automatically at the end of a test run, which is quite a miss, to say the least.
Resource Monitor: QTP can now hook onto the Windows Performance Monitor and present it as part of the test results. You can select several counters to monitor (e.g. GDI objects, memory usage etc.), and the monitor output graph will be available in special tab in the result window. You can set up a “checkpoint” for a counter (e.g. Fail the test if there are more than 500 GDI objects), facilitating a kind of a poor-man’s version of load-testing.
The fact that clicking the graph focuses on the relevant test step (as well as the other way around), provides an effective way to quickly locate problematic actions and resource usage spikes. This feature is well executed, and HP has even went the extra mile and added several unified counters that simplify monitoring the application. However, the fact that you can only monitor one process per test may leave the more advanced users with their own implementation of a resource monitor.
Native image integration: This is a small, yet long-awaited feature. The ReportEvent command now has a new optional parameter – you can specify a path to a picture file, and it will be attached to the report node of the current event. When used in conjunction with the CaptureBitmap method, this presents a technical, yet revolutionary upgrade to the native QTP report. Finally, users can attach screenshots to their custom report events without any special functions or frameworks.
III. IDE improvements
Intellisense: IDE improvements, and the new intellisense engine in particular, is what got me excited about QTP Atlantis.
Can create an Excel COM object provided a full intellisense for all its methods and properties, for as many levels as we’d like. Every variable set to this object also presented the same intellisense, and the autocomplete caught every variable we’ve defined or used (yes, there’s autocomplete for variable names!). The autocomplete and intellisense features worked smoothly, and presented no apparent performance issue. It’s still left to be seen how it functions in a real script, with hundreds / thousands code lines.
Tasks and Comment Pane: QTP has a new bottom pane which includes a run-of-the-mill implementation of tasks and comments. Double clicking a comment will take you to the relevant code-line, though strangely enough, you cannot do this with a task (i.e., tasks cannot be linked to specific code lines). It was mentioned that enabling the comments feature for function libraries may sometimes cause performance issues.
Dynamic code-zones: When standing inside a code block like If, While, Do, etc, the IDE will mark the relevant block with blue lines, making it much more easy to make your way inside nested blocks of this sort (somewhat like highlighting left-right bracket pairs). While it will surely make our life easier, a more robust mechanism like collapsible code-regions is still needed.
Custom Toolbars: You can add your own buttons and commands to QTP toolbars and menus. While this does not include inner-QTP macros, you can assign a program / File shortcut to your own button / menu item. It’s nice, but i think it will only gain power once QTP’s inner mechanisms will be bindable to such buttons.
IV. Miscellaneous features
General look and feel: QTP has departed from the old Tab layout, and into the more modern settings-tree layout (similar to Office, EMule, Adobe, and pretty much every other program). It’s nice, but nothing as groundbreaking as the transformation in QTP 9.0.
Bitmap Checkpoint improvements: These include presenting the size of the selected area when choosing to check only a part of an Image, as well as the ability to plug your own custom DLL for comparing images. Another great addition is the ability to see the difference between the expected and actual bitmaps in a separate tab.
API changes: QTP Automation API will receive several upgrades, the most noteworthy of which is the ability to read and write that code of the test you’ve opened. Writing the code will not effect an ongoing run-session (there goes my ambitious try-catch implementation for QTP), but it still opens the door for some creative tweaks and hacks…
Saving a test with all linked resources: For those who’re working with QC, this is a real blessing. Up until QTP 10, copying a QC saved test to your local system was a hellish procedure of changing each and every resource and action reference to your local file-system. QTP and QC Atlantis offer a one-click solution for copying a test and all its resources to your local file-system, and automatically changing all the references accordingly.
Dynamic Action Call: I’ve saved the best for last. QTP 10 presents a new native command – LoadAndRunAction. It allows you to load external actions during the run-session, without having to associate them with your test beforehand. All the run-time debug abilities will be available for these dynamically added actions, so you’re not giving anything up by using this feature. I think it’s a long awaited feature, and a well executed one.

May 15th, 2009 admin Posted in Quick Test Professional 3 Comments »
By Roshi Malhotra
QTP 10 revolves around 3 pivotal features, alongside several minor features (which turned out to be quite revolutionary):
I. QC integration – which (mostly) boils down to Resource Management and Source Control:
Resource Management: Although you could keep saving your resources as attachments (for backward compatibility), you can upgrade to a new, fuller mode of work. This includes a whole new Resource module in QC, and allows for some very neat tricks on Function Libraries, Tests, Object Repositories etc.
It should be noted, though, that other types of files (external excel / XML files, for example), remain as unmanaged attachments.
1. Resources have full meta-data, and have a special view pane – you can view Object-Repositories, data-tables, and function libraries code right from QC.
2. Resources are aware of their dependencies – Who relies on them, and who do they rely on. This enables a very strong warning system – when changing / deleting a resource, you’ll be alerted to the repercussions – namely, which tests, if any, might break. Also, the ability to immediately know who uses a share object repository is very useful, nearly revolutionary.
3. A very neat trick is a live, automatically updated path system – When moving a function library between folders, QC will automatically update all the tests which depend on it, so they will use it at its new location. This makes the once critical problem of hard-path-link a non-issue. Very impressive.
4. A word about the user interface – when opening a QC resource / test from QTP, the file dialog shows the items with large, crisp icons, very similar to Word’s save dialog. Everything is very clear and intuitive, as is the ability to revert back to saving / opening a test from the File-System.
5. And what about your existing projects? Well, when upgrading to QC 10, a wizard will automatically transform all you unmanaged attachments to managed resources (if you’d like it to).
Source Control: This includes a very rich line of features which are very well executed, and effectively allow you to manage a QTP project as any other code project:
1. First, the basics – QTP and QC 10 introduce a new Check-in/Check-out ability. It works similar to what you’d expect – a checked out item will be locked to all other users, and you can immediately know an item’s status by looking at its icon (green/red locks).
2. An interesting twist regards manner in which a test / resource is locked – it’s at the user level (not the local machine level). This means that if you log into QC from a different machine, you’ll have access to all your checked-out items, even if they were originally checked-out on a different local machine. The ability is implemented very well, both from QTP’s end, as well as from QC’s end.
A major enabler for source control is the new versioning feature of QC. It manifests both with a kind of instant versioning for a single resource, and with a project-wide “base-line version”, which allows you to revert your entire test framework to a previous version. Both types of versioning are supported by a surprisingly robust comparison mechanism. You can select two versions of a resource / test, a see a very detailed comparison of their respective changes. For function libraries this amounts to a “simple” text comparison, but this feature truly shines in full test comparisons.
It will present changes in the different actions and their resources (data-table, object repositories, inner code), as well as in the global test-settings, associated function libraries, recovery scenarios, and pretty much anything you could think of. The ability to drill-down into the data is very impressive; and the effective, concise manner in which the data is presented in the top level view is downright unbelievable. A nice touch is a small screen capture of the change, in case you don’t remember what “Run all rows –>Changed into-> Run a single iteration only” means (for example).
Now to the versioning mechanism itself: Whenever you check and item in, a new “version” will be created, and you’ll be able to revert back to it with ease. The snapshots are visible both from QC and QTP, and you can very easily choose which one to open. This allows you a kind of an instant undo to a single file which worked in the past, but is broken in the present.
The second mechanism presents the ability to select several folders, and create a full blown “base-line version” of them and everything they relate to. Defects, inner-connections, tests, history data, resources – all these and more will be “frozen” and preserved as a base-line. You can then choose to revert back to an old baseline, and truly regain all the abilities that were present at that time. As all the resources, attachments tests and reports will be restored, you don’t have to worry about forgetting anything, or leaving some minor resource at the wrong version. This is versioning with a vengeance – it allows you to track the AUT’s versions with your own automation versions, enabling, among other things, running automation efforts on several AUT versions at once.
For conclusion – The new abilities inherit in the connection of QTP and QC Atlantis are (or at least seem to be) revolutionary. At last, QTP projects can be natively managed as code projects; and some of the supporting infrastructure is surprisingly robust and useful.
(to be continued…)

April 24th, 2009 admin Posted in Quick Test Professional 7 Comments »
By Parul Wahi
What is Ajax?
Ajax, short for Asynchronous JavaScript and XML, is a web development technique for creating interactive web applications. The intent is to make web pages feel more responsive by exchanging small amounts of data with the server behind the scenes, so that the entire web page does not have to be reloaded each time the user makes a change. This is meant to increase the web page’s interactivity, speed, and usability.
Testing Ajax is different and difficult
In traditional web applications, the HTML elements are already loaded in the web pages which have been fairly easy to test in an automated fashion. Unfortunately, AJAX-based web applications are not as easy or consistent to test as the traditional web applications. The problem with AJAX testing is that the web page under test will be modified asynchronously such as an element will be dynamically added based on a check box click or an element will be removed based on a list element selection, etc.
Synchronization issues are also there. Clicking a link will not cause a page reload; instead the browser will converse with the server and refresh just a part of current page. The time delay between clicking a link and seeing the results is what makes things tricky.
Due to the asynchronous nature of the Ajax the result doesn’t come back from the server immediately. The result from server takes time but the automation tools would check the results immediately. In case of Ajax .sync and WaitProperty also doesn’t provide correct results.
Testing Ajax technology using QTP
QTP 9.5 provides the facility of testing Ajax objects. For testing Ajax objects using QTP 9.5 Web Extensibility toolkit should be installed. This will cause a mini Ajax add-in to show up besides the web add-in in the Add-in manager dialog. After installing WEB Add-in Extensibility kit, check both web and Ajax addins in addin manager and then try recording the scripts.
Still using QTP 9.2 and earlier versions?
QTP 9.2 and previous version doesn’t support Ajax technology. But one can use DOM approach to handle Ajax applications. DOM seems to be the best option available.
Let’s study one example:
There are some text fields on a page, having auto complete feature i.e. as we key-in the characters in the text-box, the application fetches the matching results and displays them in the pop-up area below the field. The required record from the results shown in the pop-up is then selected.
Now at the time of recording these actions, QTP records the step of entering the characters in the field. However it doesn’t record the step of mouse click over a record in the pop-up results or maybe record it as webelement.
Solution:
Generally such pop-up results are created on the fly as characters are typed in the text-field, using Ajax technique. The best thing that works for such scenarios is DOM. Usually such results are created dynamically within <SPAN>, <DIV> or <TD> elements.
These objects can be identified by an automation script using following four parameters:
1. Name of the page on which the object exists
2. HTML tag of the object e.g. INPUT, TD, DIV, SPAN
3. Name of a property of the object that can be used to identify the object uniquely from among the other objects of same type on the page.
(For hyperlink type of object it can be the “innertext” or “href” property, for table cell, it can innertext, for list-box it can be Id, name or innertext. Some objects can be identified uniquely by their innerHTML, or outerHTML. )
4. Value of the above property i.e. “txt_FirstName” (if Name property is used) or “txt_FirstNameId” (if ID property is used)
The idea is to identify the element TAG in which selected item from the popup is stored is and displayed, whether it is in DIV tag, SPAN tag TD tag, Font tag etc and check the outerHTML of the element and see if there is any onmouseover/onclick/onchange event declared for the object. Then trigger the OnMouseover event for the result item to be selected, Bring mouse over the result item to be selected and then trigger the onclick event for the result item to be selected.
This approach uses the Document Object Model (DOM) of web-page to recognize objects on the page, access their properties to perform any action/operation on the web-objects. This approach is useful for automation of web-based apps and requires a good understanding of HTML, DOM and VBscript.
The object which can’t be accessed using DOM, for recognizing them use of Descriptive Programming feature of QTP is recommended.

February 13th, 2009 admin Posted in Quick Test Professional No Comments »
By Sandhya Sapru
You can use the QuickTest Professional automation object model to automate your QuickTest operations. Using the objects, methods, and properties exposed by the QuickTest automation object model, you can write scripts that configure QuickTest options and run tests or components instead of performing these operations manually using the QuickTest interface.
Automation scripts are especially useful for performing the same tasks multiple times or on multiple tests or components, or quickly configuring QuickTest according to your needs for a particular environment or application.
An object model is a structural representation of software objects (classes) that comprise the implementation 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.
Essentially all configuration and run functionality provided via the QuickTest interface is in some way represented in the QuickTest automation object model via objects, methods, and properties.
A one-on-one comparison cannot always be made, most dialog boxes in QuickTest have a corresponding automation object, most options in dialog boxes can be set and/or retrieved using the corresponding object property, and most menu commands and other operations have corresponding automation methods.
You can use the objects, methods, and properties exposed by the QuickTest automation object model, along with standard programming elements such as loops and conditional statements to design your script.
Automation scripts are especially useful for performing the same tasks multiple times or on multiple tests or components, or quickly configuring QuickTest according to your needs for a particular environment or application.
For example, you can create and run an automation script from a VBS file that loads the required add-ins for a test or component, starts QuickTest in visible mode, opens the test or component, configures settings that correspond to those in the Options, Test or Business Component Settings, and Record and Run Settings dialog boxes, runs the test or component, and saves the test or component.
You can then add a simple loop to your script so that your single script can perform the operations described above for multiple tests or components.
You can also create an initialization script that opens QuickTest with specific configuration settings. You can then instruct all of your testers to open QuickTest using this automation script to ensure that all of your testers are always working with the same configuration.
Description
The QuickTest automation object model exposes the objects You can use these objects, and their associated methods and properties, to write programs that automatically configure QuickTest options and run tests.
Let us have an example on Automation Object Model where in we can :–
Launch a QTP through vbs file,
Associate the required Repositories,
Save your Test and finally
Quit
‘Create a file with any name say Main.vbs
Dim qtApp ‘Create a variable to store the address of a QuickTest Application
Dim strPath
”””””””””””””””””””””””””””””””””””””””’
Set qtApp = CreateObject(”QuickTest.Application”)
qtApp.Launch ‘Launch method launches QTP Application
qtApp.Visible = True ‘You can make the QTP Application visible
””””””””””””””””””””””””””””””””””””””””’
‘Now set the path where you can locate your scripts
strPath = qtApp.Folders.Locate(”C:\Documents and Settings\ssapru\My Documents\QACAMPUSBLOG\scripts”) ‘
If qtApp.Folders.Find(strPath) = -1 Then
qtApp.Folders.Add strPath, 1
End If
”””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””’
‘To associate your repositories with the test.
Set qtRepositories = qtApp.Test.Actions(”Action1″).ObjectRepositories
qtRepositories.Add “C:\Documents and Settings\ssapru\My Documents\QACAMPUSBLOG\repositories\Repository1.tsr”, 1
””””””””””””””””””””””””””””””””””””””””””””””””
‘ To create a new Test in the QTP
qtApp.New
‘To save the test if it is not already created..
If qtApp.Test.Modified Then
If qtApp.Test.IsNew Then
qtApp.Test.SaveAs “C:\Documents and Settings\ssapru\My Documents\QACAMPUSBLOG\scripts\ss2″
else
qtApp.Test. Save
End If
End If
‘ If the current opened Test isnot new..
If Not qtApp.Test.IsNew Then ‘ If the current test is not new
qtApp.New ‘ Open a new test
End If
””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””
‘Deallocate memory
”””””””””””””””””””””””””””””””””””””””””””””””””””
qtApp.Quit Quit QuickTest
Set qtRepositories = Nothing ‘ Release the action’s shared repositories collection
Set qtApp = Nothing

September 8th, 2008 admin Posted in Quick Test Professional No Comments »
By Parul Wahi
In order to run QTP scripts on schedule, we can run them directly from command line.
In order to do so we can make use of QTP Automation Object Model which can help us in automating QuickTest operations. Using the objects, methods, and properties exposed by the QuickTest automation object model, we can write scripts that configure QuickTest options and run tests instead of performing these operations manually using the QuickTest interface.
In the following code we are trying to execute a QTP script called “Google_search” from command line. Let’s create a script in QTP and save it as Google_search.Write the following code in a vbs (VB Script) file as save it as demo.vbs:
Dim qtApp ‘ Declare the Application object variable
Dim qtTest ‘ Declare a Test object variable
Dim qtResultsOpt ‘Declare a Run Results Options object variable
Set qtApp = CreateObject(”QuickTest.Application”) ‘ Create the Application object
qtApp.Launch ‘ Start QuickTest
qtApp.Visible = True ‘ Make the QuickTest application visible
qtApp.Open “C:\Documents and Settings\pwahi\Desktop\Google search“, True ‘ Open the test in read-only mode
‘ set run settings for the test
Set qtTest = qtApp.Test
qtTest.Run’ Run the test
WScript.StdOut.Write “Status is:” & qtTest.LastRunResults.Status ‘ Check the results of the test run
qtTest.Close ‘ Close the test
Set qtTest = Nothing ‘ Release the Test object
Set qtApp = Nothing ‘ Release the Application object
Now in order to execute QTP script from command line we have to execute the above created vbs file from command prompt which will in turn launch QTP, open the script, run it and will display the result in command prompt only. Open command prompt and write following code:
C:\Documents and Settings\pwahi\Desktop>cscript //nologo demo.vbs
And press enter
This command will execute the demo.vbs file which in turn launch QTP, open the script Google search, execute it and will display the result in QTP result file. We can also see the results in command prompt as shown below.
If the script passes the result is declared in command prompt as follows:
Status is: Passed

|