Skip to main content

HP Quick Test Professional Tutorial Chapter 3

1 Edit Menu

In Edit Menu, the first 7 commands are very self explanatory, which you can find in any GUI based application. You will find Undo, Redo, Cut, Copy, Paste, Delete, Copy Documentation to Clipboard (used for copying the documentation column value into notepad, ms word etc.).The below command are also very self explanatory and will get active when you are in Expert View mode. The commands are Find, Replace, Goto, Bookmarks.
In this paper, we will cover Action (Split Action, Rename Action, Delete Action, Action Properties, Action Call Properties), Step Properties (Object Properties, Checkpoint Properties, Output Value Properties), Advanced (Comment, Uncomment, Indent, Outdent, Goto Function Definition, Complete Word, Argument Info, Apply “with” to script, Remove “with” statements) & Optional Step.
clip_image002 clip_image004
clip_image006

1.1 Action

As the name suggests, ACTION command can be used for doing manipulation on the QTP Actions. If you do not know what an ACTION is, then let me define for you. ACTION is building block concept in QTP. Whatever you are scripting is identified with an Action Name. ACTION provides a unique name to your Test Script. There is a reason behind introducing this concept in QTP. The ACTION enable to design a framework which can be made to re-used in your enterprise application. It provides a logical grouping of your Test Cases so that you can easily manage your Test Script. Test can consist either 1 action or multiple ACTION (reusable actions). We will cover these concepts in next series for Intermediate user level. Let now see the commands available under ACTION option.

1.1.1 Split Action

Select the block of Test Steps in QTP which you want to SPLIT into 2 Action and then either right click or choose EDIT->ACTION>SPLIT. This will open a window where in you can specify whether you want the Actions as an Independent of each other or Nested. Specify the name of each action on the same window and then click OK. You have successfully SPLIT your Action. Now let me tell you its real time usage, you normally split action for doing a fast scripting. You recorded all the Step in 1 go and then SPLIT into ACTIONS so that you have the logical grouping of your test cases. The SPLIT option might not be enabled if:
  1. Reusable Action is selected which is external in your Test (External Action)
  2. The very first step of your Test Script
  3. The Test open is Read-Only (anyway you cannot do anything except execution)
  4. Recording a test
  5. Running a test
As a best practice, 1 Test Case should ideally consists of 1 independent Action and if required reusable actions. I will not recommend to use SPLIT action if you are using it for having 2 independent action with in the same Test Cases.

clip_image008

1.1.2 Rename Action

This will be 1 of the very frequent command on your list. You need to rename your Action as per defined standard for your project and organization. To rename your action, press SHIFT+F2 or click EDIT->SPLIT->RENAME ACTION. You can also rename your action from the Action Properties Window. The default name given by QTP for Action is Action 1 and so on.
clip_image010

1.1.3 Delete Action

You are also going to make use of this command whenever you want to delete other action (normally re-usable) in your Test Script. If you have included wrong re-usable action in your script and want to Delete it, then open the Reusable Action from Action navigation drop-down, click EDIT->SPLIT->DELETE ACTION. Please click Yes or No on the confirmation window to perform Deletion of your Action. I still wonder why this option never appears in right click menu. If you know the shortcut key for Delete Action, please share with us as well. I am having hard luck finding the short key for Deleting an Action.

1.1.4 Action Properties

If you want to perform below activities on your Action, then use Action Properties window:
1. Rename of an action
2. Making your Action a Reusable action
3. Specifying Input and Output Parameters specific to your Action
4. You want to associate or view the Object Repository for your Action.
5. You want to view the information that which all other Test are making use of your reusable action.
Let me give you some more insight into point number 3. In real time scenario, we normally use point 3 whenever we are creating reusable action. Parameter are normally not required for Independent Action. Usage of parameter will be covered in next level of my series.
clip_image012

1.1.5 Action Call Properties

