TESTEVERYTHING

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

7 comments:

Anonymous said...

Best blog of QTP...Wonderful work Rajiv bro.

TestEverything said...

Thanks dude.. :)

Anonymous said...

Your welcome bro.
bro. now i want to do work on database testing with QTP(something related to database checkpoint)
can you please guide me how to do these stuff or you can recommend me from where can i read.

TestEverything said...

bro.. first start learning about basic sql queries(insert update,delete joins etc.) table, database. then move to db testing. because before knowing the db basics you can not start..

Thanks

Anonymous said...

Thanks for rply..
bt sry my question is still same.. U r absolutely right before db testing basic should be clear.. N i think i have enough knowledge of DBMS N RDBMS with which i can easily handle db queries.. i have also worked on oracle..
so if you guide me in this(from the base means "connectivity of qtp with db(mysql)").. it will be very beneficial for me.. sir i think best option is if u post on ur blog with any example.. any how ur blog is marvellous for QTP tutorials
Thanks

TestEverything said...

k cool start reading the Db check point in QTP help file. refer below links
http://testeverythingqtp.blogspot.com/2011/06/query-from-text-file-and-retrieve.html

http://rajivkumarnandvani.wordpress.com/category/database/

Anonymous said...

Browser("name:=Project List").Page("title:=Project List").Frame("name:=content").WebTable("name:=checkAll","class:=List").Link("innertext:=Planned Start Date").Click

Set TableObject = Browser("name:=Project List").Page("title:=Project List").Frame("name:=content").WebTable("name:=checkAll","class:=List")
TableRowcount = Browser("name:=Project List").Page("title:=Project List").Frame("name:=content").WebTable("name:=checkAll","class:=List").RowCount()
For i =1 to TableRowcount
dtmCurrRow = TableObject.GetCellData(2,5)
dtmNextRow = TableObject.GetCellData(2,5)
If NOT cdate(dtmCurrRow) <= cdate(dtmNextRow) Then
Flage = 1
Exit For
End If
If Flage <> 1 then
Reporter.ReportEvent micPass,"Planned Start Date", "Sorted Successfully"
Else
Reporter.ReportEvent micFail,"Planned Start Date", "Not Sorted Successfully"
End if
Next

Tried the same on this but got error at RowCount line

Post a Comment

Which one is right ?

Translate







Tweet