Continuing our journey of understanding the critical concept of inserting checkpoints in QTP, this tutorial will again focus on adding checkpoints. Previously, we discovered the method of integrating Standard and Image checkpoints into QTP assessments.
In our current QTP training module, we will be examining the process of incorporating Bitmap and Text Checkpoints into QTP assessments.
Recommended IPTV Service Providers
- IPTVGREAT – Rating 4.8/5 ( 600+ Reviews )
- IPTVRESALE – Rating 5/5 ( 200+ Reviews )
- IPTVGANG – Rating 4.7/5 ( 1200+ Reviews )
- IPTVUNLOCK – Rating 5/5 ( 65 Reviews )
- IPTVFOLLOW -Rating 5/5 ( 48 Reviews )
- IPTVTOPS – Rating 5/5 ( 43 Reviews )
=> Click Here To Access The QTP Tutorial Series
Bitmap Checkpoint
The checkpoint’s name itself provides an insight into its function. Nevertheless, it is sometimes mistaken for an Image checkpoint.
Contrasts between Image and Bitmap Checkpoints:
Contrast #1: Image checkpoint is limited to the Web environment, while Bitmap checkpoint is compatible with all supported environments.
Contrast #2: Bitmap checkpoint can be exploited to compare a section of an application, a page, an object, or a fragment of an object. When established, this checkpoint captures the chosen screen segment as a bitmap and contrasts it with the outcome during runtime. Conversely, image checkpoints are specifically tailored for web image objects.
Accordingly, the Bitmap checkpoint seizes the visible sections of your AUT (Application Under Test) and carries out a bitmap-to-bitmap comparison. It is typically utilized to verify maps, logos, or any additional diagrams in your AUT.
Several key points to bear in mind:
- Bitmap checkpoints are reliant on factors like screen resolution, operating systems, and RGB configurations. As a result, any alterations to these attributes will result in the checkpoint’s failure.
- While establishing the checkpoint, QTP does not document any part that is scrolled off the screen or obscured by another object.
- If another application overlaps your AUT while capturing the bitmap, that part of the screen is also seized.
- Bitmap checkpoint can be added during the recording process or from the active screen.
For instance, I wish to create a bitmap checkpoint on the Google icon of the www.gmail.com page.
To accomplish this, I initiate a test with record and run settings adjusted in a manner that launches www.gmail.com on internet explorer during the recording process. Then, I select Insert -> Checkpoint -> Bitmap checkpoint. Afterward, I select the ‘google’ logo on the www.gmail.com site, and the subsequent dialogue pops up:
Take note of the dialogue above.
#1) The image appears in the Bitmap checkpoint properties dialogue, and the user is given an option to either check the whole image or choose a distinct area.
#2) If you tick the ‘Check only selected area’ option, you will have the ability to select a piece of the image. As it’s challenging to visually depict it, I encourage readers to test it out practically and see how this functions.
#3) The remaining options on the screen are intended for refining the properties. Their primary purpose is to ensure that the checkpoint passes, notwithstanding slight discrepancies in certain RGB or pixel values.
- RGB Tolerance: Upon setting, this value discerns how many RGB values of the pixels can differ for the checkpoint to pass.
- Pixel Tolerance: With this option activated, you can define the tolerance value either percentage-wise or as a precise figure. For instance, if the user opts for 5 pixels and the image has 1000 pixels, up to 5 different pixels are permitted without triggering the checkpoint to fail. If more than 5 differences are present, the checkpoint fails. If both RGB tolerance and Pixel tolerance values are set, RGB tolerance takes precedence.
#4) There’s also a timeout factor that we discussed in the previous tutorial.
After selecting a fragment of the logo, I click OK.
The subsequent statement is produced in the Expert view:
Browser("Gmail: Email from Google").Page("Gmail: Email from Google").Image("Google").Check CheckPoint("Google")
The Keyword view appears as such:
- If a discrepancy in the image occurs during runtime, the checkpoint fails, and both the saved image and the image captured during runtime are displayed in the test results.
- This functionality can be configured from Tools -> Options -> Run -> Screen capture.
Following the creation of the Bitmap checkpoint, it can be edited afterward from the checkpoint properties screen. You can access this dialogue from the Keyword view, Expert view, or the Object Repository.
Text Checkpoint
Throughout the testing process, several situations will arise wherein the text displayed in the AUT needs to be verified. In this context, ‘text’ refers to a string of text.
One method of doing so is to use a standard checkpoint and check an object’s “text” property. Let’s try that now. Once again, I will open www.gmail.com and verify the text displayed on the “Check Account” button or link.
I will opt to incorporate a standard checkpoint from the menu and set the following details:
The statement it includes is:
Browser("Gmail: Email from Google").Page("Gmail: Email from Google").Link("Create an account").Check CheckPoint("Create an account")
Nonetheless, QTP offers specific checkpoints to accomplish these.
Text Checkpoint: We will use the same example to see how a Text Checkpoint differs from incorporating a standard checkpoint over the ‘text’ property.
During the recording process on the gmail.com page in internet explorer, I choose “Insert -> Checkpoint -> Text checkpoint” from the menu.
The subsequent dialogue will be displayed:
Let’s observe each field in this dialogue and comprehend the role each set value will play in our checkpoint.
#1) Name: By default, the checkpoint’s name mirrors the name of the object on which a checkpoint is added. The user has the option to alter it if necessary.
#2) Class: Indicates the object type. This field is non-editable.
#3) Checkpoint Summary: Offers a brief explanation of the checkpoint’s function.
- For web applications, it showcases the text within the object in red. Refer to the dialogue above.
- For a windows application, it exhibits the text you picked whilst creating the checkpoint.
- For a windows application, if you selected text that spans multiple lines, the summary area showcases [Complex value].
Let’s consider an example. We shall begin with the Notepad application. Firstly, let’s try with one line of text. I will inscribe “test” in the entire notepad, integrate a text checkpoint, and click on the text in the notepad.
The subsequent display of the dialogue:
Now, let’s include two lines of text, for instance, “test” and “test 1” on separate lines. Observe how this text is displayed in the Checkpoint summary.
#4) You can utilize the text to stipulate the “Text before,” “Text after,” and “Checked Text.”
For instance, if you need to ascertain whether ‘test’ appears in the notepad prior to ‘test1,’ you can specify that by clicking the ‘Configure’ button above.
The subsequent dialogue opens:
#5) The next set of options are intended for parameterization and setting comparison rules. They are pretty self-explanatory.
Once all options are established and you click OK, a checkpoint statement is included in the test as follows:
- Text checkpoints can be incorporated while recording, editing, or from the active screen.
- Once established, all properties can be revised from the checkpoint property window, reachable from the Keyword view, Expert view, or the Object Repository.
- Text checkpoints operate in most environments, unlike text area checkpoints that function only in a windows environment. We will delve into text area checkpoints in the forthcoming tutorial.
- On occasions where QTP is unable to retrieve the text directly from an object, such as when the text is handwritten and scanned as an image, it resorts to OCR (Optical Character Recognition) to recognize the text.
As usual, don’t hesitate to post any queries and remarks. We will proceed with checkpoints in the next article as well.