QTP Interview Questions

advertisement
QTP Interview Questions
What is QTP?
Quick Test Pro is a GUI based testing tool for automated functionality. It allows to automation of the user actions on a web based or
client based and desktop software application. The functional regression test automation is used primarily by QTP. A scripting language
is built atop of VBScript for specifying the test procedure and to manipulate the objects and controls of the application under a test.
QTP works together with Mercury Interactive WinRunner and HP Quality Center and also supports the Quality Assurance of an
enterprise.
Q1. What phases are involved in testing an application in QTP?
The Quick Test Professional process consists of the following main phases:






Analyzing Application: before preparing test cases need to analyze the application to find out the testing needs.
Preparing Testing Infrastructure: based on testing needs create those resources, resources like, shared repository, function library etc.
Building Test Cases: create test script containing action to be performed while testing. Add object repository with the test function
libraries.
Enhancing Test: by making use of checkpoints, broadening the scope of test, add logic and condition to test for checking purpose.
Debugging, Running and analyzing Test: debug the test so that it works without interruption. Run these test and analyze the test result
generated by QTP
Report Defects: lock bug into the bug report and send it to the development team.
Q2. How many types of recording modes in the QTP?
The QTP enable us with three type of recording mode:



Normal (by Default recording): In this recording mode QTP identify the object irrespective of their location on the screen. It is done by
recording object based on application window.
Analog Recording: it is used when exact mouse movement and action performed by mouse is important. Used in testing the paint
application and signature made with the help of mouse.
Low Level Recording: it helps in identifying those objects which is not recognized by the QTP. It is used when the location of object is
changing inside the screen.
Q3. What is object repository?
Object Repository: when QTP learn any object from application it stores those object in the Object Repository with the properties of the object. It is
used to identify the object. There are two types of object repository:


Shared Object Repository: It can be shared between multiple tests but it does not allow making changes in the repository. Mostly used in
Keyword Driven methodology. It is saved with .TSR extension.
Local Object Repository: This type of object repository is linked with only one test. In this we can perform change in the repository, like
changing the properties of the object, adding object in the repository. It is saved with .MTR extension.
Q4. Explain step generator in QTP?
Step Generator in QTP helps in creating those steps which is performed over the object while testing. Use of Step Generator in QTP:




Help in debugging the script by making use of Break.
To add those step which we forget to perform while recording.
To ensure that objects exist in the repository
To add up step in the function library.
Q5. Explain the use of Action Split in QTP?
Action Split: it is used to split the action into two parts. There are two type of split an action:


Splitting into two sibling action: both split actions are independent of each other.
Splitting into Parent-Child nested action: in this second split action is only called after the execution of the parent split action. Child split
action depends upon the parent split action.
QTP generated the duplicate copy of the object repository when we perform Split action. We can add object to anyone spilt action which is not added
into another split action’s repository.
Q6. What is the purpose of loading QTP Add-Ins?
Add-Ins: are small programs or files which can be added to computer in order to enhance the capabilities of the system. The purposes of loading AddIns into QTP are following:




To increase capabilities of the system.
To improve the graphics quality, communications interface.
To load the particular function into the memory.
To excess only those functions that is required for the execution of the script.
Q7. What is a data driven test in QTP?
Data Driven is an automation testing part in which test input or output values, these values are read from data files. It is performed when the values are
changing by the time. The different data files may include data pools. The data is then loaded into variables in recorded or manually coded scripts. In
QTP to perform the data to drive the test, we use the parameterization process. When we do data-driven test, we perform two extra steps:


Converting the test to a data-driven test.
Creating a corresponding data table.
Q8. How to use Parameterization in QTP?
It is the process of making use of different values in place of recorded values which is replaced by variable which contains different values that can be
used during the execution of the scripts. QTP enable us with different type of Parameterization, passing of data:






Using Loop statement.
Dynamically test data submission
Using data table.
Fetching data from external files.
Fetching data from databases.
By taking test data front end(GUI)
Q9. Is it possible to call from one action to another action in QTP?
Yes, QTP enable us to call from one action to another action. There are two ways of calling action:


Call to Copy of action: in this we generate the copy of action in our repository which enables us to perform change to the copy of action.
Call to Existing action: we call to action which is made up earlier. This generates the reference to the action. We can access the action in
read only mode. In this no copy of existing script and data table is made.
Q10. Explain different types of action in QTP?
When generating the test script, it includes only one action. Action contains the number of steps to be performed on application to test the application.
There are three type of action in QTP:



