11-12-2008, 09:08 PM
Hi,
I have an application which contains a WebTable object and this application does a sort function. The only thing I want to do is that QTP has to verify if the sort is correct. For example, I want QTP to verify if the sort in the 5th column is correct or not. In this column I have about 20 entries. here is my code:
Now I am told that I have to use arrays to verify the entire sort. Can anybody provide me a code or give me an example on how I can implement this array concept in this code. Thanks
I have an application which contains a WebTable object and this application does a sort function. The only thing I want to do is that QTP has to verify if the sort is correct. For example, I want QTP to verify if the sort in the 5th column is correct or not. In this column I have about 20 entries. here is my code:
Code:
Browser("").Page("").Frame("").Image("Sort ascending").Click
a = Browser("").Page("_2").Frame("_sweview").WebTable("Select for MultiPay").GetCellData(2,5)
b = Browser("").Page("_2").Frame("_sweview").WebTable("Select for MultiPay").GetCellData(3,5)
c = Browser("").Page("_2").Frame("_sweview").WebTable("Select for MultiPay").GetCellData(4,5)
d = Browser("").Page("_2").Frame("_sweview").WebTable("Select for MultiPay").GetCellData(5,5)
If a<b and b<c and c<d Then
Reporter.ReportEvent micPass, "Sort_Invoice", "Sort is correct"
Else
Reporter.ReportEvent micFail, "Sort_Invoice", "Sort is wrong"
End If
Browser("").Page("").Frame("_sweview_8").Image("Sort descending").Click
a = Browser("").Page("_2").Frame("_sweview").WebTable("Select for MultiPay").GetCellData(2,5)
b = Browser("").Page("_2").Frame("_sweview").WebTable("Select for MultiPay").GetCellData(3,5)
c = Browser("").Page("_2").Frame("_sweview").WebTable("Select for MultiPay").GetCellData(4,5)
d = Browser("").Page("_2").Frame("_sweview").WebTable("Select for MultiPay").GetCellData(5,5)
If a>b and b>c and c>d Then
Reporter.ReportEvent micPass, "Sort_Invoice", "Sort is correct"
Else
Reporter.ReportEvent micFail, "Sort_Invoice", "Sort is wrong"
End If
Now I am told that I have to use arrays to verify the entire sort. Can anybody provide me a code or give me an example on how I can implement this array concept in this code. Thanks