user defined functions are functions that you create yourself using the:
Function somefunctionname(arg1, arg2)
syntax. They can be held in an external .txt or .vbs file or they can be added to our script. I tend to keep all functions in external files that way I can use them across all tests.
Smart identification is another way that QTP can identify an object if there is more than one on view, eg web pages, where it can use Creation time to distinguish them apart. It can be set up from Tools -> Object Identification. Make sure the "Enable Smart Identification" tick box is checked, and then click Configure.
I hope this helps,
I'm not a complete idiot - some parts are missing.
Andy thank you so much
but could you elaborate more in how to call a function saved externally, where should it be saved? what is the extension of the file?
I never used functions but I think it is handy to have your own library so you don't have to re-write code every time.
"I realize it's an error, but no one is going to try to do that!"
From "Top 10 Stupid Comments from Developers".
You can store the user defined functions, either in your QTP test script itself or you can create a VBS file and add that VBS to the Script's Resource list.
In the first method, you just add the following statement to your script in the expert view.
your function definition goes here.
Here, the function will be available only to the "Action" in which it was created.
In the second method, create a file with the extension .VBS and store your function in that file. Then from the QTP choose, Test >Settings menu. In the "Test Settings" dialog, select "Resources" tab. Add your VBS file to the "Associated Library Files" list. Now you will be able to call the function from any of the Action within the script.