Micro Focus QTP (UFT) Forums
How to call 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: How to call Action (/Thread-How-to-call-Action)



How to call Action - sudhirzpatil - 02-09-2009

Hi Friends,
I have created two action.
1 Login
2 Insert Flight order.
In first action I an parameterizing Login
In second action i am parameterizing Fly From dates.
But before going for second login, it should run all Fly from dates.

For this i am inserting below line after last line of second action.
RunAction Insert Flight order, AllIteration
but insted of getting different dates from datatable,it is accepting first date and the the code is executing continusly.

My aim is i want to first login with any user, insert the order for different Fly dates and run this whole test for different login user.

Hope you guys help me

Thnks in advance


RE: How to call Action - sreekanth chilam - 02-09-2009

Hi ,

Find the following way :

Step 1 :
Create 3 Actions
1)Login ---> 3 rows of data in global sheet of datatable(3 userNames & pwds)
2)Insert_FlightOrder --> 3 rows of data in Localsheet of Datatable ( 3 different filght dates )
3)Exit

Step2 :
Go to Keyword View -> Select "Insert_FlightOrder" Action --> Right Click "Action Call Properties" --> Choose "Run on All rows"

Step3 :
Now execute the script & see .... it will work as expected Smile

_________________________________________________________________________________________________________
FYI...Find the entire code for your requirement given below :

Code for "Login" Action :

Code:
invokeapplication  "D:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app\flight4a.exe"
dialog("Login").WinEdit("Agent Name:").Set DataTable("Uname", dtGlobalSheet)
dialog("Login").WinEdit("Password:").Set DataTable("Pwd", dtGlobalSheet)
dialog("Login").WinButton("OK").Click

Code for "Insert_FlightOrder" Action :

Code:
Window("Flight Reservation").WinMenu("Menu").Select "File;New Order"
Window("Flight Reservation").WinObject("Date of Flight:").Type DataTable("Fight_Date", dtLocalSheet)
Window("Flight Reservation").WinComboBox("Fly From:").Select "Frankfurt"
Window("Flight Reservation").WinComboBox("Fly To:").Select "Los Angeles"
Window("Flight Reservation").WinButton("FLIGHT").Click
Window("Flight Reservation").Dialog("Flights Table").WinList("From").Select 0
Window("Flight Reservation").Dialog("Flights Table").WinButton("OK").Click
Window("Flight Reservation").WinEdit("Name:").Set "sree"
Window("Flight Reservation").WinRadioButton("First").Set
Window("Flight Reservation").WinEdit("Tickets:").Set "2"
Window("Flight Reservation").WinButton("Insert Order").Click
wait(5)

Code for "Exit" Action :

Code:
Window("Flight Reservation").WinMenu("Menu").Select "File;Exit"



RE: How to call Action - sudhirzpatil - 02-10-2009

Hi sreekanth ,

thanks a lot . Finally i done it.
But just a one point i have to add for step 2

I am not able to Right Click "Action Call Properties" from keyword view as you told.
As i am using QTP 9.5
I found the path as

Go To the Test Flow >> select the Action >> Right click "Action Call Properties".>> Choose "Run on All rows"


thanks a lot again.


RE: How to call Action - Forrest Gump - 08-25-2011

Hi This really worked and was explained really well. I would like to know if in Action2, the data varies dynamically i.e., for every login from Action1, if data in Action 2 varies for each login users; how to do that. I mean in Point2 of step1.

Step 1 :
Create 3 Actions
1)Login ---> 3 rows of data in global sheet of datatable(3 userNames & pwds)
2)Insert_FlightOrder --> 3 rows (Data varies dynamically i.e., different login has different number of rows) of data in Localsheet of Datatable ( 3 different filght dates )
3)Exit


RE: How to call Action - ashita - 08-26-2011

Hi Everyone,

Can you please explain me how can I create new action?

Thanks
Ashita


RE: How to call Action - Forrest Gump - 08-27-2011

Hi Ashita,

To create new action: Goto "Insert" Menu and then click on "Call to New Action" i.e., Menu: Insert--> Call to New Action

Regards,
- Forest Gump