Category Archives: Unified Functional Testing

HP Unified Functional Testing related troubleshooting tips

Highlight an object or window using QTP

To highlight an object or window manually or programmatically (from within the script)

Manually

Object Repository window. Available also in the Object Repository Manager for shared object repositories:
1. Open the Object Repository

2. Select desired object to highlight

3. Go to "View" menu

4. Select "Highlight in application" option

5. See results:
◦ Succesful: Blinking gray rectangle surrounding the object

◦ Failed: A pop-up window with an error or warning.

Object Spy. Available in QuickTest Professional 11.00, Unified Functional Testing 11.5 and later):
1. Open the Object Spy dialog

2. Click on the spy button

3. Click/Select desired object or child of desired object

4. Select desired object from the Hierarchical tree pane

5. Click the "Highlight in application" option, next to "Spy" button

6. See results (Exact same as when using similar option from Object Repository section above)

Programmatically

Call/Invoke/Use the hidden/undocumented programmatic Highlight method.

Object(description).highlight

Where "Object" is a Test Object class.

description – The logical name or a descriptive programming description of the object or window to be highlighted.

Example:

Browser("Netscape.com").highlight
wait 1
Browser("Netscape.com").Page("Netscape.com").Link("Breaking News:").highlight
wait 1
Browser("Netscape.com").Page("Netscape.com").Image("Get Quote").highlight

‘ or

Window("Notepad").WinEditor("Edit").highlight
wait 1
Window("Notepad").highlight
wait 1

Advertisements

QuickTest Professional Causes the Operating System to Crash or Hang

In extremely rare cases, QuickTest Professional (QTP) might cause system crashes, or hangs, after it is installed. These types of problems can occur at any point, but are most common during: 1. Launching QTP
2. Closing QTP
3. During text recognition statements
64-bit operating systems will also report, in the Windows Event Viewer, that a driver cannot be loaded and needs to be updated for 64-bits.
pal_drv.sys is the system driver that both QTP, and WinRunner, use. It was developed for the old text recognition mechanism that is no longer supported.

1. Open a command prompt (Start > Run > type “cmd” > “Ok”)
2. Navigate to “/bin” directory (for example: “cd C:\Program Files\HP\QuickTest Professional”) 3. Run the following command:

nt_tr.exe -remove
4. Reboot the machine.

Modify QuickTest Professional Text Recognition behavior

By default, when QuickTest Professional captures text for a text/text area checkpoint or output value step using the GetText, GetTextLocation, or GetVisibleText methods, it tries to retrieve the text directly from the object using a Windows API-based mechanism. If QuickTest Professional cannot capture the text this way (for example, because the text is part of a picture), it tries to capture the text using an OCR (optical character recognition) mechanism provided by ABBYY Software Ltd.

Changing QTP 10.00 or higher default text recognition behavior
Additional configuration settings have been incorporated in QTP 10.00 for the text recognition mechanism. It can now be modified from the “Tools -> Options…” dialog under the “General > Text Recognition” section. Alternatively, as in previous versions, these settings can also be modified from Windows Registry Editor as described below. Changing QTP 9.2/9.5 default text recognition behavior
The default behavior of QuickTest Professional 9.2/9.5’s text recognition mechanism can be changed by modifying values in the registry.

Important:
The Windows Registry Editor is an advanced tool for changing settings in your system registry. You should not edit your registry unless absolutely necessary. If there is an error in your registry, your computer may not function properly.

The text recognition behavior is controlled by the values in the HKEY_CURRENT_USER\SOFTWARE\Mercury Interactive\QuickTest Professional\MicTest\OcrEngine registry key.

The following table lists the possible value entries for the OcrEngine key. Name

Possible Values

enable

1 -Enabled. This instructs QuickTest Professional to use the OCR mechanism according to the mode value. (Default)
0 – Disabled. QuickTest Professional will not use the OCR mechanism regardless of the mode value. (Same as setting the mode value to 0 – No OCR.)

maxHforSingleBlockandmaxWforSingleBlock

Indicates the height or width of the text block in pixels, for example, 29. Modify both value entries to instruct the OCR mechanism to treat the object as a single text block.

Note:
Sometimes, text on small objects or in a small text area is not captured (or is captured incorrectly). In cases such as these, specifying the maximum text area size in pixels may help improve text recognition. This causes the OCR mechanism to focus on a specific area and treat it as a single text block (and not as multiple text blocks, as it would normally do).

Tip: You can use QuickTest Professional’s Object Spy to find the height and width of the object.

Default for both = 0 (indicates multiple text block)

mode

0 – No OCR. Instructs QuickTest Professional to use only the Windows API-based mechanism (and not the OCR mechanism) to retrieve text from the object.
1 – Windows API/OCR. Instructs QuickTest Professional to first try to retrieve text directly from the object using the Windows API-based mechanism. If no text can be retrieved, QuickTest Professional tries to retrieve text using the OCR mechanism. (Default) (Highly recommended when working with CJK languages.)
2 – OCR/Windows API. Instructs QuickTest Professional to first try to retrieve text from the object using the OCR mechanism. If no text can be retrieved, then QuickTest Professional uses its Windows API-based mechanism to retrieve text from the object.
3 – OCR only. Instructs QuickTest Professional to use only the OCR mechanism (and not the Windows API-based mechanism) to retrieve text from the object. (Required when working with Windows Vista.)

