Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Calling an action in the same script in QTP
#1
Solved: 11 Years, 3 Months, 2 Weeks ago Exclamation 
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
Reply
#2
Solved: 11 Years, 3 Months, 2 Weeks ago
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"
RunAction "Action1","One Iteration"
RunAction "Action3","One Iteration"

Then Insert the "Action1" as Copy of an action then script appears like
Code:
RunAction "Action2","One Iteration"
RunAction "Action1","One Iteration"
RunAction "Action3","One Iteration"
RunAction "Copy of Action1","One Iteration"
Then Insert the "Action2" as Copy of an action then script appears like
Code:
RunAction "Action2","One Iteration"
RunAction "Action1","One Iteration"
RunAction "Action3","One Iteration"
RunAction "Copy of Action1","One Iteration"
RunAction "Copy of Action2","One Iteration"
Please let me know for further clarification.

Thanks and Regards,

Venkat.Batchu.
Reply
#3
Solved: 11 Years, 3 Months, 2 Weeks ago
Hi Venkat,

Are you sure that your above given solution would address the galstar issue?
Reply
#4
Solved: 11 Years, 3 Months, 2 Weeks ago
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
Reply
#5
Solved: 11 Years, 3 Months, 2 Weeks ago
Thanks for the reply....

Sir,no need to say sorrySmile

But i think exit action will exit from that particular action not from others proceeding actions...
Reply
#6
Solved: 11 Years, 3 Months, 2 Weeks ago
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
Reply
#7
Solved: 11 Years, 3 Months, 2 Weeks ago Exclamation 
Hi,

I think you are not getting my point or may b i m not getting yours....Sad

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...
Reply
#8
Solved: 11 Years, 3 Months, 2 Weeks ago
Hi Galstar,

Creating & Accessing Environment Variable programmatically would solve your problem Smile

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"
  
      Msgbox "This is Action1 code"
      RunAction "Action2",OneIteration
      RunAction "Action3", oneIteration

  Environment.Value("Execute")="No"
Action2 Code:

Code:
If Environment.Value("Execute")="No" then
       ExitAction
    End if

    Msgbox "This is Action2 code"

Action3 Code:

Code:
If Environment.Value("Execute")="No" then
       ExitAction
    End if
    
    Msgbox "This is Action3 code"
Reply
#9
Solved: 11 Years, 3 Months, 2 Weeks ago
Hi,

Yeah, it is working....
from this i got an idea and use ExitTest in the main actionSad

Thank u so much to both of you......
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Calling a function in a Test Script from a function library anupam4j 3 6,098 06-26-2015, 12:31 AM
Last Post: babu123
  Calling a HP Service Test Skript Gandalf2005 0 2,098 09-05-2012, 07:53 PM
Last Post: Gandalf2005
  how to access Local dataTables in another action within a same script RA185112 5 6,017 07-25-2012, 01:27 PM
Last Post: sshukla12
  Calling of function hamzaz 5 4,557 07-25-2012, 12:44 PM
Last Post: Shridevi.Salagare
  Function Calling after executing some steps TaranVohra 2 2,942 06-05-2012, 10:06 AM
Last Post: TaranVohra

Forum Jump:


Users browsing this thread: 1 Guest(s)