Skip to main content

HP QTP Tutorial Chapter 7

 

1 Output

 In my previous chapter, I discussed about QTP Checkpoints which is a very handy utility for comparing the expected and actual result. This chapter covers the topic of OUTPUT utility available in QTP. This utility is also very handy in capturing the run time values from the application under test. You will use OUTPUT utility where in you are testing and automating an end to end test scenario. In such a case output of one module is an input to next module. An end to end Business Scenario example is given below:
Validate that user is able to book and cancel the flight ticket
Step1- Navigate to booking site The user navigated to booking site
Step 2- Enter valid login credentials The system allowed login and display the flight booking page
Step 3- Fill the Booking Information & Submit the form The system generate a unique PNR number once data is processed Standard Output
Step 5- Navigate to Cancellation Page and enter the Ticket PNR number for cancellation The system searches the ticket and allow the user to cancel the ticket Enter the PNR generated from Step 3
Step 5- User cancelled the ticket The system should cancel the ticket and generate a confirmation id Standard Output, if you want to make use of Confirmation Id on other module to know the refund status of your money.
Step 6 – User navigated to Refund Status module and Enter the confirmation id The system display the Refund Status to the user

You can get the runtime values using other VB Script technique as well but since we are talking about Output, so we will use Output to achieve our automation requirement.
To summarize the definition of Output I will define “Output as a utility which can be used to implement the validation of our Test cases mainly End to End Test Scenarios where run time data from one module is an input to another module”
We will focus our chapter on above scenario and I will show you how to make use of Output Utility
Please find below the List of Output Types available under INSERT->OUTPUT:
clip_image002

Note: Please note if you want to add Output Values after recording, then you must have enabled Active Screen Capture option. Enabling Active Screen Capture option will save the Page Image which can be used to add Output Value in your Test Scrip

 1.1 Existing Output Value

 The existing output value option will provide you the ability to view all available output value in your test. This option will only be enabled if your Test contain atleast one Standard Output Value. If test does not contain any output values, then the option is disabled. The usage of this feature is to add existing output value at in the Test Script. Since Output Values are defined on Test Object which is part of Object Repository, so you have access to all the Output Values which exist on your Object Repository. No need to duplicate the work. You can access the same either by Insert->Output Value->Existing Output Value or Shift+Alt+F12. Refer below for Existing Output Value window:
clip_image004
You keep your cursor at the line wherein you want to add the Output Value and then open above dialog and click OK button. Your script will now have Existing Output added. If you see the Expert View, you can see below line of code:
“Browser("XAMPP 1.7.4").Page("XAMPP 1.7.4").Output CheckPoint("https://localhost")” - //OUTPUT Value
Browser("XAMPP 1.7.4").Page("XAMPP 1.7.4").Frame("head").Image("xampp-logo-new").Check CheckPoint("xampp-logo-new") // CHECKPOINT Value
Have you noticed the difference between Checkpoint and Output? If you see the checkpoint line of code, you will find “Check” keyword and in Output, the “output” keyword is used

1.2 Standard Output Value

The standard output value checkpoint is the most commonly used checkpoint. If you refer the example given in section 1 where confirmation id is stored by using standard output feature. To insert Standard Output, you need to first select the value from your AUT and then either press Ctr+F12 or INSERT=>OUTPUT=>STANDARD OUTPUT. Follow the instruction and finally you will find Standard Output added in your script. Please see below screen shot for clarity:
I am outputting HREF so only HREF is checked. The most important information is the configure value section where you the output will be seen. To use the same you need to refer the same location. (This is normally a column in either Global Sheet or Local Sheet or Customized Excel Sheet).
clip_image006clip_image008
Note: Please do not change the value present in your Output Column as this may impact your run logic. You will also see the result of your output values in the Test Report.
In real time application or implementation, a scripter hardly make use of this in-built QTP function and instead make use of GETROProperty to fulfill such condition.

Standard Output is normally used at control level such as WebEdit, Weblink, Images et

1.3 Text Output Value

 The Text Output is used when dynamic content between static content need to be used as input. To insert Text Output Value, select the dynamic content and then INSERT=>OUTPUT=>TEXT OUTPUT, follow the screen instruction and once completed you will see another column added into global or local sheet. Please see below screen shots:
clip_image010clip_image012
This is again a hardly used feature of QTP in real time projects. But good to know so that you can make use of it whenever you do not have any workaround.
The Text Output is available to user when s/he is in recoding mode or on Active Scree

1.4 Text Area Output Value

This Output feature is applicable only for Windows Based Application. To use Text Area Output feature, click INSERT=>OUTPUT=>TEXT AREA OUTPUT, select the cross hair icon on the object where Text Area is required and then follow the instructions. See the below screen shot:
clip_image014clip_image016
The Text Area Output is available to user when s/he is in recoding mode or on Active Scree

1.5 Database Output Value

 The Database Output Value is used to output the database table value into your global or local sheet. Then you will make use of it in rest of your test and this speed up your scripting. You do not have to maintain the datasheet since you always have a correct and fresh set of data to use. I can figure out the above usage. To use the DB Output Value, go to INSERT=>OUTPUT=> DATABASE OUPUT, set the database query and follow the screen instructions. See the below screen shots:
clip_image018
You can set which DB Column value should be used as an output. Select those columns and then click OK. You will see below line of code in expert view for DB Output.:
DbTable("DbTable").Output CheckPoint("DbTable")
You can make use of this Output feature to parameterize your test data for use in another related functionality.
The DB Output feature is available in both recording and normal mod

1.6 XML Output Value - Application

 XML Output Value – Application feature can be used in a similar way as DB Output Value. The difference here is the source which in this case is XML Document within the Application. This is available only for Web Based Application and not for Desktop Application. You can Insert XML Output Value by navigating to the application where XML Document exists, then click INSERT=>OUTPUT=>XML OUTPUT VALUE – APPLICATION, follow the screen instruction and you are done. See below screen shots:
clip_image020
The XML Output Value feature is available in recording mode and not in normal mode. As soon as you click Value node, it will add the corresponding column in the datasheet

1.7 XML Output Value - Resource

This is the feature which can be used when XML is available in offline mode on hard drive. In that case, you need to select the XML from the location while adding XML Output Value from Resource. Go to INSERT=>OUTPUT=>XML OUTPUT VALUE – RESOURCE. Please refer above screen shot. There is no difference between Resource and Application implementation. The only difference is the source from where you are selecting the XML Document.
clip_image022
The XML Output Value feature is available in both recording mode and normal mode.
Concluding my chapter, I want to emphasize on certain features which you can really make use to define your Framework. Make use of Database Output, XML Output to define the Test Data for your Test. This reduces a lot of maintenance work since your Test Data is being derived from XML or DB during run time

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...