Skip to main content

HP QTP Tutorial Chapter 5

1 Insert

The Insert Menu will help you in inserting various verification points, New Steps, Function, and Call to Action etc. While describing the various commands which are available in Insert Menu, I will also be mentioning the hot keys to access some of the commands. See the below screen shot what command is available in the INSERT Menu:
clip_image002

1.1 Checkpoint

Let me first describe what a checkpoint is all about. The Checkpoints feature is provided in Automation Tool for simplifying the test case automation where you need to validate the state of the application. For e.g. You might want to test that when you open a web page or form, you will be able to see 5 Input Boxes and 2 Buttons. Out of the 5 Input Boxes, 3 should be editable, 2 should be ready only. Likewise 2 Buttons – 1 will be disabled by default and 1 will be enabled by default. In such a case you can use Tool Checkpoint feature. I hope this now clarify what is a checkpoint and its usage. If you read the QTP documentation it will talk of various checkpoint like Text, Text area, Table, Standard etc. In this tutorial I will talk about the checkpoint but not in a detail manner as I am writing another chapter dedicated to Checkpoints.
You can access Checkpoint: INSERT->CHECKPOINT (See the below screen shot)
clip_image004
The commands which are in disabled mode will be enabled when you start your script recording. There are only two commands namely Database checkpoint and XML checkpoint which are available in enabled mode by default. There is reason behind it, if you see these checkpoints they do not have dependency on AUT as they are interacting with database and XML which can be loaded from server or local directory.

1.2 Output Value

The Output Value is mainly used wherein you want to capture the value from AUT. For e.g. I am creating an Account in my application which provide me with an Account number after successful creation of an account. I want to use this account number for validating some scenario which can be done only through search module of the application. In such a scenario I can use Output feature in QTP so that the value can be used as an input in another part of AUT. You can access Output Value: INSERT->OUTPUT VALUE (See the below screen shot)
clip_image006
I will talk more about Checkpoint and Output value in the next chapter. Keep checking my blog.

1.3 Step Generator

As you start with your scripting, you need to use inbuilt functions, customized functions to design a robust testing framework. The Step Generator aids your scripting by providing help on 3 categories: Test Objects, Utility Objects, Functions. As you select any of these categories QTP allows you to add respective steps in your script. This tool is very handy for beginner as it really makes their life easy while scripting. You can access the Step Generator by pressing shortcut key of F7 or navigating to INSERT->STEP GENERATOR ( See the below screen shot of Step Generator):
clip_image008
I will talk about the details in next the chapter of this tutorial series.

1.4 Function Definition Generator

This utility or command in QTP aids you in defining the Function Skelton. You can define Function or Sub Procedure using Function Definition Generator. You can define even register your function with a Test Object so that you can achieve the desired result on the Test Object action. I will not delve into much detail at this point of time as it is more advance topic. So as of now if you are beginner and new to scripting, this is the utility for you. You can access the utility by navigating to INSERT-> Function Definition Generator. See the below screen shot:
clip_image010

1.5 Synchronization Point

This is one of very useful command in QTP. This will be used very frequently in your scripting. There might be a situation wherein you have to wait till the time page get loaded or input field get enabled, progress bar reach 100% etc. Any scenario where next action depends on the completion of previous action, you have to use Synchronization Point in your script. This command will get enabled when you are in recoding mode. Just try your hand on this utility and see the generated script. Seeing the name you will understand that you have to wait till some property get satisfied. You can access this command from INSERT-> Synchronization Point (See below screen shot)
clip_image012

1.6 New Step & New Step after Block

Suppose you have done 50% or 20% of your scripting and then you realize that you have to add some more steps which are in between of some existing steps, then you can use New Step command. This command is available to you in Keyword view only. First you need to place select the step in Keyword view, then navigate to INSERT->NEW STEP or press F8, as soon as you do this you will see a drop down from where you can select any test object , function to insert in your script. See the below screen shot:
clip_image014
Similarly if you want to add anything after a conditional block (IF ELSE) or loop (FOR, WHILE etc), then you can make use of INSERT-> New Step after Block or press SHIFT+ F8
clip_image016
See the above screen shot wherein you can see the block of If statement in blue.

