How to organize RegisterUserFunc ?
I am new to QTP.
Could you please explain me, how to organize RegisterUserFunc.
This is the Help example:
Function MySet (obj, x)
y = obj.GetROProperty("value")
Reporter.ReportEvent micDone, "previous value", y
RegisterUserFunc "WebEdit", "Set", "MySet"
Browser("MercuryTours").Page("FindFlights").WebEdi t("Country").Set "Canada"
UnRegisterUserFunc "WebEdit", "Set"
1. Where I store new function MySet ?
2. How to include function into main script?
3. Statement: RegisterUserFunc "WebEdit", "Set", "MySet" works only in runtime or I have to use: UnRegisterUserFunc "WebEdit", "Set" to undo previous statement?
Re: How to organize RegisterUserFunc ?
You can store the function either in the main script or in a library file (.vbs or .txt) that is attached to your test. Libraries can be attached in the resources tab under Test->Settings.
Once you register a function to an object then it remains a method of that object until you unregister it.