HP QTP Utility Statements : Print Statement
September 10, 2018
HP QTP Utility Statements : Print Statement
Welcome to this post! – ” HP QTP Utility Statements :Print Statement”.
If you are looking for HP UFT, QTP utility statements and their usages, then you are at right place. This post “HP QTP Utility Statements : Print Statement” consists of concept discussion and usage discussion. Go ahead and enjoy reading…
This discussion will help you prepare well if you are going for the interview and can help you if you need the function to be used in your project test suite.
Print Statement
Abstract
The Print statement is used to displays information in the QTP or UFT Print Log window during the run session.. This statement is called as an utmost priority step or statement whenever defined. The statement in itself falls under the category of utility statements and not utility objects.
Remember there is a difference between utility statements and utility objects.
Before we dig down deep into the usage let’s quickly visit some general questions.
In the interview usually, you might be questioned in different ways like:
- How to get variable values print out during test run?
- Can you use the print statement for printing mathematical expressions?
- What are the objects and parameters of print statement?
- Is Print an object or statement?
- Can you print the dynamic values directly to QTP log?
Discussion
This is the most used and discussed statement in QTP. The print statement prints and displays information in the QTP or UFT Print Log window during the run session. The Print Log window remains open while the run session continues, until you close it.
This statement can be used for debugging automation scripts. You can also debug a scenario whether its specific steps getting passed or failed via printing out every step. You can pass any string expression to this statement to be printed on log window.
Syntax
Print (Message)
Let’s see the parameters and their usage description for this statement:
Argument | Type | Description |
Message | String | String expression displayed as the message in the QTP or UFT Print Log window. |
Example
The following example iterates all the items in the Table dialog and uses the Print utility statement to print the content of each item to the Print Log window.
'example Print Set ObjectList = Window("mywindow").Dialog("Some Table").WinList("List") For i = 1 to ObjectList .GetItemsCount Print ObjectList .GetItem(i - 1) Next
This brings us to the end of our discussion on “HP QTP Utility Statements : Print Statement”.
I really hope you have enjoyed reading this short post. If you have any doubt on this please feel free to add your comment below.
And if you like to read more on UFT or QTP Technical Interview Questions please follow below links:
UFT Technical Interview Questions – Set 1
UFT Technical Interview Questions – Set 2
How to Download Resource From QC\ALM?
How to Upload Resource To QC\ALM?
Or if you prefer General Interview Questions please follow below links:
UFT General Interview Questions – Part 1
UFT General Interview Questions – Part 2
If you would like to keep track of further articles on UFT (QTP). I recommend you to SUBSCRIBE by Email and have new UFT articles sent directly to your inbox.