UNRegisterUserFunc Statement in QTP

Unregisteruser func in QTP : Instructs QuickTests to stop using the current registration of the method. If the unregistered method is a defined QuickTest method for the object, the functionality of the method returns to the standard QuickTest functionality.

Note: If you register a function within a reusable action, it is recommended that you unregister the method at the end of the action.

For more information on unregistering user-defined functions, see the HP QuickTest Professional User Guide.

Syntax

UnRegisterUserFunc TOClass, MethodName



Argument

Type

Description

TOClass

String

The test object class for which you want to unregister the method.

MethodName

String

The method you want to unregister.

Example

Suppose that the FindFlights Web page contained a Country edit box, and by default, the box contained the value USA. The following example registers the Set method to use the MySet function in order to report the default value of the edit box to the test results before the new value is entered. The UnRegisterUserFunc method is then used to return the Set functionality to the standard QuickTest functionality.

Function MySet (obj, x)

dim y

y = obj.GetROProperty("value")

Reporter.ReportEvent micDone, "previous value", y

MySet=obj.Set(x)

End Function

RegisterUserFunc "WebEdit", "Set", "MySet"

Browser("MercuryTours").Page("FindFlights").WebEdit("Country").Set "Canada"

UnRegisterUserFunc "WebEdit", "Set"

Post a Comment

Previous Post Next Post