HP QTP Question Bank: Q. 21 to 30
Q. 21: Where can we use a Function or an Action?
It all depends on the scenario.
If we want to use the OR feature then we have to go for Action only. If the functionality is not about any automation script i.e. a function like getting a string between to specific characters, now this is something not specific to QTP and can be done on pure VB Script, so this should be done in a function and not an action. Code specific to QTP can also be put into an function using DP. Decision of using function / action depends on what any one would be comfortable using in a given situation.
<<<<<< =================== >>>>>>
Q. 22: What is the difference between an Action and a Function?
Action is a activity specific to QTP while functions are a generic thing which is a feature of VB Scripting.
Action can have a object repository associated with it while a function can’t. A function is just lines of code with some / none parameters and a single return value while an action can have more than one output parameters.
<<<<<< =================== >>>>>>
Q. 23: What are the various events available in the Recovery Scenario Manager?
1) Application Crash: This event is useful in handling crashed applications at runtime.
2) Pop Up Window: This event is useful in managing various unwanted application windows, which get built-up at runtime.
3) Test Run Error: This event is useful in handling VBScript statement errors at runtime.
4) Object State: This event is useful in handling object related errors at runtime.
<<<<<< =================== >>>>>>
Q. 24: What are the Elements of Recovery Scenario?
Steps to handle the exceptions are
1) Trigger Event: Is an unexpected event like appearance of a Pop-up window, object state, test run error causing application crash or interruption in our running session.
2) Recovery Steps: Constitutes a series of steps required to be performed to enable QTP to proceed further with the process of test after some trigger event has interrupted the run session. Examples of a recovery operation can be 1) A keyboard or mouse Operation like a Click over the “OK” button in the Pop-up window 2) Close Application Process 3) Function Call 4) Restarting the OS etc.
3) Post-Recovery Test Run: Are a set of instructions designed to be provided to QTP on proceeding further with the test after some recovery operation has been carried out. Examples of Post Recovery actions can be repeating the complete test from the beginning or some steps may be skipped altogether & continuing with the remaining steps in the test.
<<<<<< =================== >>>>>>
Q. 25: When to use a Recovery Scenario and When to use “on error resume next”?
Recovery scenarios are useful when it is difficult to predict at which step the errors can come or when we are confident that the error will not come in the QTP script, whereas it can be anywhere outside the QTP Script.
For illustration; Pop-up message of “out of paper”, as caused by the printer device driver. “On error resume next” is preferred when we are sure that the error is expected one and wish to perform some other actions.
<<<<<< =================== >>>>>>
Q. 26: What are the key features of QTP at a glance
# Ease of Use: QTP allows even novice testers to become productive in minutes. We can create a test script by simply pressing a Record button and using an application to perform a typical business process. Each step in the business process is automated documented with a plain-English sentence and screen shot. Users can easily modify, remove, or rearrange test steps in the Keyword View.
# Simple Interface: QTP is much simpler to understand. It presents a test case as a simple business workflow to the tester.
# Simple Language: QTP uses Microsoft’s VBScript for its test procedures, and to manipulate the objects and controls of the application under test. VBScript is a real programming language where several existing functions & resources are easily available for implementation these days.
# Use of Zero-Configuration Technology: QTP uses next-generation “zero-configuration” Keyword Driven testing technology. This helps in faster test creation, easier maintenance, and provides more powerful data-driving capability.
# Automatic Insertion of Checkpoints: QTP enables thorough validation of applications through a full complement of checkpoints. QTP can automatically introduce checkpoints to verify application properties and functionality, for example to validate output or check link validity.
# Marvelous Interface with Data-tables: QTP allows entry of test data into the Data Table, an integrated spreadsheet with the full functionality of Excel, to manipulate data sets and create multiple test iterations, without programming, to expand test case coverage. Data can be typed in or imported from databases, spreadsheets, or text files. QTP has better and easier to use Data table integration compared to WinRunner.
# Better Object Identification Mechanism: QTP Identifies objects with Unique Smart Object Recognition, even if objects change from build to build, thereby enabling reliable unattended script execution.
# Support of Variety of Environment: QTP supports functional testing of all popular environments, like Windows, Web, .Net, Visual Basic, ActiveX, Java, SAP, Siebel, Oracle, PeopleSoft, terminal emulators, and Web services.
# Easy Adaptability of Microsoft Object Models: QTP can easily create and implement Microsoft Object Model like: Outlook objects, ADO objects, FileSystem objects, supports DOM, WSH, etc.
# Auto-Documentation Technology: QTP renders test documentation and test creation to a single step with the help of its auto-documentation technology
<<<<<< =================== >>>>>>
Q. 27: What are various types of properties when using Object Identification in QTP?
QTP uses three types of properties when identifying an object
1. Mandatory Properties: Always learn these properties for the object
2. Assistive Properties: Learn in case Mandatory properties are not enough to identify the object uniquely
3. Ordinal Identifiers: Learn in case both mandatory and assistive properties are not able to recognize the objects correctly
<<<<<< =================== >>>>>>
Q. 28: What are the various ways to insert a Action in a test in QTP?
There are three ways to insert an Action in a test
1. Insert Call to New�
2. Insert Call to Copy�
3. Insert Call to Existing�
<<<<<< =================== >>>>>>
Q. 29: What is the use of Parameterization in QTP?
Parameterization is helpful in aspects like:
# Parameterization allows us to pick different values at run time.
# Reduces Time and Effort.
# Usage of data drivers allows us to use the same data for various input boxes.
# Parameterization can also be done for checkpoints.
<<<<<< =================== >>>>>>
Q. 30: What are Data Tables in QTP?
Data Table is MS Excel like spreadsheet which can be used for parameterizing a test case
DataTable are of two types like:
1. Global Data Table: Is a Data table for Test flow
2. Local Data Table: Is a Data table for every action
Continue to Next Part : Q 31 to 40
An expert on R&D, Online Training and Publishing. He is M.Tech. (Honours) and is a part of the STG team since inception.