TESTEVERYTHING

Showing posts with label Sorting. Show all posts
Showing posts with label Sorting. Show all posts

Wednesday, 22 June 2011

Validation of Sorting in WEBTABLE / QTP

Hi All,
Some time in application we have to verify the sorting functionality.In Web table for each column we need to click and check is it working fine or not. Here i am giving an example of sorting the date column. but it will verify in ascending order.

logic for this:
  1. Click on Date column which sort the date in ascending order.
  2. Get first row and second row date value form Date column
  3. Check first row date should be less than or equal to second row date.
  4. Get second row and third row date value.
  5. Check second row date should be less than or equal to third row date value.
  6. Same way check until end of row using For Loop.
  7. In the case if you got false result while comparison two row you need to break the for loop and show  the   fail result......

set TableObject = Browser(“XYZ”).Page(“WXY”).WebTable(“MNP”)
TableRowcount  = Browser(“XYZ”).Page(“WXY”).WebTable(“MNP”).RowCount

For i =1 to TableRowcount -1
 dtmCurrRow  = TableObject.GetcellData(i,<DateColumn>)

 dtmNextRow  =  = TableObject.GetcellData(i+1,<DateColumn>)
      If  NOT cdate(dtmCurrRow) <=  cdate(dtmNextRow) Then
              Flage = 1
              Exit For
      End If
End
If  Flage <> 1 than
  msgbox  "Pass"
Else
  msgbox  "Fail"
End if

Which one is right ?

Translate







Tweet