You will find this option available only when your Test is using reusable action or nested actions. Using this command you can:
1. Control the run of the called action
2. Provide the parameter value for the called action
Select the Reusable Action in Keyword View mode (remember you won’t see this option in the Expert View mode) and either Right Click and select Action Call Properties or Edit->Split->Action Call Properties.
clip_image014

1.2 Step Properties

 1.2.1 Object Properties

If you know what an object in QTP, then its good but in case of you do not know, then let me define it for you. An object is a control (edit box, radio, check box, button etc), window, browser, page etc which has unique name, properties given by the developer and QTP identifies the object using those unique name or properties. As a scripter you should be able to read and understand the object properties. QTP provide Object Properties option to see the property of an object. Ready only information is displayed in this window but you can find that object in Object Repository from this window as well.
First highlight the Object and then either press Ctrl+Enter or Alt+Enter or Edit->Step->Object Properties or Right Click and then select Object Properties.
clip_image016

1.2.2 Checkpoint Properties

Let first understand what a checkpoint is actually means in QTP. Checkpoints in QTP enable or pacify the process of test case validation. For e.g. if my test case is saying, validate that the QTP image is appearing on the web page, validate that Age Text Box is disabled by default. If you have to script above test cases, then you might require the Checkpoint in QTP. There are various checkpoints which are available in QTP but the most frequent one is Standard Checkpoint. We will cover QTP checkpoints in detail in next series.
If your test consists one or more such checkpoint, then you can view the Checkpoint property by either selecting the “Check” keyword in Expert view and then Right Click and choose Checkpoint Property. You can also click the tick sign in Keyword View mode on the Test Step which correspond to “Checkpoint”. Using Checkpoint properties window, you can put validation for other properties as well. You can set the value to be Constant or make it Dynamic by parameterize the specific property.
clip_image018

1.2.3 Output Value Properties

This is similar to Checkpoint properties except that you are outputting the value from your AUT to make use of it for doing validation at some other steps in your test. We will separately cover this in next series. But you can view the Output properties in the same way as you viewed the Checkpoint properties. Select the Step which consists “Output Check”, select Edit->Step->Output Value Properties or Right Click->Output Value Properties.
clip_image020
You can edit other properties as well so that it can be outputted to a spreadsheet. You can navigate to Object Repository from this window. Click the icon on right side of Name Text Box.

 1.3 Advanced

 1.3.1 Comment Block

To commend the block of code, select the block of code in Expert View and press Ctrl+M or Edit->Advance->Comment Block. This will comment the selected code. Used very frequently while doing scripting.

1.3.2 Uncomment Block

To uncomment the block simply select the block and press Ctrl+Shift+M or Edit->Advance->Uncomment Block.

1.3.3 Indent / Outdent

This is very self explanatory. You can indent and outdent your Test Script to increase readability. This make your Test Script look cleaner and make your script easily readable to other scripter. Always follow the defined Organization standard for Indenting and Outdenting.

1.3.4 Goto Function Definition

This is very important command and you need to know this as this will come very handy when you are analyzing the existing script which is making use of function. This command will simply take you’re the function definition. Remember from 2nd series we have included library files in our test. Those library files is a collection of various functions which my Test will make use of. If my test is making use of function whether internally or externally, I can always see the definition. Select the Function Name, Right Click->Goto Function Definition, or Edit->Advance->Goto Function Definition or press Alt+G.

1.3.5 Complete Word

This is again very simple. If you writing a code say Dialog, the instead of typing complete word, you can type initial and then either press Ctrl+Space or select Edit->Advance->Complete Word. The former is more frequently used and I do not know why HP has still given this option in the Edit Menu.

1.3.6 Argument Info

To see the Argument of a function whether in-built or external , type the function name and then press Ctrl+Shift+Space or Edit->Advance->Argument Info.

1.3.7 Apply “With” to Script

