Calling an action in the same script in QTP - 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: Calling an action in the same script in QTP (/Thread-Calling-an-action-in-the-same-script-in-QTP) |
Calling an action in the same script in QTP - galstar - 08-19-2010 Hi, I am facing an issue while calling an action in it's own script...Please find below the Scenario..... A script is broken into three actions..Login ,standard checkout,Express checkout. I made an action Ordercreation and call all these 3 Action in this ordercreation action.. Now all 3 actions(Login ,standard checkout,Express checkout) become reusable.. Now while running the script ,firstly,Ordercreation Action runs,i want to stop running here.but still it again run Login and so on..as these action are belowto ordercreation too...so they start again running... Please tell me the solution.. Thanks RE: Calling an action in the same script in QTP - venkatbatchu - 08-19-2010 Hi Galstar, You could set the navigation of flow of an actions in KeyWord View Lets consider this as the example 1) You have 3 actions Action1,Action2,Action3 But you want to run the Action2,Action1,Action3 i.e in the order of 2,1,3 So please drag the actions and drop in this manner like first keep the Action2 as the first one and Action1 and Action3 as the last action. Incase if you want to execute the actions in the order liek 2,1,3,1,2 2) Proceed with the above step mentioned then go to Expert View then script appears like Code: RunAction "Action2","One Iteration" Then Insert the "Action1" as Copy of an action then script appears like Code: RunAction "Action2","One Iteration" Code: RunAction "Action2","One Iteration" Thanks and Regards, Venkat.Batchu. RE: Calling an action in the same script in QTP - sreekanth chilam - 08-20-2010 Hi Venkat, Are you sure that your above given solution would address the galstar issue? RE: Calling an action in the same script in QTP - venkatbatchu - 08-23-2010 Hi, Sorry to mislead you, the solution which i posted is not for this issue that was for another issue some guy posted in another forum mistakenly i copied here. Once again sorry for misleading. Regrding your query: You have created "Order Creation" action and called three actions in this action i.e "Order Creation" So obviously it will start executing this action and reusuable actions associated to this action (three actions).If you dont want to execute these actions 1. Either you would have not calledthese reusable actions here incase if you require thse actions need to be run on the logic base then put some logic and wherever you dont require put "Exit Action" before these three reusable action. so that it will not execute once the logic meets the particular requirement. Sorry once again...... Thanks and Regards, Venkat.Batchu Regards, Venkat.Batchu RE: Calling an action in the same script in QTP - galstar - 08-25-2010 Thanks for the reply.... Sir,no need to say sorry But i think exit action will exit from that particular action not from others proceeding actions... RE: Calling an action in the same script in QTP - venkatbatchu - 08-26-2010 Hi Galstar, You have called 3 actions in to "Order Creation action" so three actions becomes associated to this main action when you put "Exit Action" no matter how many actions called into this main action so with this stament it will not execute any called actions. Please let me know for further clarification. Regards, Venkat.Batchu RE: Calling an action in the same script in QTP - galstar - 08-26-2010 Hi, I think you are not getting my point or may b i m not getting yours.... look..I have 3 actions in a script....Action 1, Action 2,Action3..in the same order as mentioned.... Now i want to call Action 2,action 3 in action 1... Now while executing the script ..firstly action 1 execute which contain action 2,action 3..so they are also executing with action 1... Now after action 1..Action 2, action 3 again start executing as they are ordered after action 1..whish i donn want.. i donn want to execute them again....please help me to sort it out..thanks... RE: Calling an action in the same script in QTP - sreekanth chilam - 08-26-2010 Hi Galstar, Creating & Accessing Environment Variable programmatically would solve your problem Refer the below example for more info. For example, there is Test by name "MyTest" which contain 3 Actions i.e Action1,Action2,Action3. Here I am calling Action2,Action3 in Action1 and once Action1 is executed Action2,Action3 will not get executed again. Action1 Code: Code: Environment.Value("Execute")="Yes" Code: If Environment.Value("Execute")="No" then Action3 Code: Code: If Environment.Value("Execute")="No" then RE: Calling an action in the same script in QTP - galstar - 08-28-2010 Hi, Yeah, it is working.... from this i got an idea and use ExitTest in the main action Thank u so much to both of you...... |