Non-Reusable action: it can be called by test only once in which it is stored.
Reusable action: it can be called by test multiple times in which it is stored.
External action: it is reusable action but stored in external test. We can call external action but it will be available in read only mode we
cannot perform any change to the External Action.
Q11. What is difference between Run time object and Test object?
The difference between Run time Object and Test object are:




Run time object are actual object in the application whereas test object are reference of the actual object.
Run time object always have same name whereas test object name varies in different environment.
Test object are used to identify the actual object in the application which is run time objects.
Run time object resides in the application whereas test object resides in the object repository.
Q12. Explain Measuring Transaction.
Measuring transaction means that to measure how much time it take to execute a set of step over the application. A transaction is collection of steps
that we are intended to know how much time it take to execute. We can define the transaction by enclosing the set of steps with the start transaction
and end transaction.


Start transaction: after encounter of start transaction time measurement start.
End transaction: it is used to stop the time measurement.
Q13. Explain different checkpoints in QTP.
Checkpoint is a point where QTP current value or property of the object with the expected value or property of the object. When we insert the check
point in the test, then in keyword view checkpoint is added in front of current row and in expert view a checkpoint statement is added. QTP enable us
with following types of check point:










Standard Checkpoint: check properties of objects like button, combo boxes, list etc.
Image Checkpoint: check value of an image
Bitmap Checkpoint: check image zooming capability.
Table Checkpoint: check information of a table.
Text Checkpoint: check text is displayed on correct place.
Text Area Checkpoint: check text is displayed in specific area.
Accessibility Checkpoint: used to determine website which is not as per W3C guidelines.
Page Checkpoint: checks properties of the webpage.
Database Checkpoint: check content of database
XML Checkpoint: check XML content.
Q14. Can we create a QTP test from QC?
Yes we can create QTP test from QC but we must first make sure QTP has the ability to execute tests from Quality Center. Please ensure the following
option in QTP Run Settings is enabled:
When QTP is enabled, follow the below steps to schedule and execute tests from Quality Center:
1. Login to Quality Center and Navigate to Test Lab Module
2. After selecting the correct Test Set, Click the Execution Flow Tab.
3. Right-click on the test that requires configuration of Time Dependency and click Test Run Schedule.
4. In the Run Schedule window, select the Time Dependency tab. The time and date of execution can be configured.
5. Time dependency will be added to the relevant test.
6. After time dependency has been added, navigate back to the Execution Grid pane. From the Execution Grid, select the tests to be run at the
designated date and time.
7. From the Automatic Runner dialog, click Run All.
8. Once Run All is clicked from the Automatic Runner dialog, the test status will change to Waiting and QC will fire the tests to be run at the scheduled
date and time:
9. QC will fire the tests in the sequence configured in the Execution Flow pane. The Test Run Scheduler will show all the tests that were selected and
are executing and are to be executed.
Q15. What is expert view and keyword view?
Expert View: It contains the steps performed over the application in VBScript language.


Expert view enables us to editing the script.
In keyword view a row exist for each object and method which is mention in Expert View.
Keyword View: contains the steps executed on the application in keyword driven tabular form in English language.


Keyword View contains four fields: ITEM, Operation, Value, and Document.
Selecting items and operation we can create and modify test.
Q16. Describe Synchronization Point.
Synchronization Point: When application response speed is not same as the test execution speed this may cause error. In order to remove this error
we use Synchronization point. Synchronization is done by making QTP test to wait until the application is ready for execution. When we insert
Synchronization point in test then QTP generates the WaitProperty Statement in the ExpertView. For synchronization we can use:




Exist statement
Wait statement.
Increase the defaulted time of QTP waits for web page to load.
Change in default timeout setting.
Q17. Explain checkpoint.
Checkpoint is a point where QTP current value or property of the object with the expected value or property of the object. When we insert the check
point in the test, then in keyword view checkpoint is added in front of current row and in expert view a checkpoint statement is added
Q18. What is Keyword Driven Framework?
In Keyword driven framework the QTP executed script which is written in the excel sheet by help of Driver Script. For making Keyword Driven
Framework we have two ways:


Specify Script Values Directly in the Excel
Write Global Functions to perform action on application as function keywords in Excel.
Q19. What are benefits of QTP?
The benefits of QTP are:








