Issue related to reusable Action - 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: Issue related to reusable Action (/Thread-Issue-related-to-reusable-Action) |
Issue related to reusable Action - galstar - 08-10-2010 Hi I have created 3 scripts in QTP.one is for login. Now i want to use this login script to other two scripts let's say Script1,Script2..So i made the login as reusable and called it to other scripts..Now fight is that,with login its localsheet is also fetched..But i want to use different user name to get login to these two different script. Let's say Login script contain username as galstar@gmail.com. Script 1 need login through galstar1@gmail.com and Script 2 need login through galstar2@gmail.com.. How should i proceed for this...Please help me to do it.. Thank you.... RE: Issue related to reusable Action - QTPLearn - 08-10-2010 Hi Well Call By Action will not work here.Instead of that create a generic function for Login to the Application. Ex: Code: Function Login(txtUserName,txtPassword) ~Regards RE: Issue related to reusable Action - galstar - 08-10-2010 Thanks for reply.. I did the same.. I have created a global function Code: login(byval username,byval passwd) for that i read the value of username and passwd from datasheet. and call the function.. i called as login(username,password)... i copied all the login scripts to function..and set username and password as arguments.. but still login is not working.. May b i am doing wrong approach...would you plz help me to resolve it... Thank u so much.... Thanks RE: Issue related to reusable Action - Arun Prakash - 08-11-2010 To make it more generic try to use an external excel. In the run time import that sheet to datatable and take the values. I hope this will solve your problem. RE: Issue related to reusable Action - QTPLearn - 08-11-2010 Create a FunctionFile and load it. After that call the function in every script and use the DataSheet. Incase if you have created seperate scripts then you can use Global dataSheet. Ex: Code: Login(DataTable["UserName",dtGlobalSheet],DataTable["Password",dtGlobalSheet)] Incase if you have created seperate Actions in one script then you can use Action Specific dataSheet. Code: Login(DataTable["UserName","Action1"],DataTable["Password","Action1")] Hope this will help you! RE: Issue related to reusable Action - galstar - 08-11-2010 Hi, Thanks dear for such a clear solution... I am using global datasheet for username and password as i have mentioned in my previous reply....But the call of function shows no effect in the script as my website is not getting logging in.... can you plz tell me why is this happening?? Thanks O thanks...now it's working..but still one issue now ,plz solve it too... As for login i did record and play..for everyscript i am doing same..now what i did is that i copied the script of login in notepad and saved as .vbs..:-p Now while calling this login script it works in the same script from where i copied but not in other scripts..as functions containing the objects which are not in the repository of other scripts..... Donn know what to do... please help me out... Thanks RE: Issue related to reusable Action - QTPLearn - 08-11-2010 Do one thing first create Object Reporsitory. Either Global or Local Object repository. As the Login screen is same then Global Object repository will work for you. So before executing the script upload Object Repository and Function File and run the script. Hope this will help you. Incase if it is not clear then please provide me your code and resource file. ~Regards RE: Issue related to reusable Action - galstar - 08-16-2010 Hi, can you please help me in creating local object repository.May be i know it.But still i think i donn have any idea to create it seperatly and then use it in my scripts... How to maintain relation in login function and object repository..? Thanks |