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

Is AI taking over your job in software development and testing? 😱"

Are you a software developer or tester feeling threatened by the rise of AI in your industry? 😰 You're not alone. Many professionals in the field are concerned about the potential consequences of AI's integration into software development and testing. While some experts believe that AI can bring significant benefits to the industry, others worry that it could replace human expertise altogether. 🤔 AI algorithms can analyze massive amounts of data and automate many tasks, but they cannot replace the critical thinking and creativity of human beings. Additionally, there are ethical concerns associated with the use of AI in software development and testing. So, what can you do to ensure that you're not replaced by AI in your job? 💪 First, it's essential to recognize that AI is not a replacement for human expertise but rather a tool to augment it. Therefore, it's essential to learn how to work with AI-powered systems to increase your efficiency and productivity. Additi

Revolutionize software testing with AI! 🤖💻 Share your thoughts on ethical implications in the comments.

  As technology evolves, so too does the field of software testing. One exciting development in recent years is the use of AI (Artificial Intelligence) to automate repetitive tasks and improve testing accuracy. Through analyzing large amounts of data and identifying patterns, AI can help identify potential defects or vulnerabilities in software. AI-powered tools can also generate test cases and scenarios by simulating user behavior and input, allowing for more efficient and effective testing. In addition, machine learning algorithms can analyze and learn from past testing data, leading to better predictions and more streamlined testing. AI-powered tools can also help identify and prioritize critical bugs and defects, saving valuable time and effort in manual testing. But it's important to note that AI-powered testing is not a replacement for human testers. While AI can automate certain tasks and help identify potential issues, it's still necessary for human testers to provide a

HP Quality Center - Best Practices

1.Introduction Quality Center is a test management tool which provides very good features for managing both your manual and automated test cases. This paper highlights the best practices for managing your test cases. When you open Quality center, depending on your rights it display the below mentioned option in the sidebar: 1. Requirements 2. Test Plan 3. Test Lab 4. Defects 5. Dashboard 2.Requirements When you have assigned with the responsibility of developing your test cases in the quality center then you must be wondering where to start with. I am going to share my experience to overcome such a situation. You need to find the solution of some question before you start writing your test cases. 1. Is your requirement developed and available? 2. Is your requirement organized in a logical sequence? If answer to both of the above question is Yes, then you can start with Requirement option in the side bar. In case your requirement is under development, then you keep your