Checkpoint is a method used to check the content before and after the step, i.e it is used to compare the expected value with the actual value displayed in the application, these checkpoints can be customized according to the requirements.
The checkpoint can be added while recording the application or it can be added after the recording is completed using Active screen (For adding Checkpoint after recording the Active screen must be enabled while recording)
Once the checkpoint is added, the QTP adds a checkpoint to the current row in keyword view and adds a check checkpoint statement to the expert view.
The types of checkpoint are,
The standard checkpoint checks the object property values in an application or a webpage.
It checks objects like Radio buttons, combo boxes, images, Tables, Web page properties, links etc.
The Table checkpoint can be used to check all the values in the table, it can be created by inserting standard checkpoint on the table.
The page checkpoint can also created by inserting standard checkpoint on the object, the page check point can be used to check the time taken to load a webpage.
The Bitmap checkpoint can be used to check an area of a webpage or an application as a bitmap. It checks that particular area by pixel to pixel comparison between actual and expected images.
The Image checkpoint is used to check the properties of an image in the application or a webpage like verifying the selected image source file is correct or not.
The difference between Bitmap checkpoint and Image checkpoint is in Bitmap Checkpoint we can check the images on pixels basis where in Image checkpoint it cannot be done.
The Text checkpoint is used to check the expected text from an application or a web page. It can be a specific region or a small portion of the text displayed.
The Accessibility checkpoint checks the areas of the web page that may not conform to the W3C (World Wide Web Consortium) Web Content Accessibility Guidelines.
The Database checkpoint is used to check the database accessed by the application.
This checkpoint creates a query during record time and the database values are stored as the expected values. The same query is executed during run time and the actual & expected values are compared.
The XML checkpoint checks the data content of XML documents in XML files or XML schema related to the webpage.
Step generator:
- This is a facility that QTP provides in order to make adding programmatic steps into QTP easy for the user.
- You can use it in the Keyword view, function library, Active screen or Expert view to generate steps
- It can be used to write steps into a test or to a function library.
- To launch, use the menu option “Insert->Step Generator” menu option. Right click any where you want the step to go and select “Insert Step-> Step generator” or F7(except in Active screen)
Example:
I will explain this with a scenario: Open www.gmail.com and click on “Create Account” link. This is how this statement will look.
1 | Browser("Gmail: Email from Google").Page("Gmail: Email from Google").Link("Create an account").Click |
If I need to check if the link exists at all, before I write the code to click on it, I will need a step before the above statement. This is how I do it:
Step # 1) Select the place where you need the step inserted.
a) Expert view: Place the cursor where you want the step to go and launch step generator.
b) Keyword view: Select the step below which you want to insert the step.
c) Active screen: In the active screen window, right click and choose the step generator option. It will ask you to choose the object on which your step should be based on. Following that the step generator window is launched.
Step #2) This is the step generator window that gets launched. Please note the details that it is displaying now. It is showing all the details related to the step that is currently chosen. We can choose the required values for the new step but that does not affect the current step.
I am going to set the values as required by me to enable checking if the link exists.
As you can see, I chose a Test Object, Create an account link and chose the operation Exist. I left the arguments empty because it is optional and chose that the return value of the operation be stored in a variable var_Exist. It displays the VB Script statement, as it is going to appear in the Expert view in the “Generated Step” field. In other words, the syntax.
Step #3) The drop down where I chose a test object, I can alternately choose to base my step on a utility object or Functions.
Step #4) Object: this field contains a list of required object or the function library source.
Step #5) Operation field will let you choose the appropriate method, property or function.
Step #6) Arguments and Return value: These fields are self explanatory. The user could parametewise the arguments or provide constant values.
Step #7) The user can just insert one statement or choose to follow it with another one by checking the “Insert another step” option ON.
Step #8) So, back to our example. I will click OK. This is the statement that gets inserted.
1 | var_Exist = Browser("Gmail: Email from Google").Page("Gmail: Email from Google").Link("Create an account").Exist |
2 | Browser("Gmail: Email from Google").Page("Gmail: Email from Google").Link("Create an account").Click |