Standalone tool and integrated with Quality Center.
Testing results stores in database automatically, can be used for analyzing system performance.
Supports Key word driven testing.
QTP Identifies objects, even if they change from build to build.
By using QTP, Test execution time and cost will reduce.
Suitable for both client server and web based application
Better error handling mechanism
Excellent data driven testing features
Q20. What are the disadvantages of recording test cases in QTP?
Following are the Disadvantage of recording test cases in QTP



Occupies lot of space result in reducing QTP performance.
Updating test is difficult.
Internal to the QTP, which may cause corrupted.
Q21. What is difference between design time and run time data table?
The differences between Design time and Run time table are:



Design time table are visible in QTP main test but Run time table is visible in Test Result Window.
Design time table is created before the execution of test whereas Run time table is created after execution of test.
Design time table referred to the external data but Run time table represent actual design table in the application.
Q22. What is the process of synchronizing QTP and AUT?
We can synchronize QTP and AUT by applying any one of the following methods:





Wait statement.
Using exit statement
Synchronization point.
Increasing timeout.( tool default synchronization point)
Syn (synchronize method) method
Q23. What is difference between Shared and Local Object Repository?
The difference between Shared and Local Object Repository are:



Shared OR can be shared between multiple tests whereas Local OR can only link with one test.
Shared OR does not allow making changes in the repository but Local OR enable tester to perform change in the object property present in
the Object Repository or adding object in OR.
Mostly used in Keyword Driven methodology. It is saved with .TSR extension where as Local OR is saved with .MTR extension.
Q24. What are the shot cut keys of:
a) Normal Recording: F3
b) Run the test script: F5
c) To stop the recording: F4
d) For Analog Recording:Ctrl+Shift+F4
e) Low Level Recording: Ctrl+Shift+F3
f) To switch between Tree View and Expert View: Ctrl+Tab
Q25. Can we create User Defined Functions in QTP?
Yes we can create User Defined Function. User defined function is used when we want to execute segment of code several time while testing the
application. User defined function can be saved in two ways:


Within Function Library: saved with .qfl file extension.
Within Action Script: saved with .vbs or .txt file extension.
Q26. What is recovery scenario in QTP?
While executing a test, some unexpected error and event may occur. To overcome this we take the help of Recovery Scenario. The Recovery Scenario
Consist of Following:



Trigger Event: when an unexpected events or errors invoke.
Recovery Operation: Operation needed to perform for running the remaining test script.
Post-Recovery Test Run Option: after recovering from unexpected error where to start the remaining test execution.
Q27. What are the steps involved in Recovery Scenario Wizard?
The Recovery Scenario Wizard consists of following steps:




Defining of trigger event
Defining Recovery operation
Selection of Post Recovery Run
Specifying either to associate recovery scenario to the current test or all new test.
Q28. Explain different type of event trigger option.
In QTP, there are following type of trigger:




POP-UP window: QTP identify POP-UP window based on window title and textual content.
Object State: object state is identified by its properties.
Test Run Error: when test run result value is failed it is identified.
Application Crash: this state is identified by predefined list of application.
Q29. What are the different types of Recovery Operation?
Following type of Recovery Operation is available in QTP:




Keyboard or mouse operation.
Close Application Process.
Function call.
Restart Microsoft Windows.
Q30. How to change the priorities of the Recovery scenario properties?
To change the priorities of Recovery scenario we do following step:



STEP 1: SELECT scenario.
STEP 2: Click UP or DOWN button in order to increase and decrease the priorities of the Recovery Scenario.
Repeat STEP 1 and STEP 2 for each scenario.
Q31. Explain Sub Procedure of VBScript.
SUB procedure: it is used only to perform action but has no return value.
-It takes arguments like constant, variable or expression.
-When no argument is given it take empty parentheses ().
-SYNTAX of SUB Procedure:
[Public ] [Default] [Private] Sub name [(arglist)]
[Statements]
[EXIT sub]
[Statement]
End Sub
Q32. Describe Function Procedure in VBScript.
Function procedure: it consists of steps of statements written in VBScript with some return value.





Function statement is used to declare name, argument and code.
When no argument is given it take empty parentheses ().
Name is used to return the value.
SYNTAX of Function Procedure:
[Public][Default][Private] Function name [(arglist)]
[Statements]
[name = expression]
[Exit Function]
[Statements]
[name = expression]
End Function
Q33. Explain Calling Sub procedure.
Calling Sub procedure is used to call Function and Sub Procedure.
SYNTAX of Calling Procedure:


