Friday, December 20, 2013

How to release the test objects after they have been used in your QTP Script?

Solution
‘***********************************************************************************************************************************************************************‘
Copy this code to QTP window – From here to
‘***********************************************************************************************************************************************************************'Object description file where all objects are defined -
 These objects will be created in the memory only when you initialize them -
CommentExecuteFile "Give objects repository file" 

 'Object initialization'
setObj_wnd_Loing is a user defined function which creates a instance of your Window object and returns the object- Comment
setObj_wnd_Login wnd_Login
'setObj_txt_UserName is a user defined function which creates a instance of your UserName object and returns the object- Comment
setObj_txt_UserName txt_UserName
'setObj_txt_Password is a user defined function which creates a instance of your Password object and returns the object - Comment

 'From this point:
 It will be your application regular code
Example:
Sapwindow(wnd_Login).SAPEdit(txt_UserName).Set "admin"
SAPWindow(wnd_Login).SAPEdit(txt_Password).Set "*******"

‘Un-initialization of Objects'
Once you are done with the objects just release them from the memory'
 set wnd_Login = nothing
'set xt_UserName = nothing
'set txt_Password = nothing.


'You don’t have to touch the existing code, except initializing the required objects before starting the scenario/feature and once you are done with the object release them from memory.

No comments:

Post a Comment