You can make your script look more readable with “With” statements. To apply the script with “With” statement, simply press Ctrl+W. This will convert the script into “With” statement. See the below screen shot for clarification.
clip_image022

1.3.8 Remove “With” Statements

If you want to remove the With Statement and revert to its original format, press Ctrl+Shift+W and your script will be removed with all the “With” statements.

1.4 Optional Steps

The decision to make a step optional entirely depends on your application design. There may be instances where you application perform some action based on saved value in session. For e.g. Remember Login feature. You can make the Test Step for Login as an Optional Step. To make a Step optional, go to Keyword View and then select and right click on step and select Optional Step. You can also go Edit->Optional Step. This step will show clip_image024 icon to demarcate it as an Optional Step. In Expert view the corresponding line will be “OptionalStep”.
An optional step is not necessarily required to successfully complete a run session. If object of optional step does not exist in AUT, then QTP ignores it and continue with the test.
By default, QTP considers steps that open the following dialog boxes or message boxes as optional steps: AutoComplete, File Download, Internet Explorer, Netscape, Enter Network Password, Error, Security Alert, Security Information, Security Warning, Username and Password Required.

2 References

Quick Test Professional Tool.

3 Additional information

You can email me on Sachin.vasudha@gmail.com with any query.

Comments

Popular posts from this blog

Mantis - Defect Management Tool - User Guide

Introduction This white paper contains information related to an open source defect management tool called Mantis which is freely available for managing all your defects. Where to Download One can download the latest version of Mantis from http://sourceforge.net/project/showfiles.php?group_id=14963 Download the “mantis-stable” and then “mantis-x.y.z.zip”.1.1 PRE-REQUISITE Operating System Windows 2003 Server, MacOS, OS/2, Linux, Solaris Database MySQL database 3.23.2 and higher Software PHP 4.0.6 and higher Application Server Apache 1.3, Apache 2.0.54, IIS 6.0 with Web Services Extension Browser IE6 and above, Mozilla Firefox STEPS FOR INSTALLATION – FOR WINDOWS MySQL Installation Install MySQL by downloading it from http://dev.mysql.com/get/Downloads/MySQLGUITools/mysql-gui-tools-5.0-r6-win32.msi/from/http:/www.mirrorservice.org/sites/ftp.mysql.com/ . Please follow the below mentioned steps while installing MySQL: (Please remember the password for “root” account...

Why to do Software Testing?

Regardless of the limitations, testing is an integral part in software development. It is broadly deployed in every phase in the software development cycle. Typically, more than 50% percent of the development time is spent in testing. Testing is usually performed for the following purposes: To improve quality. As computers and software are used in critical applications, the outcome of a bug can be severe. Bugs can cause huge losses. Bugs in critical systems have caused airplane crashes, allowed space shuttle missions to go awry, halted trading on the stock market, and worse. Bugs can kill. Bugs can cause disasters. The so-called year 2000 (Y2K) bug has given birth to a cottage industry of consultants and programming tools dedicated to making sure the modern world doesn't come to a screeching halt on the first day of the next century. [Bugs] In a computerized embedded world, the quality and reliability of software is a matter of life and death. Quality means the conformance to the ...

HP QTP Tutorial - Chapter 10

1 Debug In my previous chapter, I discussed about the features available in Resources Menu such as Object Repository, OR Manager, and Associate Repositories etc. This chapter covers the features available under Debug Menu option. This chapter explains the following features available under Debug Menu : The features under Debug menu are very useful and also frequently used. Although in most of the cases you use Short Keys. We will cover all these features in detail in this chapter. 1.1 Pause  There could be case when are you running your script and want to pause (remember Pause and Stop are different things), then you can navigate to Debug ->Pause. The script will be paused at the current execution step. You can then do your analysis and then continue with your run by clicking on Automation-> Run. Alternatively you can also Press F5 or Run button from the tool bar.  1.2 Step Into  There are situation in a script which makes call to other Action or Funct...