Call procname( firstarg, secondarg)
Procname firstarg, secondarg
Both Syntax are correct. First syntax use the CALL keyword, when we use CALL keyword then it is mandatory to write the argument in parentheses.
Q34. How to remove associated Function library?
Ans. To remove the associated Function Library we can perform any one of the following method:



METHOD 1:
- Select Resource Pane.
- Right click on function library, select Remove Function Library.
METHOD 2:
- Select Resource Pane,
- Select Function Library.
- Press DELETE key.
METHOD 3:
- Go to list of Associated Function Library in the Resource Pane.
- Select the Function and click the Remove button.
Q35. Give the Syntax to load Function at run time.
Syntax to load the function at run time:
LoadFunctionLibrary strCurrentLibPath + “DialogCrashChecks.qfl”, strCurrentLibPath + “DialogL18nChecks.qfl”
Q36. What is Regular Expression?
The Varying window labels problem can be solved by using the regular expressions. Regular expressions enable QTP to identify objects with varying
names or titles. We can use regular expressions in Test Script Language statements. A regular expression is a string. Regular expression is followed
by an exclamation mark. We use special characters such as a period (.), asterisk (*), caret (^), and brackets ([ ]), by this we can generate the conditions
of the search. For example, the string “!hit.*” matches both “chit” and “hit”.
Q37. What are the different attribute used with Regular Expression?
The different attribute of Regular Expression are:





Backslash(\): when it is encountered the next character is treated as literal character.
Period(.): is used to search any single character.
Square Bracket[ ]: is used to search a single character within a list of characters.
Caret(^): is used match any character in the list except those specified in string.
Asterisk(*): to match zero or all occurrence of the preceding characters.
Q38. What is difference in Global and action sheet in QTP?
Global Sheet: Globally accessible by all tests. Used when we have to perform many actions by using single script.
Action Sheet: Locally accessible in a test. It is used when only one action is performed with one script.
Q39. Explain XML Checkpoints.
XML Checkpoints are used for the verification of the current and expect value or properties of the XML documents. A checkpoint fails when actual and
expected values or properties are not same. QTP enables us with three types of XML Checkpoints:



XML Web Page or Frame Checkpoints.
XML File Checkpoints.
XML Test Object Checkpoints.
Q40. How to modify the Text Checkpoint?
To modify the Checkpoint in QTP we do



Go to Keyword View, Right-Click the Checkpoint.
Select Checkpoint Properties.
Checkpoint properties dialog box open, change the setting.
Q41. What is Smart Identification?
Smart Identification properties are used to identify the object even when object properties are changed. It uses two types of properties to identify the
object in the application:


Base Filter Properties: this is the fundamental property of the object, whose values cannot be changed.
Optional Filter Properties: Properties other then fundamental properties are used in this. These properties are changing while performing
the test on the application.
Q42. What is the use of Ordinal identifier in QTP?
Ordinal Identifiers are used to initialize the value to the object which is in numeric form and it is used to find out its order with respect to other objects.
QTP enable us with following types of Ordinal Identifiers:



Index: indicates the order of object.
Location: determine the location of the object like inside the parent window, frame or dialog box relative to other objects.
Creation Time: determine the order in which web browser open.
Q43. How to delete an object from the Object Repository?
To delete an object from the repository:



Go to repository tree, select the object.
Click the Delete button or select Edit> Delete.
Click Yes to confirm.
Q44. What is Cross Site Scripting?
Cross Site Scripting is a thread in the dynamic website. It is also known as XSS. Cross site scripting occurs when a web application gathers malicious
data from a user. The data is collected in the hyperlink form which contains malicious content within it. It allows malicious code to be inserted into the
web page. The web page can be a simple HTML code or a client side script. When the malicious code is inserted in page and clicked by some user,
the malicious code becomes a part of the web request of the user. This request can also execute on the user’s computer and steal information.
Q45. What is contained in the Object Repository?
Object Repository stores the element identification properties extracted from the application during recording. ID will be generated for each element
and this ID is used for Object identification in the application. Object Repository acts as a repository for the application elements. Object Repository
contains two properties of each object for the identification:


Physical properties description of the object
Logical name of the object.
Download