QTP Interview Questions and Answers Part 2 – Are You Ready?

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

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:

Browser(“creationtime:=1”).Close

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)
Msgbox Obj.Count

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?

Yes

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.

More information is available in the tutorial #2 and #12.

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.




28 comments ↓

#1 Kiran Kumar

thanks for answering my question. I can see most of the questions covered in this.

#2 teju

how will you send a report in a recovery scenarios after a function call?

#3 Tien

Thanks for your post. It helps me so much. Hope to see some more helpful posts of your.

#4 Partap

Where top download latest version of QTP for Free ?

anybody could help ?

#5 Swati

@Partap: We have included a link to download the latest version for a 30 day trial for free in our first article. That might help you to get started

#6 mustafa

1.write a program How can you check the data in the web page content or web list box data are ascending or descending order.. ?
2. which one is the best descriptive programming or object repository ?
3. can you tell me most interesting thing about your project ?
4. tell me about your project manager’s good and bad things?

#7 mustafa

write a function and in the argument pass one input and one output ?

#8 Swati

@mustafa: most of the answers to your questions are dealt with in our articles. Please take a look at them and let us know in case you have any more questions.
Some of your questions are very project specific and we have discussed how to answer them in QTP interview questions part 1 article.

#9 Swati

@Teju: These are error codes available for you that you can use to send in a report. You can either send them to test results or invoke an email app. The codes are err.number and err.description.

#10 Sri

The answer for the first question is as below :

What are advantages of test automation?

Time – It produces quick results
No Manual intervention
Cost effective
Not prone to human errors

My question is why not prone to human errors. If we write the code wrong, definitely should prone to human error.

#11 Swati

@Sri: You are correct. If you write code incorrectly, the chances of you finding it out are more. I mean, you would not execute wrong code over and over again, right? So some where you are bound to find it before it is too late.

For example, if you are doing a string comparison for strings “bald” and “bold”- a human being may overlook and read them as the same but the QTP code would not make a mistake like that.

I hope that helps!

#12 Irfan

The answers given are very simple and clear. Thanks

#13 Shubhangi

thnkx….

#14 deepa

Where top download latest version of QTP for Free ?

anybody could help ?

#15 Ashu

For QTP learning knowledge of VB is essential or everthing could be easily managed through knowledge of VB Script only ??

#16 manik dhule

Where top download latest version of QTP for Free ?

anybody could help ?

#17 amol z

Que. in web application dynamic objects changing so how to handle with dynamic objects with out index property any other way to handle them.

#18 RAMESHBABU BATHULA

Please tell me link of free 30days trial version for practice
this help brings me to good position.

#19 sunny

When i am record date object from 1travel site…at the time of excution i am getting Error “Object is disabled” and the code is:
Browser(“Online bus booking, online”).Page(“Online bus booking, online”).WebEdit(“from_city”).Set “vijayawada”
Browser(“Online bus booking, online”).Page(“Online bus booking, online”).WebEdit(“to_city”).Set “bangalore”

Browser(“Online bus booking, online”).Page(“Online bus booking, online”).WebTable(“name:=from_city”).WebEdit(“name:=date_Of_Journey”).Set “15-MAY-2014”

please solve this issue and send to mail id : sunnyvictory.sv@gmail.com

#20 Sridevi

I am getting an error when am running one program i don’t like to stuck up in the middle. I would like to execute the program until last line. Whats the syntax we need to follow for this

#21 Reza

In QTP whatever automation you have done what are component of those?

#22 gowtham

i cant automate the operations on gmail
i.e deleting unstared mails even using index

#23 Chandra

Thanks for your question. it was useful to refresh.

#24 Rajesh Darwai

which one is the best descriptive programming or object repository ?

#25 mona

I want dumps to give ma certification

#26 srinivasan

Hi Friends,

Please send me Manual or QTP walkin in bangalore….and I want QTP VB script videos, please send me below mail Id srisrini1990@gmail.com
Mobile Number 9738224292

#27 Madhavi

Dear Friends, Could you please help me out how to automate Mobile application in QTP, I heard about perfocto tool, How it works could you please brief me about this

#28 raja

What kind of detail you need to implement a framework

Leave a Comment