QTP Interview Questions and Answers
Due to its graphical user interface and support for scripting and keyword interfaces, the QTP testing tool is in high demand in the market. Gain expertise with our QTP interview questions and answers, useful for both freshers and experienced professionals.
QTP Interview Questions and Answers for Freshers
1. What is QTP?
An automated functional testing tool is called QTP (Quick Test Professional). The testers can use automated regression testing with this tool to find any bugs or faults in the applications. Additionally, the tool makes a comparison between the expected and actual results.
2. Which terminologies does QTP support?
Terms like Web, WPF, SAP, Java (Core and Advanced), Oracle, Siebel, .Net, Delphi, Power Builder, PeopleSoft, Terminal Emulator, Stingray1, Web Services, Windows Mobile, Flex, VisualAge Smalltalk, Silverlight, and mainframe terminal emulators are among those that QTP supports.
3. Why is breakpoint usage used in QTP?
This is done to allow you to pause your test in the middle of running it. Usually, it’s used to keep an eye on your program’s status or to understand how a particular feature functions during a particular runtime phase.
4. How can the second opened browser be closed?
The browser instance that launched first can be identified by looking at the “creation time” column. Put simply, this is a counter for each browser instance that is launched. For the first one, it starts at zero and goes up from there. To close the second open browser, use the following code:
Browser(“creationtime:=1”).Close
5. What drawbacks does QTP have?
- With QTP version 10, large tests now use a lot of memory and CPU power.
- Because QTP saves outputs in an HTML file rather than a text file, the resulting folder grows huge.
6. What separates expert view from keyword view?
The Keyword View is a symbol-based view that displays test stages in tabular form. Consequently, the documentation for the test stages is generated. Expert View provides a related VB script articulation for each test step in the Keyword View.
7. What does the term “object spy” mean?
Object Spy facilitates the process of selecting the run and test time object properties and methods for the application being tested. You can open Object Spy directly from the Object Repository Dialog Box or the toolbar. When it is advantageous to use descriptive programming.
8. What is the object’s logical name?
When QTP generates an item in the repository, it assigns it a logical name to make it easier for users to identify it from other things in the application. Using this name, the QTP would develop a content strategy for the item name and the related image in the article repository.
9. Define the term “.qrs file” in QTP.
The “Quicktest Recovery Scenario” addon serves as a representation of it. Recovery scenario managers give us the ability to manage special circumstances when running tests. You should store a recovery scenario you create in QTP as a.qrs file. Multiple situations could be detailed in ‘a.qrs’ file.
10. How does QTP identify objects?
QTP recognizes any GUI object based on its pertinent properties. When recording, QTP will look for and store odd attributes (as defined in the Object Identification settings) in the GUI object’s object repository. QTP will match the recorded property values with the on-screen properties to uniquely identify a GUI object during runtime.
11. Which two categories of repositories are there?
There are two kinds of repositories available: shared and local.
Every action has a local repository that contains all necessary objects by default. Alternatively, the tester might store all of their operations in a central repository and distribute the objects within. The shared repository is called a shared OR.
12. Why is action split used in QTP, and what does it mean?
Splitting an existing action into two sections is known as action splitting. To increase code reusability, activities are categorized according to their functionality.
13. Which categories of frameworks are there in QTP?
Among the QTP framework types are
- Linear Scripting
- Test Library Architecture Framework
- Data-Driven Testing Framework
- Keyword-Driven Framework
- Hybrid Framework
14. What distinguishing features does ADODB have?
ADODB.Connection, ADODB.Command, ADODB.Fields, and ADODB.Recordset are some of its characteristics.
15. Which environment variables are there in QTP?
Built-in environment variables (read-only), user-defined internal variables (read-only), and user-defined external variables (read/write) are the three types of environment variables in QTP.
QTP Interview Questions and Answers for Experienced Professionals
16. Describe the term “CreateObject” with an example.
An automation object generates an automation object reference and returns it.
SYNTAX:
CreateObject(servername.typename [, location])
Arguments
servername: required – The object’s provider application’s name.
typename: required – The kind of object to be created, or it’s class.
location: Optional – The name of the network server that has to be used to generate the object.
Example: Set IE = CreateObject(“InternetExplorer.Application”)
17. What types of environmental variables are there in QTP?
Three categories of environment variables exist in QTP:
- Built-in (Read only)
- User-defined Internal (Read only)
- User-defined External (Read/Write)
The syntax to set the environment variable is as follows:
Environment.Value( “name”) = “SLA”
The syntax below can be used to retrieve the environment variable.
Environment.Value(“name”) — This will return the name as SLA.
Environment.Value(“OS”) — This will return your system OS
18. What is Reporter.ReportEvent?
The typical QTP technique for sending personalized messages to the test results window is Reporter.Reportvent.
Syntax
Reporter.ReportEvent EventStatus, ReportStepName, Details [, ImageFilePath]
where
EventStatus = 0 or micPass
1 or micFail
2 or micDone
3 or micWarning
The status of the results might be anything, such as Pass, Fail, Warning, etc. A screenshot can also be sent to the test results box.
19. Describe how to use QTP to read a registry key.
The following example demonstrates how to read a registry key in QTP.
‘Create a shell object
Set MyShell= CreateObject (“WScript.Shell”)
Read the value of key from the registry
RegValue =MyShell.RegRead (varpathofkey)
‘The key’s path in the registry must be passed to the abovementioned function.’
e.g. HKCU\software\ie\settings
msgbox RegValue
20. How can system environment variables be obtained in QTP?
In QTP, there are three methods to obtain system environment variables.
Utilize the WSH shell object.
- Use the Win32_Environment Class from WMI.
- Obtain variables from the registry.
Set myShell = CreateObject (“WScript.Shell”)
WScript.Echo myShell.ExpandEnvironmentStrings( “%PATHEXT%” )
myShell=Nothing,
Output: .BAT;.CMD;.VBS;. VBE;. JS;. JSE
Other user variables supersede their equivalent system variables, such as TEMP.
Set myShell = CreateObject( “WScript.Shell” )
WScript.Echo myShell.ExpandEnvironmentStrings( “TEMP=%TEMP%” )
myShell=Nothing
Output:
TEMP:C:\DOCUME~1\You\LOCALS~1\Temp
21. Mention the procedures needed to send mail from Outlook in QTP.
In QTP, to send mail from Outlook,
Set Outlook = CreateObject (“Outlook.Application”)
Dim Message ‘As Outlook.MailItem
Set Message = Outlook.CreateItem(olMailItem)
With Message
.Subject = Subject
.HTMLBody = TextBody
.Recipients.Add (aTo)
Const olOriginator = 0
.Send
End With
22. Describe how you can use QTPto retrieve data from a database.
The code below must be followed to retrieve data from the database in QTP.
Set db= createobject (“ADODB.Connection”)
db.Open “Provider=Microsoft.Jet.OLEDB.4.0;Data Source=G:\SLA\vb6\admission_project.mdb;
Persist Security Info= False”
Set rst=createobject(“ADODB.Recordset”)
rst.Open “select*from Course”, db, 3
id=rst. RecordCount
For i=0 to id-1
Print rst.field (0) & rst.fields (1) & rst.fields (2) & rst.fields (3)
rst.Movenext
Next
Conclusion
We covered significant QTP interview questions and answers in this post, ranging from simple to complex. We hope it is helpful to everyone. Join us to learn the best QTP training in Chennai.