Having problems with your account or logging in?
A lot of changes are happening in the community right now. Some may affect you. READ MORE HERE

Can you provide an example of how to use sMaskFile when using the Verify Bitmap method?

Can you provide an example of how to use sMaskFile when using the Verify Bitmap method?

Scenario:

If you want to use the Verify Bitmap method to verify the entire window, but a section of the window is going to change all the time.
For example, there is a date/time field which is going to change all the time. How do I handle this, because if the date/time is going to
change then the verification will fail as the baseline bitmap is now different.

Solution:

Use the sMask file optional argument (see the SilkTest help for more details)

  1. First you would record a testcase/actions, then press Ctrl + Alt on your screen, select the "Bitmap" tab and ensure that entire window is checked. Copy your testcase/actions into a script file.

  2. Open the bitmap tool (Start, Programs, SilkTest, Other Tools, SilkTest Bitmap Tool)

  3. Open the bitmap that you have just recorded. The path will be in noted in the information you just pasted into the script file.

  4. Go to Edit > New Mask. In your baseline bitmap draw around the section of the window that is going to change (date/time field). You will notice that a black rectangle appears in your mask file. Save this file.

  5. To handle this in your code see the example below:

    [-] testcase Test1 ()
        [ ] WelcomeToGreenMountainOutp.SetActive( )
        [ ] WelcomeToGreenMountainOutp.VerifyBitmap ("F:\Program Files\Segue\SilkTest\Projects\VerifyBitmapMask\bitmap.bmp", NULL , "F:\Program Files\Segue\SilkTest\Projects\VerifyBitmapMask\mask.bmp")
    

NB: The NULL value is present because there is another optional argument that you can use called Rect, see the SilkTest Help for more details on this argument.

DISCLAIMER:

Some content on Community Tips & Information pages is not officially supported by Micro Focus. Please refer to our Terms of Use for more detail.
Top Contributors
Version history
Revision #:
1 of 1
Last update:
‎2013-02-15 19:17
Updated by:
 
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.