QTP Stands For QuickTest Professional, A Product Of Hewlett Packard (HP). This Tool Helps Testers To Perform An Automated Functional Testing Seamlessly, Without Monitoring, Once Script Development Is Complete.
1.Which environments are supported by QTP?
QTP supports the following environments
2.What are the types object Repositories in QTP.
QTP Supports 2 types of Object Repository
1) Shared Object Repository (also called Global)
2) Per-Action Object Repository, (also called Local)
Per-Action Object Repository is used by default. The extension for Per-Action repository is ".mtr" .
JOBSMATE.COM
Shared Object Repository is preferable while dealing with dynamic objects which are called in multipleThe extension is ".tsr"
3.Can we call QTP test from another test using scripting. Suppose there are 4 tests and I want these tests in a main script. Is this possible in QTP?
Yes. You can call 4 or even more scripts in your tests. For this, first you will need to make the Actionscorresponding scripts re-usable. Then from the destination script you can make calls to these re-usable
4.What is action split and the purpose of using this in QTP?
Action split is to divide an existing action into two parts. The purpose is to divide actions based on theirfunctionality to improve code re-use.
5.How will you handle Java tree in QTP ?
Foremost you will select Java Add - In and launch QTP. Next step record operations on the Java Tree. anissue while recording, you can select Tools > Object Identification > Java, tree object and make changesmandatory and assistive properties to enable identification.
6.Explain how QTP identifies object ?
QTP identifies any GUI Object based on its corresponding properties. While recording, QTP will identifystore peculiar properties (as defined in the Object Identification settings) in the object repository of object .At run-time, QTP will compare the stored property values with the on-screen properties, to identify theGUI object.
7.How many types of recording modes in QTP? Which will be used when ?
QTP supports 3 types of recording modes
1. Normal mode also called Contextual
2. Low-level recording mode
3.Analog mode
Normal Mode: It is the default recording mode and takes full advantage of QTP's Test Object Model.recognizes objects regardless of their position on -screen. This is the preferred mode of recoding and formost of the automation activities.
Low-level recording mode: This mode records the exact x,y co-ordinates of your mouse operations. intesting hashmaps. It is useful for recording objects not identified by normal mode of QTP.
Analog mode: This mode records exact mouse and keyboard "movements" you perform in relation screen /application window. This mode is useful for the operation such as drawing a picture, recording signature.,drag and drop operations.
8.How will you call from one action to another action ?
We can call an action in 2 ways
1) Call to copy of Action. - In this ,the Action Object Repository , Script and Datable will be copied todestination Test Script.
2) 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 in the source script.
9.What are Virtual Objects?
Your application may contain objects that behave like standard objects but are not recognized by QTP.define these objects as virtual objects and map them to standard classes, such as a button or a checkemulates the user's action on the virtual object during the run session. In the test results, the virtualdisplayed as though it is a standard class object.
10.How to perform Cross platform testing and Cross browser testing using QTP? Can u explain some example?
You will need to create separate Actions which take care of different OS and Browsers
Cross Platform Testing:
Using the Built in Environment Variable you can dig up the OS information.
Eg. Platform = Environment("OS"). Then based on the Platform you need to call the actions which you onthat particular platform.
Cross Browser Testing:
Using this code Eg. Browser("Core Values").GetROProperty("version") you can extract the Browsercorresponding version. Ex: Internet Explorer 6 or Netscape 5. Based on this value you call the actionsrelevant to that browser.
11.What is logical name of the object?
Logical name is a name given by QTP while creating an object in the repository to uniquely identify otherobjects in the application. This name would be used by the QTP to map the object name in scriptcorresponding description in the object repository. Ex: Browser("Browser").Page("Guru99") Here Guru99logical name of the object.
12.What is descriptive programming?
Typically ,an object and its properties must be recorded in the Object Repository to enable QTP to performaction s on it.
Using descriptive programming , you do not store the object and its property values in the Objectrepository but mention the property value pair directly in the script.
The idea behind descriptive programming is not bypass the object repository but help recognize dynamicobjects.
13.What are the properties you would use for identifying a browser & page when using descriptive programming ?
You can use the name property
ex: Browser("name:="xxx"").page("name:="xxxx"").....
14.Can we record an application running on a remote machine using QTP ?
Yes .you can record remote application provided you are accessing application through the local browservia remoter like citrix. If you are still unable to record it is advisable install QTP and application, on thesame machine
15.Explain the keyword CreateObject ?
Creates and returns a reference to an Automation object
SYNTAX: CreateObject(servername.typename [, location])
Arguments
servername: Required. The name of the application providing the object.
typename : Required. The type or class of the object to create.
location : Optional. The name of the network server where the object is to be created.
16.Can you switch between Per-Action and Shared Object Repository ? If yes how ?
Yes .We can switch. Go to Test--->Settings--->Resources. Here you have an option to choose repositories.
17.What is Object Spy ? How to Use it ?
Object Spy helps in determining the run & test time object properties & methods of the application Youcan access object spy directly from the toolbar or from the Object Repository Dialog Box. It is very usefulduring Descriptive Programming
18.When ordinal identifiers alone can make an object unique then why they are not given top Why it is first mandatory and next assistive. Why we cannot go for ordinal identifiers directly?
Consider the following -
a) If two objects are overlapped on each other than location based object recognition will fail.
b) If only index based recognition is used your script will work but script execution time will increase. Hencemandatory and assistive properties are used.
19.What is the file extension of the code file in QTP?
Code file extension is script.mts
20.Explain in brief about the QTP Automation Object Model.
QTP Automation Object model deals with Automation of QTP itself. Almost all configuration andfunctionality provided by QTP is represented by QTP's Automation Object Model . Almost all dialogboxes in QTP corresponding automation object which can set or retrieved using the correspondingproperties or the Automation Object Model.QTP Automation Objects can be used along with standard VBprogramming elements like iterative loops or conditional statements to help you design a script of choice.
21.What is the use of Text output value in QTP?
Text Output values enable you to capture text appearing on the application under test during run-time.
If parameterized, text output values will capture values appearing in each iteration which would be therun-time data table for further analysis.
22.What is Step Generator?
Step Generator enables use to Add Test Steps in your script. Using step generator you can add steps scriptwithout actually recording it.
23.How to make QTP understand the difference amongst the same type of objects .Suppose 5 check boxes in a page and I have to choose the 2nd one, how to do that through script?
You can use ordinal identifiers like index along with a little descriptive programming for objectrecognition
24.What is Test Fusion Report ?
Test Fusion Report , displays all aspects of a test run and is organized in a Tree format.
It gives details of each step executed for all iterations.
It also gives Run-time data table, Screen shots and movie of the test run if opted.
25.How can you handle exceptions in QTP?
In QTP Exceptional handling is done by using
a. Recovery Scenarios.
b. Using “On Error” statement
In Recovery scenario you have to define.
1. Triggered Events.
2. Recovery steps.
3. Post Recovery Test-Run.
At Script Level you can use the On Error Resume Next and On Error Go to 0 statement.
26.What are the types of environment variables in QTP ?
Environment variables in QTP are of three types:
1) Built-in (Read only)
2) User-defined Internal (Read only)
3) User-defined External (Read/Write)
You Set the Environment Variable using the following syntax
Environment.Value( "name") = “XXXX"
You can Retrieve the Environment Variable using following syntax
Environment.Value("name") -- This will return name as XXXX
Environment.Value("OS") -- This will return your system OS
27.What is the Difference between Bitmap Check point & Image Check point?
Bitmap checkpoint does a pixel to pixel comparison of an image or part of an image.
Image checkpoint does do a pixel to pixel comparison but instead compare image properties like altdestination url etc.
28.What is the difference between functions and actions in QTP?
Actions have their own Object Repository & Data Table. Actions help make your Test modular andincrease reuse. Example: You can divide your script into Actions based on functionality like Login, Logoutetc.
Functions is a VB Script programming concept and do not have their own Object Repository or DataFunctions help in re-use of your code. Ex: You can create a Function in your script to concatenate
29.What is keyword view and Expert view in QTP?
Keyword View is an icon based view which shows test steps in tabular format. It also automaticallydocumentation for the test steps.
Expert View gives the corresponding VB Script statement for every test step in the Keyword view.
30.Explain QTP Testing process?
Quick Test testing process consists of 6 main phases:
1) Create your test plan - This is preparatory phase where you identify the exact test steps, test data expectedresults for you automated test. You also identify the environment and system configurations to create andrun your QTP Tests.
2) Recording a session on your application - During this phase , you will execute test steps one by one AUT,and QTP will automatically record corresponding VB script statements for each step performed.
3) Enhancing your test - In this stage you will insert checkpoints , output values , parameterization ,programming logic like if…else loops to enhance the logic of your test script
4) Replay & Debug - After enhancements you will replay the script to check whether its working properlydebug if necessary.
5) Run your Tests - In this phase you will perform the actual execution of your Test Script.
6) Analyzing the test results - Once test run is complete, you will analyze the results in the Test Fusiongenerated.
7) Reporting defects - Any incidents identified needs to be reported. If you are using Quality Center can beautomatically raised for failed tests in QTP.
31.What are the different types of Test Automation Frameworks ?
The types of Automation Frameworks are -
1) Linear Scripting - Record & Playback
2) The Test Library Architecture Framework.
3)The Data-Driven Testing Framework.
4)The Keyword-Driven or Table-Driven Testing Framework.
32.How will you check a web application for broken links using QTP?
You can use the Page Checkpoint which gives a count of valid/invalid links on a page.
33.What is a Run-Time Data Table? Where can I find and view this table?
Data like parameterized output , checkpoint values , output values are stored in the Run-time Table. filewhich is stored in the Test Results Folder. It can also be accessed in the Test Fusion Report.
34.What is the difference between check point and output value.
Check point is a verification point that compares a current value for a specified property with the expectedvalue for that property. Based on this comparison, it will generate a PASS or FAIL status.
An output value is a value captured during the test run and can be stored in a specified location likeDatable or even a variable. Unlike Checkpoints, no PASS/FAIL status is generated.
35.How would you connect to database using vbscript ?
To connect to the database you must know
a) connection string of your server
b) username
c) password
d) DNS name
You can code the database connectivity command directly or you can use the SQL Query tool provided.
36.What is QTP batch testing tool?
You can use the Batch testing tool to run multiple scripts. Once the scripts are added in the tool , itautomatically open the scripts and start executing them one after the other.
37.What are the drawbacks of QTP?
As of QTP version 10
1) Huge Tests in QTP consume lots of memory and increase CPU utilization.
2) Since QTP stores results in HTML file (and not txt) the result folder sometimes becomes big.
38.What is an Optional Step ?
A step when declared optional is not mandatory to be executed. If the corresponding GUI object is QTPperforms the operation on it. If the GUI object is not present, QTP bypasses the optional step and proceedsto execute the next step.
39.What is Reporter.ReportEvent ?
Reporter.Reportvent is standard method provided by QTP to send custom messages to the test resultsSyntax
Reporter.ReportEvent EventStatus, ReportStepName, Details [, ImageFilePath], where
EventStatus = 0 or micPass
1 or micFail
2 or micDone
3 or micWarning
Results can assume any status like Pass , Fail , Warning etc. You can also send screenshot to the test window.
40.How will you declare a variable in QTP ?
You declare using a DIM keyword. You assign value to the variable using the SET keyword.
Ex. Dim temp 'Will declare the temp variable
Set temp = 20 ' Will assign a value 20 to temp.
41.What is GetRoProperty ?
GetRoProperty is a standard method provided by QTP to fetch property values of a run -time object
42.What is smart Identification?
Typically, if even one of the on-screen object property does not match the recorded object property. fails.
In smart identification, QTP does not give an error if the property values do not match, but uses BaseOptional Filter properties to uniquely identify an object. In Smart identification, if a property value matchthe script does not fail but it proceeds ahead to compare the next property. Smart identification enabled inObject Identification Dialog box.
43.How would you export a Script from one PC to another in QTP ?
We can make use of the "Generate Script" function available in Object Identification, Test Settings andTools/Options tab to create a zip of the script at the source computer. These zip files then can be importedQTP at the destination computer.
44.Can launch two instances of QTP on the same machine ?
No. You can work with only single instance of QTP on the same machine. But QTP itself can work oninstances of the Application Under Test (AUT). Ex: QTP can handle multiple IE browser windows.
45.Give the syntax to import/export xls into QTP.
DataTable.ImportSheet "..\..\TestData\Input.xls",1,dtGlobalSheet
DataTable.ExportSheet "..\..\Results\Output.xls","Global"
46.What is SetToProperty ?
SetToProperty changes property of an object stored in the Object Repository. However these changespermanent.
47.What is the standard timing delay for web based application in QTP ?
The standard delay is 60 seconds. This is can be changed in Test Settings.
48.What is the Action Conversion Tool ?
It is an in-built tool provided by QTP to convert Actions into Business Process Components.
49.What is the extension for a function library ?
The extension is '.QFL'
50.If the Global Data sheet contains no data and the Local Datasheet contains two rows of data, many times will the test iterate?
The test will iterate only once - global iteration.
51.In UFT how you can prevent the system from getting locked?
To prevent system getting locked, any of the two ways can be used
Create a simple vbs file having code to press numlock key and run that vbs file
Edit one registry key “DisableLockWorkstation =1” to disable locking
52.What is descriptive programming in UFT means?
Descriptive programming includes property name and property value. Whenever UFT is facing difficultyidentifying objects from object repository, and instead the object is directly identified from the script asdescriptive programming.
53.What is descriptive programming in UFT means?
54.In UFT explain the difference between qfl and vbs files?
a) qfl is quick test function library file while vbs is Microsoft’s vbscript
b) qfl is a non-executable file while vbs is an executable file
c) To use file in UFT associate qfl file from test setting, while to include vbs file use “execute file
55.How to create TSR file in UFT?
TSR means Test Shared Repository, it is created to share object repository.
To create TSR file, follow the steps
Open object repository
Go to file menu
Go to export local objects option and select it
After that, UFT will ask you to store .tsr file. Give the path and save. This will create .tsr file in UFT
56.How to connect to QC in UFT?
To connect with QC, UFT provides the option to connect QC directly from UFT GUI.
a) Go to file menu
b) Select (QC) quality center
c) You will be asked to - Enter QC url
d) Enter user id, password and project
Following above steps will allow you to connect with QC, later on you can execute the tests from QC
57.What are the types of Automation Framework in UFT?
In order to ease the process of test automation using UFT, test automation is designed. There are types ofautomation frameworks in UFT
58.When we should use descriptive programming in UFT ?
Either through object repository or description programming, UFT identifies objects. Descriptiveprogramming is used in following scenarios
a) It is used to remove duplicate objects. Same objects exists in different screens or windows of application.If you use OR in this case you have to store same object under different object hierarchy deal with suchsituation, descriptive
programming is used
b) It is not appropriate in certain scenarios to store the objects inside OR (Object Repository). Suppose youwant to print 100 links on the page, you should not store all links in OR. Instead you should useDescription Programming to access those links.
59.What is “settoproperty” and when to use it in UFT?
Settoproperty stands for set test object property. You can use this property to change the object valuesruntime. You can edit the property values during the runtime, but the changes that are made are temporary
60.How to find the total number of rows in the webtable in UFT?
There are three ways which we can find the count of rows in the table in UFT
a) Using rowcount property of UFT webtable object
b) Using GetROProperty of UFT
c) Using HTML DOM + UFT
61.Explain in what ways we can export data table to excel in UFT?
To export data-table to excel, there are two methods.
a) DataTable.Export (“C:\export.xls”)
b) DataTable.ExportSheet “C:\mysheet.xls” ( If excel file does not exist, new file is created)
62.In data table sheet in UFT, how to read a value from the cell?
To read a value from the cell, we follow 2 step process
a) We set the row pointer in first step
b) In second step we define the parameter/column name from the sheet to read
63.What are the loops available in UFT and what they do?
There are 3 loops available in UFT
a) Do…..Loop : Do Loop will run a block of statements repeatedly
b) For…..Next : For Next Loop will execute a series of statements until a specific counter value
c) For……Each : In order to execute a series of statements for each statements for each object in “For EachLoop” is used While….Wend Loop : While Wend Loop is used to execute a series of statements as long asgiven condition true
64.What are the types of error need to be handle in UFT?
There are three types of error that one will face in UFT
a) Syntax Errors
b) Logical Errors
c) Runtime Errors
65.What are the ways you can handle run time errors?
There are various ways to handle run time errors
a) Using test settings
b) Using on error statement
c) Using err Object
d) Using Exit Statement
e) Recovery Scenarios
f) Report Object
66.What is the difference between exitaction and exititeration?
Exitaction is used when we want to exit from a particular action, while exititeration is used to exit fromparticular action iteration of an action.
67.In QTP how you can remove the spaces from string?
You can use replace function to remove spaces from string in QTP
Print replace(“ sdsd sd sd s “, “ “,”””)
Output will be sdsdsdsds
Itrim function can be used if only leading spaces from string needs to be removed
Print Itrim(“ sdsd sd s “) à Output will be “sdsd sd s”
You can use rtrim function to remove trailing spaces from string
Print rtrim(“ sdsd sd s ” ) à Output will be “ sdsd sd s”
68.In QTP how you can get the last character from a string?
Code to get the last character of a string in QTP
print right( “junior,1) ‘ à Output will be “r”
75. How to add synchronization points in QTP?
There are 4 ways through which we can add synchronization points in QTP
a) Wait statement : This statement will pause the execution for x seconds until object comes up
b) Wait property : This method will wait until property of object takes particular value
c) Exist statement : This statement will wait until object becomes available
d) Sync method: The code will wait until browser page is completely loaded. For web application method isused.
69.In QTP explain what is crypt object
Crypt object in QTP is used to encrypt a strings.
Syntax
Crypt.Encrypt(“XXXX”)
70.Mention what is the difference between Execute file and load function library ?
In execute file, we can’t debug the statements. With load function library, statements can be debug alsoload multiple library files.
71.Explain how you can find length of array in QTP?
The code to find the length of array in QTP is
print (ubound(arr)+1)
Ubound returns the last index in array- so length of array will be +1. This will be total number of elementsarray
72.In what ways you can call from one action to another action?
There are two ways you can call from one action to another action
a) Call to copy of action: In this, the script and data-table, action object repository will be copied destinationTest Script
b) Call to existing Action: In this, script data-table and object repository are not copied instead a referencewould be made to the action in the source script
73.What is Optional step in QTP ? How you can add optional step in QTP?
When running a test, it test fails in opening a dialog box, QTP does not necessarily abort the test run.passes any step designated “optional” and continues running the test. By default QTP automaticallyoptional steps that open certain dialog boxes. In order to set an optional step in the keyword, right select“Optional Step”. The icon for optional step would be added in next step. In the expert view to optionalstep, add optional step to the beginning of the VBScript statement.
74.When ‘option explicit’ keyword is used in QTP?
To specify that all variable must be declared before use in QTP, ‘Option Explicit’ keyword is used.
75.What is ‘Object Spy’ and what is the function of object spy in QTP?
‘Object Spy’ is a feature in QTP by using which you can view both the test and run time object propertiesmethods.
76.In QTP explain what is keyword driven automation framework?
In keyword driven automation framework, the focus is mainly on keywords/functions and not the testmeans the complete focus is on creating functions which maps the functionality of the application