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

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

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

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