Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
For Loop Execution
#1
Solved: 10 Years, 8 Months, 4 Weeks ago
Hi,

I created external Data Table and placed 2 records in the Excel Sheet.

I inserted a For Loop in my function and called those parameters. But while execution, QTP is running more than 2 times. My external data sheet is having only 2 records.

Why QTP is running more than twice??
Below is my sample function:

Quote:Public Function Sample()

Datatable.AddSheet "Test_Data"
Datatable.ImportSheet "C:\QTP\Test_Data.xls", "Test_Data", "Test_Data"
Rc = Datatable.GetSheet("Test_Data").GetRowCount

For i = 1 to Rc

DataTable.GetSheet ("Test_Data").SetCurrentRow(i)
Browser("XXX").Page("YYY").WebElement("ZZZ").SetToProperty "innertext", DataTable ("ABC", "Test_Data")
Browser("XXX").Page("YYY").WebElement("ZZZ").Click

Browser("XXX").Page("YYY").WebElement("ZZZ").WebButton("XYZ").Click
St = Timer
Browser("XXX").Page("YYY").WebElement("Loading...").WaitProperty "Visible", "False" //Is this statement correct?
Reporter.ReportEvent micDone, "Loading", "Loading completed"
Et = Timer
Rt = Et - St
Reporter.ReportEvent micPass,"Report Time", "Report is generated in: " & Rt & " Seconds."
DataTable("Report_Time", "Test_Data") = Rt

Next

DataTable.ExportSheet "C:\QTP\Test_Data.xls", "Test_Data"

End Function

Please help??

Thanks,
Ravi.
Reply
#2
Solved: 10 Years, 8 Months, 4 Weeks ago
Hi Ravi,
Check your Test Settings. In the Run tab, select "Run one iteration only".
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  FOR LOOP shayk1985 1 5,118 12-13-2012, 11:35 AM
Last Post: sams001
  How to exit from a for loop silpavinod 2 9,365 10-17-2012, 12:55 AM
Last Post: agarwl.anurag
  for loop sia sharma 1 3,192 09-13-2012, 11:44 AM
Last Post: ksrikanth2k9
  Help with Loop LJENNE 1 3,050 08-10-2012, 12:32 PM
Last Post: Ankesh
  How to get out of infinite FOR loop... sssidana 3 4,374 07-20-2012, 01:04 AM
Last Post: sree.85

Forum Jump:


Users browsing this thread: 1 Guest(s)