Last week we completed our 25 part QTP online training series. Many readers have benefited from this series and I’m sure this will be the key online resource for many QTP learners.
If you have already prepared for QTP and now want to start appearing for interviews, here is the part 2 of our QTP Interview Questions and Answers series. This covers most of the basic and advanced questions asked by the readers which are helpful for freshers as well as experienced candidates. So check if your question is completely answered or not.
Please refer below link for part 1 of useful tips to prepare for QTP interview along with 20 frequently asked QTP questions:
QTP Interview Questions and Answers (Part 2)
1) What are advantages of test automation?
- Time – It produces quick results
- No Manual intervention
- Cost effective
- Not prone to human errors
2) If the objects hierarchy is changing from build to build, then how you will handle that condition?
In this case descriptive programming can be used instead of having an OR. Even while descriptive programming try to use regular expressions to identify the unique property of the objects.
3) I have developed and executed a script successfully, and saved the same to QC. When I tried to execute the script from QC, the script is not executing. What are the possible reasons?”
1) Firstly, QuickTest Add-In for Quality Center has to be installed.
2) In the QTP Tools > Options >run tab you should have ‘Allow other Mercury products to run tests and components’ selected.
3) Make sure you are running QTP as an Admin
4) All the test resources have to be in the correct path
4) What is the extension of QTP local Repository? If it is .mtr then what is .bdb extension stands for?
.bdb is the local OR. .mtr is a binary file that contains other information about checkpoints and all. To re-verify the .bdb is the OR, try to rename the file with the extension as .tsr and open it from ORM. The same objects in the OR will be displayed here. The same will not work if you try it on .mtr file.
5) What is virtual object?
A virtual object is a non-standard object that is instructed by the tester via QTP to behave like a standard one. More details in the tutorial #23
6) How do you capture tool tip using QTP?
Tool Tip capture method varies depending on the type of object this tool tip appears for. It could be for links, images or any other web elements.
For web elements use: Object.title property.
For image: Image(“some name”).GetROProperty(“alt”)…..etc.
7) How can you close the second opened browser?
You can know which browser instance was opened after another can be known by using the “creation time” property. In simple terms, this is nothing but a counter for each browser instance that gets launched. For the first one, it is 0 and gets incremented from then on. To close the second opened browser, you can use the following code:
8) How do know the number of browsers opened?
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(“micclass”).Value = “Browser”
Set BObj = Desktop.ChildObjects(ObjectBrowser)
9) What is synchronization point in QTP?
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. More information in tutorial #24.
10) What is reusable action?
An action that can be called multiple times within or outside the same test is called reusable action. By default all actions are reusable. More information in tutorial #21.
11) Why do we use breakpoints in QTP?
This is to stop the execution of your test at a certain point while its running. Typically it is used to observe the state of your application or to understand how a certain feature works at a certain phase at runtime. (The checking is of course a manual step.)
12) What is throw object?
VB Script does not have any specific throw object. (At least to the best of my knowledge) This question will not come up unless a specific add-in that supports this feature is explored.
13) How do you know the location Id of an object if you know its index id?
Location is the position of the object from left to right and top to bottom within the parent window, frame, or dialog box relative to other similar objects.
Index Id: is the order in which the object appears in your AUT relative to other similar objects. E.g if you have 2 links, then index id=0 will be first link and index id=1 will be the second link.
The answer to this question is entirely dependent on where the object lies, whether it is within the same parent or not.
14) What test cases you can automate using QTP?
As an automation enthusiast I would say, you can automate anything. It is only limited by your imagination and expertise. However, in case you need to understand the look, feel or human reaction to a certain feature, then that is not possible. This is the case with any tool, not specific to QTP.
15) How to handle Java tree in QTP?
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.
16) How to give call to another action from one action?
Calling one action from the other can be done by “Inserting a call” to an existing action or by creating a new action. Please refer tutorial #21 for detailed explanation.
17) How to find Operating system information using QTP script?
You can do that with the help of environment variable. The exact variable is, OS and OSVersion is for the version information.
18) How you can identify browser and its information using QTP script?
You can identify and act on any browser that you opened again by referring to its ‘creationtime’ property and use it like you would with a browser object in your OR.
19) How are actions and functions different in QTP?
Actions have their own Datatables and OR, but functions don’t. More importantly, Functions are a VB Scripting element, not only applicable to QTP. Please refer article 21 a detailed explanation of these.
20) Explain how to use QTP to check broken links on a page?
Page checkpoint. You can incorporate this page checkpoint on every page to check for broken links. To do so, you can go to Tools->options->Web->Advanced and choosing the option to check for broken links automatically on every page QTP accesses. More information in the tutorial #15.
21) Can we run multiple QTP scripts one after the other without manual intervention? How?
Yes. To do so, you will have to create a batch file using the batch runner tool and information about the same is available in tutorial #23.
22) Explain process of smart Identification in QTP
If the recorded description does not enable QTP to identify the specified object in a step, and a smart identification definition is defined (and enabled) for the object, QTP tries to identify the object using “Smart identification”. For more information please refer to the article number: 23
23) When to use shared and local object repository?
The decision is completely up to you. Shared OR will make more sense when you have multiple scripts referring to the same objects.
24) What are the advantages of Object Repository?
OR is an inbuilt feature provided by QTP to store your test objects. There are many advantages and the most important one is that it is a mandatory element unless you are going for descriptive programming.
More information on OR in tutorial #22.
25) In Hybrid framework, data can accessed through database, excel file, XML etc. Is it true?
Yes. Any of the mentioned data sources are permissible.
26) How to associate function library at run time?
1. You can do so by using the “LoadFunctionLibrary” method. LoadFunctionLibrary “Completepath”
2. You can also use the ExecuteFile method. ExecuteFile “Completepath”
27) Hybrid framework can be implemented for any application. Is it true?
28) Hybrid framework supports Descriptive programming. Is it true?
Yes. Frameworks are mostly based on how and where you want your test assets to be placed and how they are to be accessed for maximum efficiency. They do not restrict how you write you test itself.
29) What are the advantages of Hybrid framework?
Hybrid framework is nothing but a combination of frameworks that make you arrive at a solution for your testing needs by taking what works best for your scenario. The obvious advantage is the versatility. It can be tailored to meet any testing project’s need.
30) What is Procedure or Subroutine in VB Script?
Sub procedure is a series of VB Script statements (enclosed by Sub and End Sub statements) that perform actions but don’t return a value. A Sub procedure can take arguments (constants, variables, or expressions that are passed by a calling procedure). If a Sub procedure has no arguments, its Sub statement must include an empty set of parentheses ().
31) Is VB Script Case sensitive or Case insensitive?
It is not case sensitive with respect to command and variable names. Everything else, like strings (text) is.
32) How to record application running on Virtual machine?
You can access and record QTP script as long as the application is available to you via a browser and not by using remote connecting software.
33) What are the factors on which script execution time is dependent?
1. Network and computer speeds. The response time from the app, the database etc. This is true even if you are manually executing the test.
2. It also depends on the wait statements you have included.
3. Not loading the add-ins that your test does not use helps too.
4. Descriptive programming steps take longer than regular ones to execute
5. Capturing screenshots at run time through QTP also consumes time
6. Disabling smart identification also speeds up the QTP script running time
34) What is Test Fusion Report in QTP?
Test Fusion report as the name indicates is a detailed test results that QTP provides in a tree format. It has all the iteration information, data used for each of them along with the standard information.
35) Both Static and dynamic arrays are handled by VB script. Is it true?
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.
36) What is the difference between keyword view and expert view?
They are two ways QTP shows your test. Each one has their own features and caters to users of different levels of expertise.
Keyword view: This is a tabular representation of your test that has the information like the Item, Operation,Data and Comments.
Expert view: This displays your test in terms of the actual lines of code. It is more like a VB Script editor and is used by advanced users.
37) In website, protocol has been changed http: to https what you will do? Tell me your approach?
Since the protocol change does not necessarily affect the UI change, except may be for a warning message about certificates, there are not many changes. All you need to do is provide the new URL and make sure you handle the security related pop-ups.
Hope these questions are useful to prepare for QTP interview. If you come across any new question please feel free to post in below comments. We will try to answer it.
All the best.