In the previous QTP training session, we listed all the checkpoints that QTP provides. All these checkpoints are very important to insert verification points in QTP tests to check if the current and expected values of an object match or not. This determines the PASS or FAIL status of the test.
In today’s tutorial, we will deal with QTP Standard and Image checkpoints in detail.
#1) It is used to check the Object Property value.
#2) Compares the expected value with the actual value during runtime.
#3) It can be set during recording or editing a test.
#4) The active screen can also be used to insert this checkpoint. Sufficient information must be available on the active screen in order to insert a checkpoint.
For example, if there is a screen with, Login edit box, Password Edit box, OK, Cancel, and Help buttons. We need to check if the Cancel button is visible. We are trying to achieve this by placing a checkpoint on the “Visible” object property of the Cancel button.
While recording I performed an enter Login, enter a password, and click OK; and the setting on my active screen is just to store the objects that I acted on and not the others, I will not be able to place the checkpoint on the cancel button because the active screen does not possess information about that object.
Therefore, it is important for the active screen to have captured all the objects on the page, and only then we can insert the checkpoint. I hope this explains what I mean when I say that the active screen should have sufficient information.
#5) Once added, the checkpoint properties can be changed using the “Checkpoint Properties” dialog box.
#6) Every checkpoint gets added to the local object repository when added. It can be moved to the shared object repository if needed.
#7) Supported for all the environments as long as the appropriate add-ins are loaded.
#8) Some examples of the objects that can be used on our web images, Edit boxes, static text, web tables, etc.
How to insert a Standard Checkpoint while Recording?
Step #1: Insert -> Checkpoint: Select this option from the menu after starting a record session.
Step #3: A list of relevant checkpoints applicable to the current or selected step on performing one of the steps listed in 1 and 2.
Step #4: Select the type of checkpoint. We will select “Standard” in our case.
Step #5: The QTP interface gets hidden and the user can choose the object in the AUT over which the user wants to insert a checkpoint.
Step #6: Select the object and the following screen will appear.
Step #7: Choose the object and click OK in the dialog. The checkpoint properties dialog box will be displayed.
Step #8: Select the properties you want to be checked and click OK. I am just going to choose the name. As you can see above, you can modify the properties to either a constant value or parameterize. There is also a timeout parameter that you can set.
What this means is that QTP waits for the particular number of seconds specified in this dialog for a certain object to attain a property value before it performs the check.
Step #9: This is how I set the parameters and click OK.
Step #10: This is how my checkpoint looks in the keyword view.
Step #11: In the expert view, the following code gets displayed.
Browser("Gmail: Email from Google").Page("Gmail: Email from Google").WebButton("Sign in").Check CheckPoint("Sign in_2")
How to insert a Standard Checkpoint while Editing?
#1) Active Screen: In the Active Screen, right-click on an object and select the option to insert a standard checkpoint. After that, follow the same steps as above to insert a checkpoint.
#2) At any step in the QTP test, select the menu option “Insert ->Checkpoint” and choose “Standard checkpoint”. Again, follow the steps above.
How can Checkpoint properties be accessed and modified?
After creation, the user can modify the checkpoint as required. This can be done through the “Checkpoint properties” dialog box.
This dialog can be accessed in the following ways:
#1) While creating a checkpoint this box opens up for the initial definition of the properties.
#2) Select an existing checkpoint statement in the Keyword view, right-click and select “Checkpoint properties”.
#3) Open the Object repository and the properties available there are shown below:
From this box, all the properties of a checkpoint can be modified as required.
Since the standard checkpoint is the first on our list, I have provided the detailed steps of adding it in different scenarios and modifying it in different ways in detail. Moving forward, I am going to list the properties and features that are unique for each checkpoint.
It should be noted that the steps to add, use and manipulate the checkpoints are all the same for most of the checkpoints. From now on, unless specifically mentioned, the above approach can be used generically to the other ones too.
A slight variation of a standard checkpoint is while it is used on web images.
In case the object on which the checkpoint is inserted happens to be a web image, the following dialog box opens up.
It should be noted that this screen is almost identical to the “Checkpoint Properties” dialog, and it is specific to images.
The only extra parameter is the “Compare Image Content” checkbox. If it is checked, the image in runtime is checked with the one stored during the creation of the checkpoint to see if it is exactly the same. If they are the same, then the test results will only have one image. If they are different, then both the images will be displayed in the test results.
For example, on the Gmail page, I tried to insert a standard checkpoint on one of the images from the Active screen and this is what gets displayed.
I will not make any changes to the dialog, you can if you wish to and click OK.
This is what the inserted checkpoint is going to be.
Expert View Code:
Browser("Gmail: Email from Google").Page("Gmail: Email from Google").Image("nosign-r42").Check CheckPoint("nosign-r42")
That is all for today! We will continue with the other checkpoints in further sessions. Feel free to post your questions.