Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Read next datatable rather than login again
#1
Solved: 10 Years, 9 Months ago
QTP10
IE8
XP

I apoligize for opening a new thread, as I'm just trying to get this datatable understood. I've created, what I hope will be an easier method to explain:

Now here we loginto the flight reservations system and select a rate. We seem to be bound to perform an next step from here. We can use a datatable with multiple signins & passwords.

Code:
ystemUtil.Run "D:\Program Files\HP\QuickTest Professional\samples\flight\app\flight4a.exe","","D:\Program Files\HP\QuickTest Professional\samples\flight\app\","open"
Dialog("Login").WinEdit("Agent Name:").Set "cocojava"
Dialog("Login").WinEdit("Password:").Set "mercury"
Dialog("Login").WinButton("OK").Click
Window("Flight Reservation").WinObject("Date of Flight:").Type "111110"
Window("Flight Reservation").WinComboBox("Fly From:").Select "Frankfurt"
Window("Flight Reservation").WinComboBox("Fly To:").Select "London"
Window("Flight Reservation").WinButton("FLIGHT").Click
Window("Flight Reservation").Dialog("Flights Table").WinList("From").Select "11121   FRA   03:48 PM   LON   04:31 PM   AA     $111.00"
Window("Flight Reservation").Dialog("Flights Table").WinButton("OK").Click

