Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Data Driven Concept
#1
Hi All,

I am learning QTP through various references. I have created a script which will creates an excel sheet, store username and password. Later same sheet is used to login to "Flight GUI". I am able to go through 1 row or valid scenario. However, I am not able to proceed further with rest of the username and password combination.

Below is code for your reference:

Code:
Objopen.Application.Quit Set Objopen=nothing Set objExcel=CreateObject("Excel.Application") Set objWB=objExcel.Workbooks.Open("C:\Logindetails.xlsx") Set objWS=objExcel.ActiveWorkbook.Worksheets("Sheet1") objExcel.Visible=true ***************** I believe I am going wrong some where from here ***************** vRows=objWS.usedrange.rows.count Datatable.SetCurrentRow(1) rowcount=Datatable.GetSheet("Sheet 1").GetRowCount For i = 1 To rowcount SystemUtil.Run "C:\Program Files\HP\Unified Functional Testing\samples\flight\app\flight4a.exe" dialog("Login").WinEdit("Agent Name:").Set rowcount dialog("Login").WinEdit("Password:").Set rowcount dialog("Login").WinButton("OK").Click If window("Flight Reservation").Exist(5) Then msgbox "Test Passed" window("Flight Reservation").Close Else msgbox "Test Failed" End If Next objExcel.Application.Quit Set objWB=nothing Set objWS=nothing

Please advise?
Reply
#2
Hi All,

I was able to resolve the issue. Below is the implementation.

Code:
[i]From external location I brought the data to Action1 local datatable.[/i] Datatable.ImportSheet "C:\mercury1.xlsx","Sheet1","Action1" [i]I took the Count of Action1 datatable using[/i] numRows=Datatable.GetSheet("Action1").GetRowCount [i]I used for loop, so that I can execute the test case based on the RowCount[/i] For i = 1 To numRows DataTable.GetSheet("Action1").SetCurrentRow i [b]var_U=DataTable.GetSheet("Action1").GetParameter("Username").Value var_P=DataTable.GetSheet("Action1").GetParameter("Password").Value[/b] SystemUtil.Run "C:\Program Files\HP\Unified Functional Testing\samples\flight\app\flight4a.exe" dialog("Login").WinEdit("Agent Name:").Set var_U dialog("Login").WinEdit("Password:").Set var_P dialog("Login").WinButton("OK").Click If window("Flight Reservation").Exist(5) Then window("Flight Reservation").Close msgbox"1st User logged in" elseif dialog("Login").Dialog("Flight Reservations").Static("Err1").GetROProperty("Text")="Please enter agent name" Then dialog("Login").Dialog("Flight Reservations").WinButton("OK").Click 'dialog("Login").Dialog("Flight Reservations").Close dialog("Login").Close msgbox "User unable to login due to blank username field" else dialog("Login").Dialog("Flight Reservations").WinButton("OK").Click dialog("Login").Dialog("Flight Reservations").Close msgbox"SOmething BIG is WRONG" End If Next Set var_U=nothing Set var_P=nothing

script marked in italic and bold played very crucial role to come over the roadblock.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Need an Excel Driven web Program - Ready to Pay as well mayajain 0 2,138 04-22-2015, 05:21 PM
Last Post: mayajain
  Branching in Keyword driven... vIns 2 3,683 12-23-2011, 06:56 AM
Last Post: vIns
  "Keyword-Driven framework" suresz449 0 3,277 08-26-2011, 11:00 AM
Last Post: suresz449
  key word driven testing goka 0 3,421 02-18-2011, 01:36 AM
Last Post: goka
  keyword driven methodology sim 1 3,799 01-10-2011, 10:41 AM
Last Post: Saket

Forum Jump:


Users browsing this thread: 1 Guest(s)