Monday, June 16, 2014

Disabling Smart Identification

Sometimes the "Smart Identification" functionality may become a pain for the automation scripts especially if you have dozens of test scripts. I prefer not to use this functionality because of slow identification and sometimes QTP mis-identifies the objects. For me it is better to get an "Object not found" error instead of waiting for the smart identification to find correctly desired object.
As far as i know there are 2 ways to disable smart identification from the QTP menus.
  1. From the object repository. You can disable it by selecting for desired objects.
  2. From the File -> Settings -> Run menu. You can disable it for all objects.
For a testset that contains dozen of automation scripts disabling smart identification may consume lots of time to configure in either two ways. The third and the best way for me is disabling it by programmatically. All my automation test scripts call a function named "initAutomation" function at the very beginning of the scripts. This function is defined in the shared function library that is also linked with the test scripts. Within this function i am preparing the environment for automation to run. For instance you may change some registiry records (for proxy configuration), prepare test parameters, close opened applications, etc...

Adding following lines into that function disables smart identification for all automation scripts.

Set qtApp = CreateObject("QuickTest.Application")
qtApp.Test.Settings.Run.OnError = "Stop"
qtApp.Test.Settings.Run.DisableSmartIdentification = True
Set qtApp = Nothing

No comments: