Registeruserfunc


Register user function to TestObject

TestObjects are the objects in the Repository and these Objects are used in the Test ( Script),,, see any object in the repository are under TestObject Structure

Learn the step by step procedure how to Register user created function to any test object and when writing the Script our Created function is also displayed in the Intellisence

1. Open Notepad
2. Write the Required Function
3. Write statement to Register the userfunction to the required testobject
4. Save the file as Filename.vbs
=========================
For the above 4 steps in notepad  (sample function fn_sample is Defined and registered as below)

In Notepad
      public Function fn_sample
              msgbox "Hello"
      End Function

       Registeruserfunc "WinButton","myfunc","fn_sample"

 Save it as function libary  ( filename.vbs)

In the above code fn_sample is registered for WinButton and in the script in Intellisence  "myfunc" is displayed
===========================

5. After saving the file,,, associate the library to the QTP Test
    File menu---Settings---Resource----Associate function library (and select the above created library and associate)

6. In the Test ( add any WinButton from application into Repository)
 for example Add  (OK,Cancel buttons in Flight application "Login" dialogbox)

7. Write script
           Dialog("Login").winButton("OK").myfunc
           Dialog("Login").WinButton("Cancel").myfunc

Comments