1.7 Comment

If you want to insert the comment in your scripting, use this command to provide the line comments, comments before a line of code etc. Navigate to INSERT->COMMENT. You can also provide Line comments by filling the comment column of your keyword view. Please see the below screen shot:
clip_image019
clip_image021

1.8 Report

This command is used to report the Pass, Fail, Warning, Done status to execution result. To add Report statement, select the step in keyword view after which Report statement need to be added, navigate to INSERT->REPORT. See the below screen shot. You have to select the status, enter the name and description and then you are done:
clip_image023

1.9 Conditional Statement

As the name suggests, if you want to define some logic, then you have to use the Conditional statement. This is very useful command to build a robust script. The usage of conditional statement and result reporting goes hand in hand. One has to ensure that wherever they are using Report statement, it should always be inside conditional statement. For e.g If I have to validate that button exists or not, then I will use conditional statement to report my result. See below pseudo code:

IF BUTTON EXIST
REPORT PASS
ELSE
REPORT FAIL
END IF
You can access the Conditional statement command from INSERT=>Conditional Statement. See below screen shot which is self explanatory.
clip_image025

1.10 Loop Statement

Like Conditional Statement you can also use Loop Statement where you have to use different set of data for your script. Without Loop statement, you can make your data driven framework (wait till advance version of tutorial get released). To insert Loop statement, select the step after which you want to have Loop statement, and then navigate to INSERT->Loop Statement. See below screen shot:
clip_image027

1.11 Call to New Action

As in my previous chapter I mentioned about action. Call to New Action is the command which can be accessed from INSERT-> Call to New Action. The call to new action command is calling a new action which does not have any script written. The new action is blank without any commands. You have to define the New Action after which it will perform the desired action and make your requirement fulfilled. See the below screen shots:
clip_image029
After you define the New Action, you can make it reusable if you wish to use it in other Actions.

1.12 Call to Copy of Action

This is calling an existing action but with a copy of it so that you can customized as per your need. When saved a copy of previous action will be saved. This is the same thing wherein you are making use of existing code with some modification to speed up the scripting process. To access Call to Copy of Action, navigate to INSERT->Call to Copy of Action (See below screen shot)
clip_image031

1.13 Call to Existing Action

This is very frequently used while doing scripting. Your test script is a combination of multiple actions like Login, Logout, Navigation, Specific Function etc. As a best practice what we normally do is we identify actions which get used most of the time. We make such action reusable and ask other scripter to call this Action without making any changes. The same is called Call to Existing Action. You cannot make any changes in Original Action. To add existing action, navigate to INSERT->Call to Existing Action (See below screen shot)
clip_image033

1.14 Call to Winrunner

As the name suggest that you can call Winrunner Test or Function as well. This utility is given by HP so that any organization which has major enterprise automation library developed in Winrunner 8.2, they can make most use out of it without rewriting the library from scratch. This command will normally not used when doing fresh automation in QTP. Another pre-requisite to access this command is that you must have WinRunner 8.2 or higher version installed in your machine.

1.15 Start Transaction and End Transaction

Suppose I want to measure the time taken in inserting 1 record in the database. This information will tell me the transaction time. This is useful only when I want to make this information available to LoadRunner or Business Availability Center for measuring the performance of the application. You can insert Transaction time by putting the start time and end time between 2 points. To access the above command navigate to INSERT->Start Transaction and End Transaction. This measures the time taken to complete the required piece of transaction. For e.g. how much time system is taking to return the search result. Here I will start transaction wherein I am inserting search text and clicking the search button, I will end my transaction when I got the required search result. When I run this script, I will have my search timings.
I hope you must have got it what I intend to say.

2 References

Quick Test Professional Tool.

3 Additional information

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

Comments

QPT said…
QTP Tutorial 5 is excellent and useful for all.
QTPbook
custom software said…
nicely written...quite detailed.. helpful both in terms of knowledge and use....custom software
Unknown said…
software testing firm offers software QA outsourcing, software testing services including web application testing and dedicated QA team creation.
search engine optimization india

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