light example - Printable Version +- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums) +-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP) +--- Forum: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming) +--- Thread: light example (/Thread-light-example) |
light example - Amit Singh Chauhan - 06-04-2008 [b]Hi I have written the below shown code in seprate function library file so that I can remove the use of Object repository. '################################## '#Dialog '################################## Code: Public Sub DPDialog(strlnDialogName,strnProp) '#################################### '# WinEdit '#################################### Code: Public sub DBWinEdit(strenWinEdit,strlnValue,strnProp) '###################################### '# WinButton '###################################### Code: Public Sub DPWinButton(strWInButton,strnProp) '############################################## Now I have written the below code to use the above functions and taking the object's name and its property from Excel sheet. Code: Call OpenExcel(sFileName, vSheet) 'Open Data File ############################################## When I remove Object Repository refrence the code doesnot work. Can Anyone tell what is wrong in above code. RE: light example - somisays - 06-05-2008 Hi, Have you associated this function library with the test where you are call these functions ? Regards Sridhar RE: light example - Anshoo Arora - 06-05-2008 You are using one object reference in your script and using that object reference to point to the object under test. It should be like this: Code: Public Sub DPDialog(strlnDialogName,strnProp) For WinEdit and WinButton: You have not defined what 'obj_Dialog' is. The description for Dialog is pointing to an illegal description. Remember that you are not transferring the description of the Dialog Box to these two Subs. This is one way it can be done: Code: Public sub DPWinEdit(strenWinEdit,strlnDialogName,strlnValue,strnProp) RE: light example - Amit Singh Chauhan - 06-05-2008 Yes I have associated this function library with the test. The second piece of code is in my test. Scenerio is like this: I have an Excel sheet in which I provide following columns TestPurpose Object ObjectName Property Value Login Dialog Login Click WinEdit Agent Name: Set ABCD WinEdit Password: Set mercury WinButton OK Click Verification Window Flight Reservation Exist Now I have made a Function Library in which I have written the code as DPWindow,DPDialog,DPWinEdit,DPWinButton. And in my test after retrieving values from excel sheet row by row I am calling the above functions. Code for these two conditions I have pasted earlier. I want to make my function library generic so that My excel sheet format remains same as above for each test case and Object Repository is not needed in it. RE: light example - Anshoo Arora - 06-05-2008 Amit, I think you have the correct concept, but you would need to correct your DP subroutines for them to be able to utilize the values retrieved from Excel. Please see my previous post for the same. I would also suggest you read more about Descriptive Programming. Dani of AdvancedQTP.com has written a book (Scripting QTP) which you can download for free and is a very good source of understanding different ways of working with QTP Scripting. |