Welcome, Guest. Please login or register.
Login with username, password and session length

 
Advanced search

18488 Posts in 4838 Topics- by 32654 Members - Latest Member: revitvm
 

AdvancedQTP forums have been nominated as a finalist in ATI’s 2nd annual automation honors awards!

We’d like to thank you for your continued support and participation, and urge you to hurry and vote.

Make you voice count! 


Pages: [1]   Go Down
Print
0 Members and 1 Guest are viewing this topic.
Author Topic: Bitmap checkpoints    (Read 770 times)
Marjorie Dashef
User
*
Offline Offline

Posts: 4


« on: February 20, 2008, 11:43:24 AM »

I am using a bitmap checkpoint to verify that my column in a java table has been sorted in descending order (eg.  Last Name with a downward triangle).  Sometimes the bitmap works and other times it just totally dies. I have also tried standard checkpoints which doesn't capture the triangle as a triangle with about the same success.  Any suggestions?
Logged
Meir Bar-Tal
Administrator
Advanced User
*****
Offline Offline

Posts: 1285



WWW
« Reply #1 on: February 20, 2008, 01:13:44 PM »

I would make a distinction between two types of verifications:
One, that the column is sorted in a particular order;
Second, that there's an indication on the GUI that the column is sorted in a particular order.

The difference between the 2 types of verifications is that the one is direct while the second is indirect.

With the first approach, one would retrieve the column's contents to an array, copy it to another array, sort one or the other, and then compare them to see if they're equal. If the answer is True, then the column is sorted; otherwise it's unsorted. The particular order (ascending or descending) can also be verified this way.

With the second, which you're trying to use, the data order is not verified, but only the GUI indicator for a particular order - that is, you assume that it's sorted, and only ask whether it's ascending or descending.

The Bitmap Checkpoint, with which you're trying to implement the second type aforementioned, is a very problematic approach to verification. What I'd suggest is that you explore the the JavaTable object model and see whether in the class properties there's some indication for the change in the state of the object.

I hope this is useful. Smiley

Cheers!
Logged

Best Regards,

Meir Bar-Tal
AdvancedQTP Chief Editor & Forums Administrator
Dani Vainstein
Advanced User
*****
Offline Offline

Posts: 623



« Reply #2 on: February 20, 2008, 01:14:41 PM »

My friend, you have selected the worst method to do checkpoints
bitmap checkpoint is the most unstable feature of QTP.
an improvement was made in QTP 9.5
to check the order of the table do the follow.


Code:
Set oList = CreateObject( "System.Collections.ArrayList" )

For i = 1 To JavaTable.RowsCount()
   oList.Add  JavaTable.GetCellData( i, 0 )
Next
oList.Sort
For i = 1 To oList.Count - 1
If JavaTable.GetCellData( i, 0 ) =  oList.Item( i - 1 ) Then
Reporter.ReportEvent micPass .....
Else
Reporter.ReportEvent micFail .....
End If
Next
Logged

Best Regards,
Dani Vainstein
Mercury CPC

http://www.advancedqtp.com
Meir Bar-Tal
Administrator
Advanced User
*****
Offline Offline

Posts: 1285



WWW
« Reply #3 on: February 20, 2008, 01:27:16 PM »

I couldn't agree more with Dani.
Just a simple optimization on Dani's suggestion:

Code
GeSHi (qtp):
Public Function CheckColumnSortDirection(ByRef objJavaTable, ByVal chrSortDirection, ByVal intCol)

'Arguments: ByRef objJavaTable - the JavaTable Test Object

'           ByVal chrSortDirection - "A" (ascending) or "D" (descending)

'           ByVal intCol - JavaTable column index



    Dim intStatus, strReportDetails, objList, i



    'Optimistic initialization

    intStatus = micPass

    strReportDetails = "Column is sorted as expected."



    Set objList = CreateObject( "System.Collections.ArrayList" )



   

    For i = 1 To objJavaTable.RowsCount()

        objList.Add  objJavaTable.GetCellData( i, intCol )

    Next



    objList.Sort



    If (UCase(chrSortDirection) = "D") Then 'Column is expected to be sorted in descending order

        objList.Reverse

    End If



    For i = 1 To objList.Count

        If objJavaTable.GetCellData( i, 0 ) <> objList.Item( i - 1 ) Then

            intStatus = micFail            

            strReportDetails = "Column is not sorted as expected."

            Exit For

        End If

    Next



    'Report result

    Reporter.ReportEvent intStatus, "CheckColumnSortDirection", strReportDetails



    'Return status

    CheckColumnSortDirection = intStatus

End Function

 
Created by GeSHI 1.0.7.20

I hope this is useful. Smiley
« Last Edit: February 20, 2008, 01:36:46 PM by Meir Bar-Tal » Logged

Best Regards,

Meir Bar-Tal
AdvancedQTP Chief Editor & Forums Administrator
Marjorie Dashef
User
*
Offline Offline

Posts: 4


« Reply #4 on: February 21, 2008, 11:48:13 AM »

thanks for all youf help -- I knew that bitmap checking was risky but didn't really want to even do the search to populate a table -- I only cared that the sort order from the last logon was remembered when next logged on.  I have already gone to the array.
Logged
Pages: [1]   Go Up
Print
Jump to: