QTP Tutorial #12 – Expert View, Step Generator and Checkpoints Explained with Example

It is going to be an article on Expert View overview, Step generator and a brief introduction to Checkpoints that will be carried on further until we cover all the details elaborately with examples on how to use these while recording actual scripts. This is 12th tutorial in QTP training series.

Expert view of QTP

  • Expert view is where the operations we performed on the AUT get displayed as VB Script code.
  • For every LOC in this view, there is a corresponding column in Keyword view.
  • There is also the 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 any time. File->Print will print the test.

This is how it looks:

QTP expert view

You can add statements to this view directly by typing in or by using 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, 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)

Step generator

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.

 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 generator

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.

Step generator

I am going to set the values as required by me to enable checking if the link exists.

Step generator

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 generator

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.

 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 in various places of your articles, some references to checkpoints. There are many ways to define what a checkpoint is, this is mine –“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 talked earlier; 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 check points in his 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.

Example:

 Browser("Gmail: Email from Google").Page("Gmail: Email from Google").Check CheckPoint("Gmail: Email from Google") 

 2) The user can have the check point statement return a boolen value that depicts the result of the checkpoint. If it passed, it returns a 1 and 0 if failed. To be able to that, we need to use parentheses around the checkpoint argument in the statement in the Expert View.

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:

  1. Standard Checkpoint
  2. Image Checkpoint
  3. Bitmap Checkpoint
  4. Page Checkpoint
  5. Text Checkpoint
  6. XML Checkpoint
  7. Text Area Checkpoint
  8. Table Checkpoint
  9. Accessibility Checkpoint
  10. 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 what checkpoint is apt for the task at hand.

We are going to do just that in the next article. We are going to see what each checkpoint does and try to learn how to use them.



The Best Software Testing Training You'll Ever Get!

software testing QA training

13 comments ↓

#1 Senthil Kumar on 04.16.13 at 8:20 pm

thanks for clearing my doubts on step genertaor

#2 shivanand kengar on 04.17.13 at 5:05 am

a very easy understandable language and concept are to given . thank you so much

#3 chandrasekar on 04.19.13 at 7:31 am

Hi,
Does QTP support both desktop & web applications..

#4 Slava on 04.19.13 at 1:05 pm

Oh, you so should do such tutorial for Selenium! Thanx!

#5 Azhar on 04.19.13 at 2:43 pm

Hello,

thanks for great tutorial about QTP.

Really appreciate your effort.

#6 Swati on 04.19.13 at 4:26 pm

@Chandrasekar: Yes, QTP supports both web and desktop apps

#7 Sneha rao on 04.22.13 at 6:57 am

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?

#8 chandrasekar on 04.22.13 at 9:21 am

@swathi
thank you…

#9 chandrasekar on 04.26.13 at 8:00 am

@swati: thank your

#10 Medha on 09.05.13 at 1:14 pm

Swati and Vijay…. Grt efforts… Thanks for all the QTP info

#11 Anita on 10.08.13 at 1:16 pm

Very useful tutorial.

Thanks

#12 manjunath mudhol on 11.26.13 at 11:22 am

Nice one
thank you

#13 shilpa on 04.08.14 at 6:45 am

Its very easy to understand. Thanku so much