Handling exceptions

If an exception occurs during testing, you might be able to handle it by following these instructions. Two common exceptions are the ambiguous recognition exception and the Mutex timeout exception during playback.

Ambiguous recognition exception

Problem

In certain cases during playback, for example, when multiple instances of a browser are running, HCL OneTest UI might be unable to differentiate between two similar objects in the software that is being tested. At such times, an AmbiguousRecognition exception occurs. For example, this problem might occur when multiple instances of a browser are running.

Resolution

  1. Find the duplicate instance of the application, close the instance, and click Retry.
  2. Add a unique property to the object in the test object map to distinguish the ambiguous objects.
  3. Open the test object map from the Script Explorer.
  4. Find the object that the ambiguous exception was thrown for, right-click the object, and highlight it. This action highlights the objects that HCL OneTest UI finds similar.
  5. Identify a unique property among these objects and use the find() API, passing the unique property to find the method, and then do the required operation. For example, to click a button that is named Back, use this approach:
    		TestObject [] backBtn = find(atDescendant(".class", ".PushButton", ".text", "Back"));
    		if( backBtn.length == 1){
    			((GuiTestObject)backBtn[0]).click();
    		}
    		else{
    			//Add code to log message that more than one instance of object is still found
    		}

Mutex timeout exception during playback

Problem

During the playback of functional test scripts, this Mutex timeout exception might occur:com.rational.test.ft.svs.Mutex$TimeoutException .

Resolution

The default SpyHeapSize that is set in HCL OneTest UI is 1048576. Increase this value by adding a DWORD value named SpyHeapSize to the registry and setting its value to 2097152. Complete these steps:
  1. Click Start and then click Run. Type regedit. The Windows Registry Editor opens.
  2. Navigate to the [HKEY_LOCAL_MACHINE\Software\HCL Technologies\HCL OneTest UI registry key.
  3. Create a new DWORD value named SpyHeapSize and set its value data to 2097152 (or 200000 hexadecimal)
You can also add the SpyHeapSize key by creating and then running a .reg file that has these contents:
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\Software\HCL Technologies\HCL OneTest UI]
"SpyHeapSize"=dword:00200000