This is the 12th tutorial in the QTP training series.
This tutorial will explain to you the Expert View overview and Step generator along with a brief introduction to Checkpoints that will be carried out further until we cover all the details elaborately with examples on how to use these while recording actual scripts.
=> Click Here For QTP Training Tutorials Series
Table of Contents:
The Expert View of QTP
- Expert view is where the operations we perform on the AUT get displayed as VB Script code.
- For each LOC in this view, there is a corresponding column in the Keyword view.
- There is also an action drop-down box that can be used to access, view, and edit different actions in the test.
- This view is particularly useful for users who are familiar with programming using VB script.
- One of the most important uses of this view is that it facilitates the creation of functions and function libraries. (a topic for detailed discussion later)
- The user can print the test or function library as it appears in this view anytime. File -> Print will print the test.
This is how it looks:
You can add statements to this view directly by typing in or by using the step generator.
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 it, use the menu option “Insert -> Step Generator”. Right-click anywhere you want the step to go and select “Insert Step -> Step generator” or F7 (except in Active screen).
For Example,
I will explain this with a scenario: Open www.gmail.com and click on the “Create Account” link. This is how this statement will look.
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, then, 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 to get inserted.
- Expert view: Place the cursor where you want the step to go and launch the Step Generator.
- Keyword view: Select the step below which you want to insert the step.
- 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. Following that, the Step Generator window will be launched.
Step #2: This is the step generator window that gets launched. Please note the details that are displayed now. It shows all the details related to the steps that are 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 choose operation Exist. I left the arguments empty because it is optional and chose that the return value of the operation is 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: In the drop-down where I chose a test object, I can alternately choose to base my step on a utility object or Function.
Step #4: Object: This field contains a list of required objects 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 parameterize the arguments or provide constant values.
Step #7: The user can just insert one statement or choose to follow it with another one by turning on the “Insert another step” option.
Step #8: So, back to our example. I will click OK. This is the statement that gets inserted.
var_Exist = Browser("Gmail: Email from Google").Page("Gmail: Email from Google").Link("Create an account").Exist Browser("Gmail: Email from Google").Page("Gmail: Email from Google").Link("Create an account").Click
Checkpoints
We have so far encountered some references to checkpoints at various places in our articles. There are many ways to define what a checkpoint is, my definition is – “It is a logical point in your test where you are trying to establish if there is a match between a certain expected value to the actual value as it exists on the AUT”.
We have discussed earlier that QTP provides certain inbuilt checkpoints, but does not limit the user to just those. At any point in a test, the tester is free to build any number of checkpoints in this test to include verification points. That according to me is one of the most versatile features in QTP.
It is obvious that custom checkpoints are entirely relative to each one’s problem at hand. We will equip ourselves with basic concepts on the checkpoints that come as an integral part of QTP.
#1) When a checkpoint is added, QTP adds a “Check CheckPoint” in the Expert view and a corresponding row in the keyword view.
For Example,
Browser("Gmail: Email from Google").Page("Gmail: Email from Google").Check CheckPoint("Gmail: Email from Google")
#2) The user can have the checkpoint statement return a boolean value that depicts the result of the checkpoint. If passed, it returns a 1 and 0 if failed. To be able to do that, we need to use parentheses around the checkpoint argument in the statement in the Expert View.
For Example,
i=Browser("Gmail: Email from Google").Page("Gmail: Email from Google").Check(CheckPoint("Gmail: Email from Google"))
#3) By default, the name of the checkpoint will be the name of the object on which this check is performed.
#4) The user can accept this name or change it.
#5) When the test runs, if the expected value matches with the actual one for the checkpoint, the checkpoint passes otherwise it fails.
#6) The results can be viewed in the Run Results Viewer.
There are 10 checkpoints that QTP provides to its users:
- Standard Checkpoint
- Image Checkpoint
- Bitmap Checkpoint
- Page Checkpoint
- Text Checkpoint
- XML Checkpoint
- Text Area Checkpoint
- Table Checkpoint
- Accessibility Checkpoint
- Database Checkpoint
The general way a checkpoint is inserted is after the initial test steps are created. It is possible to add checkpoints during recording or editing though.
It is recommended that the tester has preliminary knowledge about all the checkpoints in order to make the right judgment about which checkpoint is apt for the task at hand.
=> Visit Here For The QTP Training Tutorials Series
We are going to do just that in the next article. We are going to see what each checkpoint does and learn how to use them.
Is it same as check points? Should we use this step generator instead of check points? or should we use both of them? When exactly are we using them?
Oh, you so should do such tutorial for Selenium! Thanx!
@swathi
thank you…
Hi,
Does QTP support both desktop & web applications..
Swati and Vijay…. Grt efforts… Thanks for all the QTP info
a very easy understandable language and concept are to given . thank you so much
Very useful tutorial.
Thanks
thanks for clearing my doubts on step genertaor
Its very useful.
@Chandrasekar: Yes, QTP supports both web and desktop apps
Hello,
thanks for great tutorial about QTP.
Really appreciate your effort.
@swati: thank your
Its very easy to understand. Thanku so much
Nice one
thank you
Nice