What I need to be able to do is signin ONCE. Use an App (like to ck the status of a flight, and then another and another (which would be like in a datatable; but I don't want to logout each time.

I've tried to split this action into two, one for login and one for performing the flight; but as it goes through the datatable it wants to log back in. As I said, that was under the action that I split.

This is getting very discouraging.
Overall-once user logs in I want to stay in the App.
Reply
#2
Solved: 10 Years, 9 Months ago
you are on correct way, use two seperate reusables for login and Flight operations, assemble/call them in a test, do not put anything on datatable for the test, all the data should be in corresponding reusable datatable and that way you can iterate your required reusable.

Reply
#3
Solved: 10 Years, 9 Months ago
First, let me say 'Thank you Saket', for responding as this has been most discouraging as I know WHAT I want it to do; but I'm too new to Make it happen.

I understand your statement up to a point 'you are on correct way, use two seperate reusables for login and Flight operations, assemble/call them in a test'

If I don't put the data to a datatable-Where does it go?
I also don't understand the ' iterate your required reusable'

Is it possible there may be an example somewhere of what your speaking?

Again, Thanks for helping me figure out this App. I've come to rely on this forum more than you know.
Reply
#4
Solved: 10 Years, 9 Months ago
Hi,

You can use the below code,

1. Set the test settings as "Run One Iteration Only"
Goto - > Test Settings ->RUN--> Select "Run One Iteration Only"

2. Add Parameters Names(Column names) as given in the code in Global DataTable

3. Add required data in the respective cells in the Global DataTable

Here is the code,

Code:
SystemUtil.Run "D:\Program Files\HP\QuickTest Professional\samples\flight\app\flight4a.exe","","D:\Program Files\HP\QuickTest Professional\samples\flight\app\","open"

For i = 1 to DataTable.GetSheet("dtGlobalSheet").GetRowCount ' gets the number of used rows in Global sheet
Dialog("Login").WinEdit("Agent Name:").Set DataTable.Value("Username","dtGlobalSheet")
Dialog("Login").WinEdit("Password:").Set DataTable.Value("Password","dtGlobalSheet")
Dialog("Login").WinButton("OK").Click
Window("Flight Reservation").WinObject("Date of Flight:").Type "111110"
Window("Flight Reservation").WinComboBox("Fly From:").Select DataTable.Value("FlyFrom","dtGlobalSheet")
Window("Flight Reservation").WinComboBox("Fly To:").Select DataTable.Value("FlyTo","dtGlobalSheet")
Window("Flight Reservation").WinButton("FLIGHT").Click
Window("Flight Reservation").Dialog("Flights Table").WinList("From").Select "11121 FRA 03:48 PM LON 04:31 PM AA $111.00"
Window("Flight Reservation").Dialog("Flights Table").WinButton("OK").Click
Next

Thanks
Vinod
Hi...

Small correction in the code.. please use the below code,

Code:
SystemUtil.Run "D:\Program Files\HP\QuickTest Professional\samples\flight\app\flight4a.exe","","D:\Program Files\HP\QuickTest Professional\samples\flight\app\","open"

For i = 1 to DataTable.GetSheet("dtGlobalSheet").GetRowCount ' gets the number of used rows in Global sheet
DataTable.SetCurrentRow(i) ' sets the position of the row number to get the data from datatable
Dialog("Login").WinEdit("Agent Name:").Set DataTable.Value("Username","dtGlobalSheet")
Dialog("Login").WinEdit("Password:").Set DataTable.Value("Password","dtGlobalSheet")
Dialog("Login").WinButton("OK").Click
Window("Flight Reservation").WinObject("Date of Flight:").Type "111110"
Window("Flight Reservation").WinComboBox("Fly From:").Select DataTable.Value("FlyFrom","dtGlobalSheet")
Window("Flight Reservation").WinComboBox("Fly To:").Select DataTable.Value("FlyTo","dtGlobalSheet")
Window("Flight Reservation").WinButton("FLIGHT").Click
Window("Flight Reservation").Dialog("Flights Table").WinList("From").Select "11121 FRA 03:48 PM LON 04:31 PM AA $111.00"
Window("Flight Reservation").Dialog("Flights Table").WinButton("OK").Click
Next
Reply
#5
Solved: 10 Years, 9 Months ago
Hi KVK/cocojava,

Go through the Posting guidelines once.

Wrapup the code using "insert Fomatted Code" feature while posting.
Reply
#6
Solved: 10 Years, 9 Months ago
Hi Cocojava,
if I am getting it clearly, you want to login once and do the flight operation multiple times. let me know if I am incorrect.
for this you will need to create two reusable, one for login and one for flight operation, put the login code into the login reusable, you can pass the username and password either using data table or action parameter, then the flight operation part could be in another reusable and pass you data in the datatable, could be on multiple rows depending on your requirement. then you just need to iterate through all the rows of your this reusable only. coz if you iterate for a single reusable consisting both login and operation together, everytime QTP will login and do the same operations and corresponding login data will be required. same goes if you put data in your global sheet.
your login reusable could be something like
Code:
SystemUtil.Run "C:\Program Files\HP\QuickTest Professional\samples\flight\app\flight4a.exe","","C:\Program Files\HP\QuickTest Professional\samples\flight\app\","open"
Dialog("Login").WinEdit("Agent Name:").Set Parameter("user")
Dialog("Login").WinEdit("Agent Name:").Type  micTab
Dialog("Login").WinEdit("Password:").Set Parameter("pwd")
Dialog("Login").WinEdit("Password:").Type  micReturn

flightoperation
Code:
f Window("Flight Reservation").Exist  Then

    Window("Flight Reservation").Activate
    Window("Flight Reservation").WinButton("Button").Click
    Window("Flight Reservation").ActiveX("MaskEdBox").Type DataTable("FlightDate", dtLocalSheet)
    Window("Flight Reservation").WinComboBox("Fly From:").Select DataTable("From", dtLocalSheet)
    Window("Flight Reservation").WinComboBox("Fly To:").Select DataTable("To", dtLocalSheet)
    Window("Flight Reservation").WinButton("FLIGHT").Click
Window("Flight Reservation").Dialog("Flights Table").WinList("From").Select 1
    Window("Flight Reservation").Dialog("Flights Table").WinButton("OK").Click
    Window("Flight Reservation").WinEdit("Name:").Set DataTable("Name", dtLocalSheet)
    Window("Flight Reservation").WinButton("Insert Order").Click
End If
with the data in datatable something like
Code:
date   from   to name
102810    London    Los Angeles    x
102910    Denver    London    y
103010    Paris    Portland    z
your test will be look like somewhat as below
Code:
RunAction "Login [Login]", oneIteration, "name", "mercury"
RunAction "FlighOPeration [FlightOperation]", allIterations
note that nothing to put in global datasheet in this case
hope this will help you, let me know if you any difficulties.

Reply
#7
Solved: 10 Years, 9 Months ago
Saket, Thank you so very much! Your right on target for what I'm trying to do- it makes sense now. Big Grin
Reply
#8
Solved: 10 Years, 9 Months ago
Saket, you Rock!! (good thing). This was a real headache for a rookie muddleing through. THANK YOU!
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Want to read the data from excel and set read value in the JavaTable rajeevk7 0 2,167 07-10-2017, 04:20 PM
Last Post: rajeevk7
Exclamation Login & logout in Siebel and clicking pop-up button yuetling926 7 10,698 07-09-2014, 10:43 PM
Last Post: hhamilton
  Unable to Click on Login Button Paurav 1 3,158 07-03-2014, 05:27 AM
Last Post: supputuri
  for help.Run a test to login,and then it didn't jump to another page maosilu 0 2,586 11-01-2013, 01:27 PM
Last Post: maosilu
  Datatable add and datatable import sheet wheelercha 4 33,352 06-14-2012, 04:53 PM
Last Post: Arul

Forum Jump:


Users browsing this thread: 2 Guest(s)