Qtp Interview Questions And Answers
1. What is the keyword view and Expert view in QTP?
Answer: Quick TestÃ¢â‚¬â„¢s Keyword Driven approach, test automation experts have full access to the underlying test and object properties, via an integrated scripting and debugging environment that is round-trip synchronized with the Keyword View. Advanced testers can view and edit their tests in the Expert View, which reveals the underlying industry-standard VBScript that Quick Test Professional automatically generates. Any changes made in the Expert View are automatically synchronized with the Keyword View.
2. Which environments does QTP support?
Answer: Quick Test Professional supports functional testing of all enterprise environments, including Windows, Web, .NET, Java/J2EE, SAP, Siebel, Oracle, PeopleSoft, Visual Basic, ActiveX, mainframe terminal emulators, and Web services.
3. What is the synchronization point in QTP?
Answer: It is a feature that QTP provides to make your test wait until a certain property on a certain object becomes an expected value before proceeding with the next steps.
4. What are the benefits of QTP?
The benefits of QTP are:
– Standalone tool and integrated with Quality Center.
– Testing results stores in the database automatically can be used for analyzing system performance.
– Supports Keyword 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
5. What are the disadvantages of recording test cases in QTP?
Following is the Disadvantage of recording test cases in QTP
– Occupies a lot of space result in reducing QTP performance.
– The updating test is difficult.
– Internal to the QTP, which may cause corrupted.
6. What is the difference between the design-time and run-time data tables?
The differences between Design time and Run time table are:
– The design time table is visible in QTP main test but Run time table is visible in Test Result Window.
– The design time table is created before the execution of the test whereas Run time table is created after the execution of the test.
– The design time table referred to the external data but Run time table represents the actual design table in the application.
7. What is the process of synchronizing QTP and AUT?
We can synchronize QTP and AUT by applying any one of the following methods:
– Wait for a statement.
– Using the exit statement
– Synchronization point.
– Increasing timeout. ( tool default synchronization point)
– Syn (synchronize method) method
8. What is the 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 enables the tester to perform the 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 whereas Local OR is saved with.MTR extension.
9. What is the short cut keys for the following?
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
10. How does QTP identify the object in the application?
QTP identifies the object in the application by LogicalName and Class. For example, The Edit box is identified by
1.Logical Name: PSOPTIONS_BSE_TIME20
11. What is a Run-Time Data Table? Where can I find and view this table?
Answer: In QTP, there is a data table used, which is used at runtime.
-In QTP, select the option View->Data table.
-This is an excel file, which is stored in the folder of the test created, its name is Default.xls by default.
12. If I give some thousand tests to execute in 2 days what do u do?
Answer: Adhoc testing is done. It Covers the least basic functionalities to verify that the system is working fine.
13. What is QTPro? What is Quick Test Pro? What is a Quick Test Professional?
Answer: Mercury QuickTest provides the industry’s best solution for functional test and regression test automation – addressing every major software application and environment. (online training institute) This next-generation automated testing solution deploys the concept of Keyword-driven testing to radically simplify test creation and maintenance. Unique to QuickTest Professional’s Keyword-driven approach, test automation experts have full access to the underlying test and object properties, via an integrated scripting and debugging environment that is round-trip synchronized with the Keyword View.QuickTest Professional satisfies the needs of both technical and non-technical users. It enables you to deploy higher-quality applications faster, cheaper, and with less risk. To bring non-technical subject matter experts into the quality process in a meaningful way. Plus, it empowers the entire testing team to create sophisticated test suites with minimal training. The deployment of Mercury QuickTest Professional is optimized through the use of Mercury best practices. Mercury best practices cover all aspects of deployment, including product installation and operation, organizational design, process implementation, continual process improvement and measurement of return on investment (ROI). Throughout your implementation Mercury applies these best practices to your specific situation, creating world-class procedures for you that drive long-term success.
14. Question -Can you write a script to check if the folder exists or not?
Set to = CreateObject(“Scripting.FileSystemObject”)
Set fldrext = so.FolderExists(“c:\qtp”)
‘If fldrext contains 1 than folder named qtp exists.
15. What is the Syntax to call one script from another? And what can be the Syntax to call one “Action” in another?
Answer: RunAction ActionName[IterationMode , IterationRange , Parameters]
Here the action becomes reusable on making this call to any Action.
IterationRange String is Not mandatory. Indicates the rows for which action iterations will be performed. Valid only when the IterationMode is rngIterations. Enter the row range (i.e. “1-7”), or enter rngAll to run iterations on all rows.
If the action called by the RunAction statement includes an ExitAction statement, the RunAction statement can return the value of the ExitAction’s RetVal argument.
16. How the exception handling can be done using QTP?
Answer: It can be done by using the Recovery Scenario Manager which provides a wizard that guides you through the process of defining a recovery scenario. The wizard could be accessed in QTP> Tools-> Recovery Scenario Manager
17. How do we analyze the Checkpoint results?
Answer: By adding standard checkpoints to your tests or components, you can compare the expected values of object properties to the object’s current values during a run session. If the results do not match, the checkpoint fails.
18. How do we handle Run-time errors?
Answer: On Error Resume Next: causes execution to continue with the statement immediately following the statement that caused the run-time error or with the statement immediately following the most recent call out of the procedure containing the “On Error Resume Next” statement.
This allows execution to continue despite a run-time error.
You can then build the error-handling routine inline within the procedure.
Using “Err” object msgbox “Error no: ” & ” ” & Err.Number & ” ” & Err.description & ” ” & Err.Source & Err.HelpContext.
19. What are the different scripting languages you could use when working with QTP?
Check this out – If QTP is unable to find any object that matches the recorded object description, or if it finds more than one object that fits the description, then QTP ignores the recorded description and uses the Smart Identification mechanism to try to identify the object. While the Smart Identification mechanism is more complex, it is more flexible, and thus, if configured logically, a Smart Identification definition can probably help QTP identify an object, if it is present, even when the recorded description fails.
The Smart Identification mechanism uses two types of properties:
Base filter properties: The most fundamental properties of a particular test object class; those whose values cannot be changed without changing the essence of the original object.
For example, if a Web link’s tag was changed from to any other value, you could no longer call it the same object.
Optional filter properties: Other properties that can help identify objects of a particular class as they are unlikely to change regularly, but which can be ignored if they are no longer applicable.
20. Technologies supported by QTP?
Answer: Web, Java (Core and Advanced),.Net, WPF, SAP, Oracle, Siebel, PeopleSoft, Delphi, Power Builder, Stingray 1, Terminal Emulator, Flex, Web Services, Windows Mobile, VisualAge Smalltalk, Silverlight, and mainframe terminal emulator.
21. Have you ever written a compiled module? If yes tell me about some of the functions that you wrote?
Answer: Sample answer (You can tell about modules you worked on. If your answer is Yes then you should expect more questions and should be able to explain those modules in later questions): I Used the functions for Capturing the dynamic data during runtime. The function used for Capturing Desktop, browser and pages.
22. How to do the scripting. Are there any inbuilt functions in QTP? What is the difference between them? How to handle script issues?
Yes, there’s an inbuilt functionality called “Step Generator” in Insert->Step->Step Generator -F7, which will generate the scripts as you enter the appropriate steps.
23. How to remove the associated Function library?
To remove the associated Function Library we can perform any one of the following methods:
– Select Resource Pane.
– Right-click on function library, select Remove Function Library.
– Select Resource Pane,
– Select Function Library.
– Press the DELETE key.
– Go to the list of Associated Function Library in the Resource Pane.
– Select the Function and click the Remove button.
Give the Syntax to load Function at run time.
Syntax to load the function at run time:
LoadFunctionLibrary strCurrentLibPath + “DialogCrashChecks.Nfl”, strCurrentLibPath + “DialogL18nChecks.Nfl”
24. What is Regular Expression?
Answer: The Varying window labels problem can be solved by using 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. A regular expression is followed by an exclamation mark. We use special characters such as a period (.), an asterisk (*), caret (^), and brackets ([ ]), by this we can generate the conditions of the search. For example, the string “!hit.*” matches both “chit” and “hit”.
25. How to handle Java tree in QTP?
Answer: You will need to select and load the Java Add-in. Then you can record and work on a Java Tree object just like you would with any other object.
26. How to give a call to another action from one action?
Answer: Calling one action from the other can be done by “Inserting a call” to an existing action or by creating a new action.
27. An action has both shared and local OR associated with it and both have the same object in them. In the test which one will be considered?
Answer: If a local OR and Shared OR have an object with the same name, the action will consider the object in its local OR.
28. Explain different types of action in QTP?
Answer: 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 types 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 a reusable action but stored in the external test. We can call external action but it will be available in the read-only mode we cannot perform any change to the External Action.
29. Are Shared ORs read-only?
Answer: By default, shared ORs open as read-only. To open them to edit them you will have to open them from Object Repository Manager.
30. What is the difference between Run time object and Test object?
The difference between Run time Object and Test object are:
– Run a time objects are an actual object in the application whereas test object is a reference to the actual object.
– Run time object always has the same name whereas the test object name varies in a different environment.
– The test object is used to identify the actual object in the application which is run time objects.
– Run time object resides in the application whereas a test object resides in the object repository.
31. Explain Measuring Transaction?
Answer: Measuring transaction means to measure how much time it takes to execute a set of steps over the application. A transaction is a collection of steps that we are intended to know how much time it takes to execute. We can define the transaction by enclosing the set of steps with the start transaction and end transaction.
– Start transaction: after the encounter of start transaction time measurement starts.
– End transaction: it is used to stop the time measurement.
32. Explain different checkpoints in QTP?
Answer: A 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 checkpoint in the test, then in keyword view checkpoint is added in front of the current row and expert view, a checkpoint statement is added. QTP enable us with the following types of the checkpoint:
– Standard Checkpoint: check properties of objects like button, combo boxes, list, etc.
– Image Checkpoint: check the value of an image
– Bitmap Checkpoint: check image zooming capability.
– Table Checkpoint: check information on a table.
– Text Checkpoint: check text is displayed in the correct place.
– Text Area Checkpoint: check text is displayed in a 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 the content of the database.
– XML Checkpoint: check XML content.
33. What is a Keyword Driven Framework?
Answer: In Keyword driven framework the QTP executed script which is written in the excel sheet by the help of Driver Script. For making Keyword Driven Framework we have two ways:
– Specify Script Values Directly in the Excel
– Write Global Functions to act on the application as function keywords in Excel.
34. Both Static and dynamic arrays are handled by the VB script. Is it true?
Answer: Yes. A static array is declared as Dim A(10). This means it’s an array of 11 items. If the tester needs to modify it to contain 20 items he can do so by using ‘redim’.
redim A(19). There is a “Preserve” statement that can be used in conjunction with the redim statement. When preserve is used all the previous values are not erased.
35. How do know the number of browsers opened?
Answer: To do this you will have to check how many child objects of the type ‘browser’ are present on the desktop. The following is the code that explains it:
Set ObjectBrowser = Description.Create
ObjectBrowser(“misclass”).Value = “Browser”
Set BObj = Desktop.ChildObjects(ObjectBrowser)
36. How to use SetROProperty?
Note: There is no such property in qtp. We have GetROProperty and SetTOProperty but not SetROPro
37. What is the file extension of the code file and object repository file in QTP?
File extension of
Per test object rep: filename.mtr
Shared Object rep: filename.tsr
Code file extension id: script.mts
38. If an application name changes frequently i.e while recording it has the name, in this case, how do QTP handles?
Answer: QTP handles those situations using “Regular Expressions”.
39. There is an excel file of 1 to 100 sheets how you will iterate through it?
A- Set xl=CReateobject(“excel.application”)
set workbook=xl.workbooks(“path of xls file”)
For i=0 to 100
‘do other related things.
40. What is Environment Variable in QTP and why to use it?
Answer: Environment variables are global variables in QTP and they are used to store the global values like User Id, password of the APP. There are 2 types of variables 1. Built-in 2.User Defined.
41. What do you mean by checkpoints in QTP?
Checkpoints are nothing but verification points in QTP. We can verify if a particular property of the object has specified value in checkpoints.
42. What is the difference between byref and byval in QTP?
Answer: You can pass the parameters to function or procedure using byref or by the method.
byref will pass the address of variable but byval will pass the copy of the variable. So when you want the passed value to change, you can pass the value using the byref method. Otherwise, you can pass it using the method.
43. What is the difference between local and shared Object Repository in QTP?
Answer: Local object Repository is associated with a particular activity. While the Shared object repository is independent of action. We can associate the shared object repository to the current test.
44. How to find the path of folder in which the test is saved in QTP?
Answer: To get the path of the test you can access the built-in environment variable called “TestDir”
45. What is the default object synchronization timeout in QTP?
The default object synchronization in QTP is 20 seconds.
46. How to check which add-ins are associated with a test in QTP?
Answer: To see which add-ins are associated with the test in QTP, you have to open the test settings in QTP and then select the properties of the test. There you will find the list of add-ins that are associated with the test.
47. How to find the name of the machine where you are running your automation scripts in QTP?
To get the name of the machine, you can access the built-in environment variable called “Local Host Name”
48. What is the extension of the Recovery Scenario file in QTP?
Recovery Scenarios in QTP are saved in a file with extension .qrs which stands for QuickTest recovery scenario. In one qrs file, you can have multiple scenarios defined in it.
49. How to find the length of the string in QTP?
You can find the length of the string using one vb script function called len.
Suppose you want to find the length of “sunken” then you will have the below statement which will print the length of the string.
50. How to find the difference between 2 dates in QTP?
Answer: You can find the difference between 2 dates using datediff function. You can get the difference in terms of minutes, seconds, hours, months or years.
51. How to associate shared object repository to test in QTP?
Answer: To associate shared object repository you have to go to Resources->Associate Repositories option and then choose and select the .tsr file and associate it with particular or all actions in the test.
52. What is the use of an object spy tool in QTP?
QTP provides one tool called object spy that can be used to find out the properties and the values of the object in QTP.
Note: Browse latest Qtp Interview Questions and Qtp Tutorial. Here you can check Qtp Training details and QTP Training Videos for self learning. Contact +91 988 502 2027 for more information.