supportedLanguages

Indicates the language dictionaries that the OCR mechanism uses when retrieving text from the object.
Enter a comma to separate the languages, for example: English, German, Spanish, French

Note:
Combined hieroglyphic languages (CJK – Chinese, Japanese, or Korean) and non-hieroglyphic languages are not supported. For example: English, Japanese

useProfile

Indicates the path of the .ini file containing the customized profile for the OCR mechanism.

Note:
If the OCR mechanism cannot retrieve any text from the object, you can fine tune its settings to help it recognize the objects in the application being tested. You do this by creating an .ini file containing a customized profile with the required property settings which will help overcome issues relating to, font, font size, and contrast. This .ini file must be in ABBYY FineReader format.

Note: Although these text-capturing options and methods are now available for Windows-based objects, keep in mind that any text-recognition mechanism may occasionally capture unwanted text information (such as hidden text and shadowed text), or may misinterpret the text content.

Additionally, text-capturing steps may behave differently in different run sessions depending on the operating system version you are using, the installed Service Packs, other installed toolkits, the APIs used in your application, and so on.

Therefore, when possible, it is highly recommended to check text from your application window by inserting a standard checkpoint, output value, or GetROProperty method for the object containing the desired text to retrieve the value of its text (or similar) property.

For more information, refer to the relevant sections in the QuickTest Professional User’s Guide, and search for the GetText, GetVisibleText, and GetTextLocation methods in the relevant sections of the QuickTest Object Model Reference Help.

Languages other than English be specified for the text recognition mechanism

Modify the supportedLanguages value for the text recognition registry key

Note:
QuickTest Professional 9.2 introduced a new text recognition mechanism. The information provided here applies to QuickTest Professional 9.2 or higher. This solution is not available for earlier versions of QuickTest Professional.

To indicate which language dictionaries QuickTest Professional’s text recognition mechanism should use, update the supported language list in the registry.

1. Open the registry editor.
2. Navigate to HKEY_CURRENT_USER\SOFTWARE\Mercury Interactive\QuickTest Professional\MicTest\OcrEngine. 3. Right-click on the supportedLanguages value, and select “Modify.”
4. Set the value data to the language or languages to be supported. Use a comma to separate the languages.

Example:
English,German,Spanish,French

Note:
Combined hieroglyphic languages (CJK – Chinese, Japanese, or Korean) and non-hieroglyphic languages are not supported. For example: English,Japanese

5. Click .
6. Restart QuickTest Professional.

Text recognition be set for both hieroglyphic and non-hieroglyphic languages simultaneously

Combined hieroglyphic languages and non-hieroglyphic languages are not supported

Note : QuickTest Professional 9.2 introduced a new text recognition mechanism. The information provided here applies to QuickTest Professional 9.2 or higher. This solution is not available for earlier versions of QuickTest Professional.

The text recognition mechanism will allow you to specify the language dictionaries that should be used, however it does not support the combination of hieroglyphic languages and non-hieroglyphic languages.

Example:
English,Japanese

You will need to configure the text recognition mechanism to recognize these languages in different run sessions. QuickTest Professional will need to be shut down, configured, and re-launched in order for the changes to take effect.

Text on small objects or in a small text area is not captured or is captured incorrectly

Sometimes, when QuickTest Professional (QTP) 9.2 attempts to capture text from a small object or in a small text area, it is not captured, or is captured incorrectly.

Modify the maxHforSingleBlock and maxWforSingleBlock values for the text recognition registry key

Note: Solution is not available for earlier versions of QuickTest Professional, only versions 9.2 and above

Specifying the maximum text area size in pixels may help improve text recognition. This causes the OCR mechanism to focus on a specific area and treat it as a single text block (and not as multiple text blocks, as it would normally do).

To specify the maximum text area size for QuickTest Professional’s OCR text recognition, update the OcrEngine registry key.

1. Open the registry editor.
2. Navigate to HKEY_CURRENT_USER\SOFTWARE\Mercury Interactive\QuickTest Professional\MicTest\OcrEngine. 3. Right-click on the maxHforSingleBlock value, and select “Modify.”
4. Set the value data to the desired height of the text block in pixels, for example, 29.

Tip: Is possible to use QuickTest Professional’s Object Spy to find the height and width of the object.

5. Click .
6. Right-click on the maxWforSingleBlock value, and select “Modify.”
7. Set the value data to the desired width of the text block in pixels, for example, 29.

Tip: Use QuickTest Professional’s Object Spy to find the height and width of the object.

8. Click .
9. Restart QuickTest Professional.

Modify both value entries to instruct the OCR mechanism to treat the object as a single text block.

Note: The default for both values is zero (0), which indicates multiple text blocks.

Retrieve the runtime property of an object

Use the GetROProperty method. This method returns the current value of a property for the object in the application.

GetROProperty(Property [, in_PropData])

Property – Property to retrieve from the object.
in_PropData – This parameter is not in use.

Example:
‘ The following example uses the GetROProperty method to retrieve ‘ the title property of a Static object.
title = Browser(“index”).Dialog(“Internet Options”).Static(“You can change”).GetROProperty(“title”)

‘ The following example uses the GetROProperty method to retrieve the ‘ x coordinate of the “Test” window.
x = Window(“Test”).GetROProperty (“x”)