Creating a variable list to use throughout my scripts - 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: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners) +--- Thread: Creating a variable list to use throughout my scripts (/Thread-Creating-a-variable-list-to-use-throughout-my-scripts) Pages:
1
2
|
Creating a variable list to use throughout my scripts - mv8167 - 02-10-2012 I have been trying a few different way to create and use a list of variables throught my tests and scripts. I must be doing something wrong as the variables disapear as the Library is left. Currently, from my Test script, I call a function as below: Code: Public Function ImageAccessVariableList () RE: Creating a variable list to use throughout my scripts - mv8167 - 02-10-2012 I tried the following, also with no luck. (can i even set my variables from a Function call? Code: Public Function ImageAccessVariableList () RE: Creating a variable list to use throughout my scripts - Rodrigo Carvalho - 02-11-2012 Not sure if i undestand the issue you're facing.. but, if you want to access variables stored externally to the test you can use a librarie (qfl) and declare the variables you need to use as public and associate the lib to the test, example: 'CONSTANTS FILE 'Creation Date: 07/02/2012 'Description: It Contains the path where the data source is located Public Const DATA_SOURCE_PATH = "C:\Automation\DataSource\DataSource.xls" Public Const IMPORT_DATA_SOURCE = True '<<<<<<<<<<<< DATA MIGRATION >>>>>>>>>>>>>>>> Code: Public Const DATA_MIGRATION_FILE_PATH = "C:\Automatizacion\PIB\DataMigration\" RE: Creating a variable list to use throughout my scripts - rajpes - 02-11-2012 Code: '*HAPPY B'DAY LORENA* RE: Creating a variable list to use throughout my scripts - mv8167 - 02-13-2012 Thx guys for your help. I will try both ideas. Where do I place the code? in a function library? Rajpes, thx for the B-Day wish. How did you know.? ;-) RE: Creating a variable list to use throughout my scripts - rajpes - 02-13-2012 somehow i came to know You are creating instance of qtp app, so you cant put that in a function library. RE: Creating a variable list to use throughout my scripts - mv8167 - 02-13-2012 I added the code to a function library, but when i return to the Test script, the values in my txt file disapear. objQTPLibraries.Add (VariableList) -- This code gives me a Run Error of "This operation cannot be preformed durring a run session." RE: Creating a variable list to use throughout my scripts - mv8167 - 02-14-2012 I went to Setup -> Resources sand added my vbs file and, ,Itried: Code: Public Function ImageAccessVariableList () But none of my variables get loaded into my QTP variable list. thoughts? RE: Creating a variable list to use throughout my scripts - mv8167 - 02-28-2012 Rajpes, Sorry, i just learned your meaning of "instance" of QTP. How do I then run this instance of QTP? I was thinking of just adding my variable list to my test via File -> Settings -> Resources -> [+] but from what I understand, I must start QTP using the code provided before the test runs? If so, then it is not possible to load a variable list at the start of a test after QTP has been running? thx for your advise. RE: Creating a variable list to use throughout my scripts - inborntester - 02-28-2012 this should work. what do you meant by QTP variable list? can you share ImageAccessVariableList.vbs file. |