Interview Questions for QTP
Q1. Technologies supported by way of QTP.
Ans: 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.
Q2. What are the kinds object Repositories in QTP.
Ans: QTP Supports 2 types of Object Repository
Shared Object Repository (also referred to as Global)
Per-Action Object Repository, (also referred to as Local)
Per-Action Object Repository is used by default. The extension for Per-Action repository is ".Mtr" .
Shared Object Repository is ultimate even as coping with dynamic gadgets which are called in more than one checks. The extension is ".Tsr"
Q3. Can we call QTP check from some other take a look at using scripting. Suppose there are four checks and I want to name those exams in a main script. Is this possible in QTP?
Ans: Yes. You can call four or maybe greater scripts on your checks.For this, first you may need to make the Actions in the corresponding scripts re-usable.Then from the destination script you could make calls to those re-usable moves.
Q4. What is motion break up and the motive of the usage of this in QTP?
Ans: Action split is to divide an present movement into two elements.The motive is to divide movements based totally on their capability to enhance code re-use.
Q5. How will you take care of Java tree in QTP?
Ans: Foremost you may pick out Java Add - In and release QTP. Next step report operations on the Java Tree. If you face an trouble at the same time as recording, you could pick out Tools > Object Identification > Java, tree object and make modifications in mandatory and assistive properties to enable identity.
Tip: You can base you solution on similar lines for another item of any surroundings. For example : If the question is how will take a look at SAP checkbox , You say , first I will pick SAP Add in ... And so forth.
Q6. Explain how QTP identifies item?
Ans: QTP identifies any GUI Object based totally on its corresponding houses. While recording, QTP will perceive and shop ordinary houses (as described inside the Object Identification settings) inside the item repository of the GUI item . At run-time, QTP will evaluate the saved property values with the on-screen houses, to uniquely discover the GUI object.
Q7. How many kinds of recording modes in QTP? Which may be used when ?
Ans: QTP helps 3 varieties of recording modes:
Normal mode also referred to as Contextual
Low-level recording mode
Normal Mode: It is the default recording mode and takes full benefit of QTP's Test Object Model. It recognizes items regardless of their function on -screen. This is the desired mode of recoding and is used for most of the automation activities.
Low-degree recording mode: This mode statistics the exact x,y co-ordinates of your mouse operations. It is beneficial in testing hashmaps. It is useful for recording objects no longer recognized by using ordinary mode of QTP.
Analog mode: This mode data actual mouse and keyboard "actions" you carry out in relation to the display screen / application window. This mode is beneficial for the operation such as drawing a image, recording signature., drag and drop operations.
Q8. How will you name from one movement to another movement?
Ans: We can call an action in 2 approaches:
Call to copy of Action. - In this ,the Action Object Repository , Script and Datable could be copied to the destination Test Script.
Call to Existing Action. - In this, Object Repository , Script and Datable will NOT be copied but a call (reference) would be made to the Action inside the source script.
Q9. What are Virtual Objects?
Ans: Your software may additionally incorporate gadgets that behave like standard gadgets however are not recognized via QTP. You can define those objects as virtual gadgets and map them to traditional lessons, such as a button or a check box. QTP emulates the user's action at the virtual item during the run session. In the check outcomes, the virtual object is displayed as although it's miles a general elegance item.
For instance, assume you need to document a test on a Web page containing a bitmap that the person clicks. The bitmap consists of numerous unique link regions, and each area opens a one-of-a-kind vacation spot web page. When you record a check, the Web web site fits the coordinates of the press at the bitmap and opens the destination web page.
To enable QTP to click on at the desired coordinates during a run session, you can outline a digital object for a place of the bitmap, which includes those coordinates, and map it to the button class. When you run a check, QTP clicks the bitmap inside the location described as a digital item so that the Web web page opens the suitable destination web page.
Q10. How to perform Cross platform checking out and Cross browser testing using QTP? Can u give an explanation for giving some instance?
Ans: You will need to create separate Actions which take care of extraordinary OS and Browsers
Cross Platform Testing:
Using the Built in Environment Variable you may dig up the OS facts.
Eg. Platform = Environment("OS"). Then based totally on the Platform you need to name the moves which you recorded on that unique platform.
Cross Browser Testing:
Using this code Eg. Browser("Core Values").GetROProperty("model") you can extract the Browser and its correspondin version. Ex: Internet Explorer 6 or Netscape five. Based on this value you name the movements which might be applicable to that browser.
Q11. What is logical call of the object?
Ans: Logical call is a name given by way of QTP even as growing an object inside the repository to uniquely perceive it from other gadgets in the application. This name could be utilized by the QTP to map the object call in script with its corresponding description in the object repository. Ex: Browser("Browser").Page("Guru99") Here Guru99 is the logical call of the item.
Q12. What is descriptive programming?
Ans: Typically ,an object and its residences ought to be recorded in the Object Repository to allow QTP to perform motion s on it.
Using descriptive programming , you do now not keep the object and its property values within the Object repository however mention the property value pair at once in the script.
The concept at the back of descriptive programming is not skip the item repository however help recogonize dynamic objects.
Q13. What are the houses you'll use for figuring out a browser & page while using descriptive programming ?
Ans: You can use the call belongings.
We can also use the assets "micClass".
Ex: Browser("micClass:=browser").Page("micClass:=web page")....
Q14. Can we record an utility going for walks on a far off system the usage of QTP ?
Ans: Yes .You could record far off application provided you are getting access to software thru the nearby browser now not through remoter like citrix.
If you're nonetheless not able to file it's far really helpful deploy QTP and application, at the equal gadget
Q15. Explain the key-word CreateObject with an instance.
Ans: Creates and returns a reference to an Automation item
SYNTAX: CreateObject(servername.Typename [, location])
servername: Required. The name of the utility presenting the object.
Typename : Required. The type or class of the item to create.
Area : Optional. The name of the community server wherein the object is to be created.
Example : Set IE = CreateObject("InternetExplorer.Application")
Q16. Can you turn between Per-Action and Shared Object Repository ? If sure how ?
Ans: Yes .We can transfer. Go to Test--->Settings--->Resources. Here you have got an choice to pick repositories.
Q17. What is Object Spy ? How to Use it ?
Ans: Object Spy allows in determining the run & check time item houses & techniques of the application below check.
You can get admission to item spy at once from the toolbar or from the Object Repository Dialog Box.
It may be very useful all through Descriptive Programming
Learn greater about Object Spy
Q18. When ordinal identifiers alone could make an item precise then why they may be no longer given top precedence? Why it's miles first obligatory and subsequent assistive. Why we cannot go for ordinal identifiers at once?
Ans: Consider the subsequent:
If items are overlapped on every aside from location primarily based object popularity will fail.
If only index based totally popularity is used your script will work however script execution time will growth.
Hence mandatory and assistive residences are used.
Q19. What is the report extension of the code file in QTP?
Ans: Code record extension is script.Mts
Q20. Explain in brief approximately the QTP Automation Object Model.
Ans: QTP Automation Object model deals with Automation of QTP itself. Almost all configuration and capability provided by means of QTP is represented by QTP's Automation Object Model . Almost all conversation containers in QTP have a corresponding automation object which could set or retrieved using the corresponding residences or strategies in the Automation Object Model.QTP Automation Objects may be used along with fashionable VB programming factors like iterative loops or conditional statements that will help you design a script of choice.
Q21. What is the usage of Text output price in QTP?
Ans: Text Output values allow you to capture text acting on the application beneath check throughout run-time.
If parameterized, text output values will capture values appearing in every new release which might be stored inside the run-time data desk for further evaluation.
Q22. What is Step Generator?
Ans: Step Generator permits use to Add Test Steps for your script. Using step generator you could upload steps on your script with out honestly recording it.
Q23. How to make QTP apprehend the difference amongst the same sort of items .Suppose there are five test boxes in a page and I need to pick out the 2nd one, how to do that through script?
Ans: You can use ordinal identifiers like index along side a little descriptive programming for item popularity.
Watch a video of this situation.
Q24. What is Test Fusion Report?.
Ans: Test Fusion Report , shows all components of a test run and is prepared in a Tree layout.
It gives information of every step executed for all iterations.
It additionally offers Run-time records table, Screen shots and movie of the check run if opted.
25. How are you able to handle exceptions in QTP?
Ans: In QTP Exceptional handling is done by using using:
Using “On Error” declaration
In Recovery situation you need to define.
Post Recovery Test-Run.
At Script Level you could use the On Error Resume Next and On Error Go to 0 declaration.
Q26. What are the kinds of environment variables in QTP?
Ans: Environment variables in QTP are of 3 types:
Built-in (Read most effective)
User-described Internal (Read simplest)
User-defined External (Read/Write)
You Set the Environment Variable using the following syntax:
Environment.Value( "name") = "Guru99"
You can Retrieve the Environment Variable using following syntax
Environment.Value("name") -- This will retrun call as Guru99
Environment.Value("OS")-- This will go back your device OS
Q27. What is the Difference between Bitmap Check point & Image Check point?
Ans: Bitmap checkpoint does a pixel to pixel contrast of an image or a part of an image.
Image checkpoint does do a pixel to pixel assessment however as an alternative evaluate picture houses like alt text , vacation spot url and so forth.
Q28. What is the distinction between capabilities and actions in QTP?
Ans: Actions have their personal Object Repository & Data Table. Actions assist make your Test modular and increase reuse. Example: You can divide your script into Actions primarily based on capability like Login, Logout and so on.
Functions is a VB Script programming idea and do now not have their own Object Repository or Data Table. Functions assist in re-use of your code. Ex: You can create a Function to your script to concatenate strings.
Q29. What is keyword view and Expert view in QTP?
Ans: Keyword View is an icon based totally view which shows take a look at steps in tabular layout. It also automatically generates documentation for the test steps.
Expert View gives the corresponding VB Script declaration for each check step inside the Keyword view.
Q30. Explain QTP Testing system? -
Ans: Quick Test testing technique includes 7 important stages:
Create your test plan: This is preparatory segment in which you discover the precise check steps, take a look at statistics and anticipated results for you automated test. You additionally perceive the environment and gadget configurations required to create and run your QTP Tests.
Recording a consultation for your application: During this phase , you may execute check steps one after the other for your AUT ,and QTP will routinely report corresponding VB script statements for every step completed.
Enhancing your check In this degree you will insert checkpoints , output values , parameterization , programming good judgment like if…else loops to decorate the logic of your check script.
Replay & Debug: After upgrades you will replay the script to test whether its running nicely and debug if essential.
Run your Tests: In this phase you may perform the actual execution of your Test Script.
Analyzing the check consequences: Once test run is whole, you will examine the consequences in the Test Fusion report generated.
Reporting defects: Any incidents recognized wishes to be stated. If you're usingQuality Center , defects may be automatically raised for failed assessments in QTP.
Q31. What are the exceptional forms of Test Automation Frameworks?
Ans: The kinds of Automation Frameworks are:
Linear Scripting - Record & Playback
The Test Library Architecture Framework.
The Data-Driven Testing Framework.
The Keyword-Driven or Table-Driven Testing Framework.
Learn more approximately Test Automation Frameworks.
Q32. How will you check a web utility for damaged hyperlinks using QTP?
Ans: You can use the Page Checkpoint which gives a remember of legitimate/invalid links on a page.
Q33. What is a Run-Time Data Table? Where can I find and view this table?
Ans: Data like parameterized output , checkpoint values , output values are stored in the Run-time Table. It is an xls report that's stored inside the Test Results Folder. It can also be accessed in the Test Fusion Report.
Q34. What is the difference among test point and output value?
Ans: Check point is a verification factor that compares a modern value for a special belongings with the anticipated value for that assets. Based in this contrast, it'll generate a PASS or FAIL popularity.
An output price is a cost captured all through the check run and can be stored in a certain place just like the Datable or even a variable. Unlike Checkpoints, no PASS/FAIL repute is generated.
Q35. How would you connect to database using VBScript?
Ans: To hook up with the database you need to understand:
connection string of your server
Q36. What is QTP batch testing device?
Ans: You can use the Batch trying out device to run multiple scripts. Once the scripts are added within the tool, it will automatically open the scripts and begin executing them one after the other.
Q37. What are the drawbacks of QTP?
Ans: As of QTP version 10:
Huge Tests in QTP devour plenty of reminiscence and growth CPU usage.
Since QTP stores results in HTML file (and not txt) the result folder occasionally becomes large.
Q38. What is an Optional Step?
Ans: A step whilst declared non-compulsory isn't always obligatory to be executed. If the corresponding GUI object is present, QTP plays the operation on it. If the GUI object isn't always present, QTP bypasses the non-obligatory step and proceeds to execute the following step.
Q39. What is Reporter.ReportEvent ?
Ans: Reporter.Reportvent is popular approach provided with the aid of QTP to send custom messages to the test outcomes window.
Reporter.ReportEvent EventStatus, ReportStepName, Details [, ImageFilePath]
EventStatus = 0 or micPass
1 or micFail
2 or micDone
3 or micWarning
Results can expect any fame like Pass , Fail , Warning and so forth. You can also ship screenshot to the check results window.
Q40. How will you declare a variable in QTP ?
Ans: You claim the use of a DIM key-word. You assign value to the variable the use of the SET key-word.
Dim temp 'Will declare the temp variable
Set temp = 20 ' Will assign a cost 20 to temp.
Q41. What is GetRoProperty?
Ans: GetRoProperty is a preferred method supplied through QTP to fetch belongings values of a run -time object.
Q42. What is wise Identification?
Ans: Typically, if even one of the on-display item belongings does not healthy the recorded item belongings. The test fails.
In smart identification, QTP does no longer give an blunders if the property values do now not match, but makes use of Base clear out and Optional Filter residences to uniquely become aware of an item. In Smart identity, if a property cost does not match the script does now not fail but it proceeds ahead to examine the next assets. Smart identity can be enabled in Object Identification Dialog field.
Q43. How might you export a Script from one PC to any other in QTP?
Ans: We can make use of the "Generate Script" characteristic to be had in Object Identification, Test Settings and Tools/Options tab to create a zip of the script at the supply pc. These zip documents then may be imported into QTP at the vacation spot computer.
Q44. Can release times of QTP at the equal gadget?
Ans: No. You can paintings with handiest single example of QTP at the same machine. But QTP itself can paintings on more than one times of the Application Under Test (AUT). Ex: QTP can take care of a couple of IE browser windows.
Q45. Give the syntax to import/export xls into QTP.
Ans: DataTable.ImportSheet "....TestDataInput.Xls",1,dtGlobalSheet
Q46. What is SetToProperty?
Ans: SetToProperty changes property of an object stored inside the Object Repository. However those adjustments aren't everlasting.
Q47. What is the standard timing postpone for net primarily based application in QTP ?
Ans: The preferred put off is 60 seconds. This is can be changed in Test Settigns.
Q48. What is the Action Conversion Tool?
Ans: It is an in-built device provided by QTP to convert Actions into Business Process Components.
Q49. What is the extension for a characteristic library?
Ans: The extension is '.QFL'
Q50. If the Global Data sheet consists of no statistics and the Local Datasheet consists of two rows of facts, how generally will the check iterate?
Ans: The test will iterate simplest as soon as - global iteration.
Q51. Explain the way to examine registry key in UFT?
Ans: The instance confirmed right here explains how to study registry key in UFT
‘Create a shell object
Set MyShell= CreateObject (“WScript.Shell”)
Read the fee of key from the registry
RegValue =MyShell.RegRead (varpathofkey)
‘in above characteristic we should bypass the course of key in registery’.
Q52. What are the methods in UFT to get device environment variables in UFT?
Ans: There are 3 methods to get device surroundings variables in UFT
Use the WSH shell item
Use WMI’s Win32_Environment Class
Read variables from the registry
Set myShell = CreateObject (“WScript.Shell”)
WScript.Echo myShell.ExpandEnvironmentStrings( "%PATHEXT%" )
The output may be .BAT;.CMD;.VBS;. VBE;. JS;. JSE
Other consumer variable, like TEMP, overwrite their machine counterpart
Set myShell = CreateObject( "WScript.Shell" )
WScript.Echo myShell.ExpandEnvironmentStrings( "TEMP=%TEMP%" )
The output might be TEMP:C:DOCUME~1YouLOCALS~1Temp
Q53. Mention the stairs required in UFT to ship mail from outlook?
Ans: To ship mail from outlook in UFT,
Set Outlook = CreateObject ("Outlook.Application")
Dim Message 'As Outlook.MailItem
Set Message = Outlook.CreateItem(olMailItem)
.Subject = Subject
.HTMLBody = TextBody
Const olOriginator = 0
Q54. Explain how you can fetch facts from database in UFT?
Ans: To fetch statistics from database in UFT, you need to follow the code underneath:
Set db= createobject (“ADODB.Connection”)
db.Open “Provider=Microsoft.Jet.OLEDB.4.0;Data Source=G:guru99vb6admission_project.Mdb;
Persist Security Info= False”
rst.Open “pick out*from Course”, db, 3
For i=zero to identity-1
Print rst.Area (zero) & rst.Fields (1) & rst.Fields (2) & rst.Fields (three)
Q55. What are the codes we can use to get documents from ftp server in UFT?
Ans: To get ftp documents from ftp server, you need to use below code:
put- To store single document on server
get- To download single document from ftp server
mget- To download more than one documents from server
mput- To store a couple of files on server
delete- To delete documents on ftp server
MyShell.Run "%comspec% /c FTP -n -s:" & commandstoworkwithftp & " " & Site, zero,True
Q56. In UFT how you may prevent the gadget from getting locked?
Ans: To prevent gadget getting locked, any of the two ways may be used:
Create a simple vbs document having code to press numlock key and run that vbs file
Edit one registry key “DisableLockWorkstation =1” to disable locking
Q57. What is descriptive programming in UFT manner?
Ans: Descriptive programming consists of property name and belongings fee. Whenever UFT is dealing with problem in figuring out items from item repository, and as an alternative the object is at once recognized from the script is referred to as descriptive programming.
Q58. In UFT explain the distinction among qfl and vbs documents?
qfl is short test characteristic library file whilst vbs is Microsoft’s vbscript
qfl is a non-executable file whilst vbs is an executable file
To use file in UFT partner qfl report from take a look at placing, even as to include vbs file use “execute file statement”
Q59. What is the code to jot down information to text report in UFT?
Ans: To write facts to textual content record in UFT code is:
Content = “Guru99 Rocks”
Set Fo = createobject ("Scripting.FilesystemObject")
Set f = Fo.OpenTextFile ("c:myFile.Txt",8,real) ' open in write mode
Set f = not anything
Q60. How to jot down records to excel report in UFT?
Ans: filepath = “C:BugsReports.Xlsx” Set objExcel = CreateObject(“Excel.Application”) objExcel.Visible= True Set Wb= objExcel.Workbooks.Open (filepath) Wb.Worksheets(1).Cells(1,1).Value = “guru99” examine fee from Excel report.
Q61. How to create TSR record in UFT?
Ans: TSR means Test Shared Repository, it's far created to share object repository.
To create TSR file, comply with the stairs:
Open item repository
Go to document menu
Go to export neighborhood objects alternative and pick out it
After that, UFT will ask you to store .Tsr report. Give the course and keep. This will create .Tsr record in UFT
Q62. How to connect with QC in UFT?
Ans: To connect to QC, UFT affords the choice to attach QC immediately from UFT GUI.
Go to record menu
Select (QC) satisfactory middle
You will be requested to - Enter QC url
Enter consumer identification, password and task
Following above steps will will let you hook up with QC, afterward you may execute the tests from QC itself.
Q63. What are the varieties of Automation Framework in UFT?
Ans: In order to ease the process of check automation using UFT, take a look at automation is designed. There are especially 3 forms of automation frameworks in UFT.
Keyword Driven Framework: It is used whilst more than one capability wishes to be tested.
Data Driven Framework: It is used to check equal glide with distinct take a look at statistics, check facts is given greater importance than a couple of functionality of software
Hybrid Framework: It is a combination of statistics driven framework and keyword.
Q64. When we have to use descriptive programming in UFT?
Ans: Either thru item repository or description programming, UFT identifies items. Descriptive programming is utilized in following scenarios"
It is used to take away reproduction objects. Same objects exists in specific monitors or windows of your software. If you operate OR in this situation you need to save identical item beneath one-of-a-kind item hierarchy in OR. To cope with such state of affairs, descriptive programming is used
It isn't always suitable in certain situations to shop the items internal OR (Object Repository). Suppose if you want to print one hundred hyperlinks on the web page, you have to not keep all links in OR. Instead you should use Description Programming to get admission to the ones links.
Q65. What is “settoproperty” and whilst to apply it in UFT?
Ans: Settoproperty stands for set test object property. You can use this property to alternate the object values at runtime. You can edit the property values all through the runtime, but the modifications which might be made are temporary.
Q66. How to create an array of dictionary in UFT?
Ans: We can create an array of dictionary using syntax
First detail of array
Set ArrayofDictionary(zero)= createobject("scripting.Dictionary")
ArrayofDictionary(zero).Add "key1", "temp1"
ArrayofDictionary(zero).Add "key2", "temp2"
Added keys in first dictionary
Second element of array as dictionary
Set ArrayofDictionary(1)= createobject("scripting.Dictionary")
ArrayofDictionary(1).Add "key1", "temp1"
ArrayofDictionary(1).Add "key2", "temp2"
Added keys in 2d dictionary…..And so on