QTP Tips – Part 3
11. How to remove result files from old tests?
You can use the Test Results Deletion Tool to view a list of all the test results in a specific location in your file system or in a Quality Center project. You can then delete any test results that you no longer require.
The Test Results Deletion Tool enables you to sort the test results by name, date, size, and more, so that you can easily identify the results you want to delete.
You can find this utility in the Start Menu > QuickTest Professional > Tools > Test Results Deletion Tool.
12. How to change the logical name of a Test Object?
When recording an object QuickTest Professional uses one of the object’s properties as the logical name for the object (the name displayed in the Expert View and in the KeywardView modes).
You can change the property that is used to be a different one by specifying which property’s value you want to use as the logical name for the object.
For example in order to use the alt property as the logical name of an image, run regedit.exe and set the following information:
[HKEY_LOCAL_MACHINE\SOFTWARE\Mercury Interactive\QuickTest Professional\MicTest\Test Objects\Image]
“tag query name”=”alt”
13. How to record on non standard menus?
In QuickTest Professional 8.0 you can decide how do you want QuickTest to behave while recording on menus from the UI.
This option is available in the “Advanced Windows Application Options” dialog to be found under
Tools > Options > Windows Applications > Advanced.
More information can be found in the QuickTest User’s Guide.
16 How to terminate an application that is not responding?
You can terminated any standard application while running a script in QuickTest.
If you want to terminate the application, just set this line:
SystemUtil.CloseProcessByWndTitle “Some Title”
Where can I find information on the IE Document Object Model?
You can find more information on the IE DOM in the following links:
Document object: http://msdn.microsoft.com/workshop/author/dhtml/reference/objects/obj_document.asp
Other HTML Objects: http://msdn.microsoft.com/workshop/author/dhtml/reference/objects.asp
General DHTML reference: http://msdn.microsoft.com/workshop/author/dhtml/reference/dhtml_reference_entry.asp
14. How to configure QuickTest to record on Embedded HTML Controls?
In order to be able to record context sensitive operations on Embedded HTML Controls (an application which contains an embedded IE HTML viewer), you will need to set the following
Add to the ie_hook section in mic.ini (located under QuickTest bin directory) the following lines:
myapp.exe=yes (where myapp.exe is the executable name of the application you want to test)
you should change the following setting in the registry:
[HKEY_CURRENT_USER\Software\Mercury Interactive\QuickTest Professional\MicTest\Hooks\myapp.exe]
15. How do I launch a new browser from a test?
A new browser window (and any other application) can be launched from within a test by adding the following step to your test:
SystemUtil.Run “iexplore.exe”, “http://www.mercuryinteractive.com”
16. How to access the HTML tags directly?
QuickTest provides direct access to the browser’s Document Object Model (DOM) through which you may access the HTML tags directly. Access to the DOM is done using the .Object notation. You can find more information about the DOM on the Microsoft Web Workshop web site.
The test below demonstrates how to iterate over all the tags in the page. The test then outputs the inner-text of the tags (the text contained between the tags) to the report using the Reporter object.
‘ We need the on error because not all the elements have inner-text
On Error Resume Next
Set Doc = Browser(“CNN Interactive”).Page(“CNN Interactive”).Object
‘ Loop through all the objects in the page
For Each Element In Doc.all
TagName = Element.TagName ‘ Get the tag name
InnerText = Element.innerText ‘ Get the inner text
‘ Write the information to the report
Reporter.ReportEvent 0, TagName, InnerText
17. Where can I find a web page’s cookie?
The cookie used by the browser may by accessed through the browser’s Document Object Model (DOM). The following example returns the cookie collection from the browser. You can find more information about the DOM on the Microsoft Web Workshop web site.
Browser(“Flight reservations”).Page(“Flight reservations”).Object.Cookie
18. Changing the Mic.ini file
Some of QuickTest Professional information is stored in a text file which is called mic.ini. This file is located under the QuickTest bin directory.
To enter the above change to the mic.ini file you should perform the following:
1. Open the mic.ini file located under the QuickTest Professional bin directory using any standard text editor
2. Search for section name (in this case ‘SectionA’). If it does not exists – add it to the end of the file
3. If the line (beginning with the NameA text) exists in the section, then change the value to be ValueA
4. If the line does not exist add it to the end of this section (before the next Section begins)
19. How to change the registry?
Note: Errors in correct editing of the registry may cause severe malfunction of the operating system.
[HKEY_CURRENT_USER\Software\Mercury Interactive\QuickTest Professional\MicTest\KeyA]
In order to enter the above change to the registry, you should do the following:
1. Open regedit (type regedit in the Start>Run dialog)
2. Navigate to the specified path (in this case navigate to HKEY_CURRENT_USER > Software >…>KeyA)
3. If the path does not exists, right click on the right pane, choose Key and enter the missing key name
4. If the value does not exists, right click on the right pane, choose DWORD value or String value and enter the missing variable name
5. Right click on the variable, choose Modify and change the value to the correct one
20. How to change the template test which is used by Quality Center to create new tests?
When creating a new test from Quality Center, the test is based on a template test which is located under “bin/TD2000” directory under the “TestDirector Plugins” installation.
You can replace this test to contain the test template that you wish to be used.
Note that if you change the test to use a QuickTest Professional 6.0 (or later) template test then this test can not be opened in Astra LoadTest 5.x
21. How to change the manual template test which is used by Quality Center when converting manual tests to QuickTest test?
When you have a manual test defined in Quality Center and you want to create from it an automatic test, you can control the way this automatic test will be created.
You can edit the ManualTemplate.txt file located under “bin/TD2000” directory under “TestDirector Plugins” installation to contain the steps which you want to be generated in the QTP test for each manual step.
22. How to close QuickTest after <n> runs when running from Quality Center?
When running multiple QuickTest Professional tests from Quality Center you can specify that you want to close QTP after specific amount of tests which are executed.
To do so, you should add to the end of the mic.ini file (located under the bin directory of QTP installation) the following lines:
23. How to configure which add-ins will be loaded when working with Quality Center?
Note: From QTP 6.5 version the test is opened with the correct add-ins, the settings below can be used with older versions.
When Quality Center launches QuickTest Professional to run tests, then by default QTP is loaded with all add-ins which are installed on the machine. If you want QTP to be loaded with the last add-ins configuration which was opened on this specific machine you should change the following value in the registry of the machine which QTP is running on:
[HKEY_CURRENT_USER\Software\Mercury Interactive\QuickTest Professional\MicTest\AddIn Manager]
24. How to open Quality Center connection dialog faster?
You can launch the Quality Center connection dialog by double clicking on the right pane of the status bar of either QuickTest or the Report.
How do I use QuickTest together with Quality Center?
Quality Center is a powerful test management tool that enables you to manage and control all phases of software testing. It provides a comprehensive view of the testing process so you can make strategic decisions about the human and material resources needed to test an application and repair defects.
Quality Center and QuickTest work together to integrate all aspects of the testing process. In QuickTest, you can create tests and save them in your Quality Center project database. After a test has been run, the results are viewed and analyzed in Quality Center.
For more information on using QuickTest and Quality Center together, please refer to the QuickTest User’s Guide.
Read: QTP Tips Part 1
Read: QTP Tips Part 2