1.
What are the advantages of Automation?
a.
Repeatable:-If we have to run a set
of tests repeatedly, automation is preferable.
It
gives you the ability to run automation against code that frequently changes to
catch regressions in a timely manner
It
gives you the ability to run automation in mainstream scenarios to catch
regressions in a timely manner
b. Compatable: - Automated
tests can be run on different machines with , whereas the manual tests would have to be run
sequentially.(different languages on different OS platforms).
c.
Reliable:-
d.
Reusable:-Automated scripts can be
reusable in different environments and different applications on similar functionality.
2. When do you opt Automation?
o
If application is complex.
o
When there are frequent changes in the
requirements or enhancements in the application.
o
When there is lot of Retesting to be done.
o
When we are verifying Compatibility.
3. What are the new features of
QTP 9.5?
Maintenance Run mode:-It
enables to update our tests and repositories at run time.
Checkpoint and output object
repository: All the checkpoints and output values
Properties are stored/captured in the object repository, configuring the
checkpoint and output value properties can be done from the Object Repository.
New repository Options:-we can
drag and drop the object from object repository into test or component, which
will by default generate a script.
4. What are the recording modes
in QTP?
A.
QTP provides three types of recording methods to record operations:
Standard Recording (Normal) mode:-It is the default mode,
which records all operations on application.
Analog Recording Mode: -Records all operations
of mouse and keyboard based on screen coordinates or application coordinates.
Low Level Recording: -We use low level recording to record the
operations of mouse and keyboard operations based on its coordinates.
6. When do you use Low Level
recording?
Quickest
pro.
May not indentify all objects when quickest fails to identify an object during
standard recording and to record operations where exact coordinates are
required. This mode records at the object level and records all run-time
objects as Window or Win Object test objects.
7. What do you mean by standard
and custom objects?
Standard objects are the
objects, which are belonging to all types of applications where as Custom
objects are user-defined objects, which exist in an application.
8. What the different
checkpoints in QTP?
There are
different checkpoints in QTP like
a. Standard Checkpoint
b. Text Checkpoint
c. Text Area Checkpoint
d. Database Checkpoint
e. Bitmap checkpoint
f. Accessibility checkpoint
g. XML Checkpoint
h. Page Checkpoint
i. Table Checkpoint
j. Image Checkpoint
9. Do you use checkpoints in your project?
Yes,
I use checkpoints at the data validations of input domains present in the
application using regular expressions. As a checkpoint verifies that expected
information is displayed in an Application while the executing the test.
10. How do you validate any
property of a Runtime Object?
A. Using standard checkpoint or
Using GETRO property method we can validate properties of every object on the
apllicaton during Runtime
Syntax: variable=Object Type(“Object
Name”).getroproperty(“property name”)
Note: The above will fetch the
property value of an object and will be stored in the variable and if we have
to validate that then we need to write a conditional statement (IF..)
Ex: If you want to check the
enabled property of an object during runtime.
X=Browser(“Yahoo”).page(“Yahoo”).frame(“Login”).image(“Login”).getroproperty(“enabled”)
If X=”True” then
Reporter.reportevent micpass
“Login Image”,”Is Enabled”
Else
Reporter.reportevent micfail,
“Login Image”, “Is Disabled”
11. How do you fetch a property
of a test object from the script during runtime?
A. Using GETTOPROPERTY
Synatx: variable=object
type(“object name”).gettoproperty(“property name”)
EX: To fetch the window id
property of Agent Name which is captured in Object Repository
X=dialog(“Login”).winedit(“Agent
Name:”).gettoproperty(“window id”)
12. How do you fetch all the
properties of a test object from the script during runtime?
A. Using GETTOPROPERTIES
Synatx: set variable=object
type(“object name”).gettoproperties()
EX: To fetch all the properties
of Agent Name which is captured in Object Repository
1.
set X=dialog(“Login”).winedit(“Agent
Name:”).gettoproperties()
Note:
1. While fetching all the properties of a test
object, they should be assigned to an array using a keyword called set and if
you want to access all the properties we need to specify the index value and
the index starts from zero.
2. Both getoproperty and gettoproperties will
work only on the test objects and will or can fetch only the properties
associated with the test objects in object repository, where as gettoproperty
can fetch any property value associated with a runtime object (i.e. the object
on the application during runtime)
13. When a property of an object is changed on
the modified build or what if more than object have more than one objects have
similar properties due to which the script is failing, how do you handle this
situation during runtime without changing the configuration of object
identification.
A. Using SETTOPROPERTY
Syntax: Object Type(“Object
Name”).settoproperty “Property name”, “property value”
Ex: Dialog(“Login”).winedit(“Agent
Name:”).settoproperty “attached text”, “Agent Name:”
14. How do you check the availability
of an object on the application during runtime?
A. Using “Exist” method.
Syntax: variable=object type (“object
name”).exist
Ex: x=dialog (“Login”). Winedit
(“Agent Name:”). exist
Note: It will return true if
the object exists on the application, if not it returns false
15. How do you maximize a
window or screen or page
A. Maximize or fullscreen
Syntax: 1. Object Type(“Object
Name”).maximize
2. Object Type(“Object Name”).maximize
16. How do you minimize a
window or screen or page
A. Minimize
Syntax: Object Type(“Object
Name”).minimize
17. How do you open a window or
screen or page, which is minimized in the launch bar?
A. Restore
Syntax: Object Type(“Object
Name”).restore
18. How do you move a window or
screen or page?
A. Move, by providing the x and
y coordinates
Syntax: Object Type(“Object
Name”).move x,y
19. How do we get the count of
items in a List or a Combobox?
A. Using Getitemscount method
Syntax:
variable=Object type(“Object name”).getitemscount
Ex:
Verifying
no.of items, in "Fly From" Combo Box in Flight Reservation window
z = Window("Flight
Reservation").WinComboBox("Fly From:").GetItemsCount
20. How do we fetch a specific
item from a List or a Combobox?
A. Using Getitem()
Syntax:
variable=Object type(“Object name”).getitem(index
number)
Ex:
Fetching a specific item, from a "Fly
From" Combo Box in Flight Reservation window
z = Window("Flight
Reservation").WinComboBox("Fly From:").GetItem(5)
Note: the index value starts
from zero
21. How do we fetch the
complete list of items from a List or a Combobox?
A. Using Getcontent
Syntax:
variable=Object type(“Object name”).getcontent
Ex:
Fetching all the items, from a "Fly
From" Combo Box in Flight Reservation window
z = Window("Flight
Reservation").WinComboBox("Fly From:").Getcontent
22. How do we the text
displayed on the runtime object
A. Getvisibletext()
Syntax: variable=Object
Name(“Object type”).getvisibletext()
Ex: x=window(“Flight
Reservation”).winedit(“Name:”).getvisibletext()
23. What are Test objects and
run time objects?
Test objects are stored representations of the actual
objects on an application. QuickTest creates test objects by learning a set of
the properties and values of the objects on an application.
Run-time
objects are
the objects that are available on Application Under Test.
24. How do you add objects to
object repository?
A. We can add objects to object
repository in two ways:
i) From
Object Repository:
Navigation: Resources à Object Repository à Object à Add objects to local
ii) From Active Screens:
Navigation: Right click on the object in
activescreens and select view/add object.
25. How do you add objects to
object repository when the application is not available?
A. By creating a new test
object
Navigation: Resources à Object
Repository à Object à Define New Test Object
26. How do you convert the
local objects as reusable objects?
A. By exporting the local
objects from object repository and storing them in shared repository file.
Navigation: Resources à Object
Repository à File à Export Local Objects
27. What is the file extension of shared
Repository file?
A.
.tsr à
Test shared repository
28. How do you associate shared
object repository to an action?
Navigation: Edit à Action
à Action Properties à Associate Repositories
29. How do you assosiate shared object
repository for multiple actions in a test?
A. Navigation: Resources à Object Repository à Tools à
assosiate Repositories
30. How many actions you can
create in a test?
A. There can be any number of
actions created in a single test.
31. What are the action
properties and test properties?
A. Action properties are the
properties for the current action only, where as test properties belonging to
total action properties in the current test.
32. What are the methods
associated with actions in reusing the actions
A. 1) Call to Copy of Action
2) Call to Existing Action
33. What is difference between
subroutine and function?
A. Subroutine doesn’t return
any value where as function returns a value.
34. What is difference between
passing parameters to functions as ByVal and ByRef?
A. Using ‘Call by Val’ values can be passed
directly to variables where as ‘Call ByRef’ values can be passed based on the
reference.
35. What is Option Explicit?
A. When
used, makes mandatory to declare the variables in the script using a DIM
(Dimension) statement.
36. How do you perform
exception handling in QTP?
A. I) By using recovery Scenarios
II) On error
resume next, it is to skip the line and goto next line in the script and On
error goto 0, it is to disable the exception handling process.
When an error is
occurred during the test execution the error details can be captured, by using err.
Description and we can capture the error number by using err.Number
37. What are the run modes in
QTP?
In QTP9.5 we have 3 run modes
§
Normal Run Mode
§
Update mode Run Mode
§
Maintainence Run Mode
38. When you use for example wait (10); &
default time in QTP is 20 seconds; if object is not found then how many seconds
the script will wait?
A. It waits for 10 seconds at wait statement and
waits for 20 seconds if the object is not available and then throughs an error.
39. What is the meaning of
below statement?
Browser("brname").
page("Pgname").sync
40. What is the syntax for the wait property?
A. Object
type(“object name”).waitproperty “Property name”, “Property value”, “time in
seconds”
41. What is the file extension of a bitmap
checkpoint?
A. .png or .bmp
42. What do you mean by call to
copy of action and call to existing action?
(i) We can call both normal and reusable
actions using call to copy an action and the called action canbe edited.
(ii) We can call only the reusable actions using
call to existing actions and these are considered as external actions, which
are non editable.
43. How do you convert a normal
action into reusable action?
A. Edit menuàActionàAction
PropertiesàGeneralàReusable Action
(Or)
In Test Pane Right clickàAction Propertiesà
General à Reusable Action
44. How do you edit objects in shared object
repository?
A. Slecect Object Repository
Manager from Resources Menuà Open
the Shared repository file à Select
Enable editing option à then
we can edit objects asper requirements.
45. What is debug viewer?
A. To view the variable values during
execution of the script, change variable values during runtime. Etc
46. How do you use watch
expression?
A. It is to monitor the
specific variables declared under Watch during runtime. In Watch the value that
is passed to a variable in the script will be captured.
47. During running the program,
there is an uninterrupted expectation from the application, which stopped QTP
script execution, how do you handle?
A. Before the start execution
of a test batch I raise test run error trigger event and select the recovery
scenario as ‘restart the testrun’ so that the testscript sart execution again.
48. What is step generator?
A. We can insert functions in the script from
step generator, insert menu-à step à step generator à select
the categoryà select the function à specify the parameters à ok
49. What is the extension of
QTP Script file?
A. .mts(mercury test script)
50. Suppose there are 5 actions
in a test, if you want to run only 3,5 actions how do you do?
A. Save the testàopen the saved test folderàopen the Action0 folderàopen(click on edit) the script fileàthen Commentize the Action1,2,4à Save the fileàopen
the test file on QTP& Run the test.
51. What is the extension of
Local object repository?
A. .mtr(mercury test repository)
52. What is the extension of
shared object Repository?
A. .tsr(test shared repository)
53. What is the extension of
library file?
A. When we creates &
saves a library file it saves with the
extension “.vbs(vbscript file)”
54. How do you return a value
from a function?
A. By selecting call by return value in function
definition generator in insert menu.
55. What is the syntax to
define a function?
A. Public function function
name(parameters)
----
---
End Function
56. Can you write script to
login; suppose browser name is b1, page nameis p1, userid, password, login
button
A.
browser(“b1”).page(“p1”).webedit(“userid”).set “test”
browser(“b1”).page(“p1”).webedit(“password”).set “test123”
browser(“b1”).page(“p1”).image(“login”).click
57. Few datatable methods
A) i. Addsheet
ii. Deletesheet
iii. Import
iv. Export
v. Importsheet
vi. Exportsheet
vii. Getsheet
viii. Getrowcount
ix. Getsheetcount
x. Setcurrentrow
xi. Setnextrow
xii. Setprevrow
58. How to assosiate a shared
repository to the test through script?
A. Using the utility object
called Repositoriescolletion
Synatx:
RepositoriesCollection.add “path”
59. What is the method to count
number of rows in datatable?
A. x=Datatable.getsheetcount(sheet
id).getrowcount
msgbox x
60. How to add a parameter id
to a specific sheet in datatable during runtime along with the value.
A. Syntax:
variable=datatable.getsheet(“sheet id”).addparameter(“parameter
id”,”value”).name
61. How do you import data from
excel sheet to datatable?
A.Right Clickon DataTableà Click on SheetàImportàFrom fileàBrowse
the Path
Or
Use Import method of datatable
Syntax: datatable.import “Path”
62. How to fetch the value from
6th row and 6th column in a specific sheet during runtime
A.
datatable.getsheet(“sheetid”).setcurrentrow(6)
Variable=Datatable.value(6, “sheetid”)
63. Suppose there are 10 rows
of values in datatable, the script is running for 10 times, if you want to run
only for first 2 rows how do you do?
64. How to fetch data from a
specific sheet in excel to a specific sheet in datatable during runtime?
A. Use Improtsheet method
Syntax: Datatable.importsheet (“path of
file”, source sheet, destination sheet)
Note: source sheet is the sheet in excel
and destination sheet is the sheet in datatable.
65. How to export data from a specific datasheet
in datatable to a specific sheet in excel during runtime?
A. Use Exportsheet method
Syntax: Datatable.Exportsheet (“path of
file”, source sheet,)
Note: Destination sheet is not required
while exporting the data from datatable; if the file is not available in the
specified location then quick test will create a file and dump the sheet.
Always the sheet is
appended at the end of the
excel file.
66. How do you fetch values in a reverse order
from last row to first row from the datatble during runtime?
A. By seeting the focus to
previous row before fetching the value
Syntax: datatable.setpreviousrow
67. What is accessibility
checkpoint?
A. An Accessibiliy checkpoint
checks the Web page for Section 508 compliance.
68. What is the use of
recoveries in Quick Test Pfrofessional?
A.
Unexpected events, errors, and application crashes during a run session can
disrupt your run session and distort results. This is a problem particularly
when tests run unattended the test pauses until you perform the operation
needed to recover. To handle situations such as these, QuickTest enables you to
create recovery scenarios and associate them with specific tests. Recovery
scenarios activate specific recovery operations when trigger events occur.
69. How do you merge objects in
2 Repository files?
A. In Object Repository Manager àTools àObject
Repository Merge toolàNew
MergeTool, browse and select two Shared Rpository filesand click OK
70. How do you associate
library file to the test?
A. A
library file can be assosiate in 2 ways:
i) Through File à Settings à
Resources
ii) Executefile “File Path”
71. What is the use of User
Defined Environment Variables?
A. These variables are made
specific to test which are available to all the actions in that test and also
we can associate them to an external .XMl file so that they can be accessable
from any test.
72. How do you assosiate
external environment variables file to the test?
A. File
à settings à Environment à User
Defined à Load variables and
values from external file à click
ok.
To
access the variable in the script:
Environment ("variable name")
73. Where is the data stored
when we write data to datatable during runtime?
A. Runtime Table in Test Results.
74. What is the syntax for Reporter Event?
A.
Reporter.ReportEvent event status,"report step name",
"Details"
75. What is the use of
Description class?
A. It is used to create an
object by describing one or more properties of an object.
Syntax: set objectname=description.create
Objectname(“propertyname”).value=”property value”
76. Can you write syntax to
connect to database?
A. Dim objectname
Set
objectname=createobject ("ADODB.Connection")
For MS Access:
Con.open
"provider=Microsoft.jet.oledb.4.0; data source=database path"
For SQL Server:
Con.open
"provider=sqloledb.1;server=server name;uid=user
name;pwd=password;database=database name"
Or
Con.open "driver=sqlserver;server=server
name;uid=user name;pwd=password;database=database name"
77. Can you write script to
read data from employee table in db1 database in SQL server (S1).
A. Dim con
Set con=createobject ("ADODB.Connection")
Con.open
"provider=sqloledb.1;server=S1 name;uid=user
name;pwd=password;database=db1
Or
Con.open "driver=sql
server;server=S1 name;uid=user name;pwd=password;database=db1
Set
rs=createobject(”adodb.recordset”)
rs.open “select * from
employee”,con
78. Which are the Databases
supported by Quick Test Professional?
A. Oracle, MS Access, SQL Server, and Mysql
79. What is parameterization
and in how many scenarios we use parameterization?
A.
Parameterization is the process of replacing a constant value with a parameter
variable. That can be parameterized in following ways in Quick Test:
·
While performing Data Driven Testing
·
Through Action Parameters
·
Random Numbers
·
Environment Variables
80. How do we retrieve data
from an Excel File?
A. Import data from excel to datatable
Datatable.importsheet "pathofexcelfile", sourcesheet,
destinationsheet
In the script
replace the value with the datatable parameter:
Datatable (“ParameterId”,
“sheetId”)
81. What is
Scripting.FileSystem Object?
A. With the FileSystemObject object model, we can process the drives,
folders and files in the file system.
82.What is Active Screen in QTP?
A. It is QTP tool feature in which it captures the snap
shots of the application screens during the recording process,we can use this
screen to perform various script enhancements in absence of application.
83. What are the different types of licenses in
QTP?
A. There are 2 types of
licenses in Quick Test:
i)
Seat License: It is single user license, which can be installed in one work
workstation.
ii) Concurrent License: It is otherwise
called as Site License, it is multi pack, which comes in bulk (4 or 5 or more
license as a single pack)
84. What type of lincese you have used for QTP
in your project?
A. We use concurrent user licence for 5 users at
time
85. Who provided license for QTP?
A. Hp- (Mercury Interactive)
86. What is synchorinzation?
To instruct QuickTest to pause the test or component until a
particular object property achieves the value you specify.
Quick Test supports different synchronization methods like:
A. Synchronization point (Waitproperty): It is a dynamic
wait time, which is used to make sync between the Quick Test and the
application under test. When you insert a synchronization point into your test
or component, QuickTest generates a WaitProperty statement in the Expert View.
Syntax: Object ("objectname"). Waitproperty
"property name", "property value", “wait time”
B. Wait: Wait statements to instruct QuickTest to wait for a
window to open or an object to appear. Wait statements instruct QuickTest to
wait a specified amount of time before proceeding to the next step
Syntax: Wait(time in sec)
C. For tests, you can set the maximum interval (in
milliseconds) that QuickTest waits before running each test step. You do this
by setting the Object Synchronization Timeout in the Run tab of the Test
Settings dialog box (File > Settings > Run).
D. Browser ("browsername"). Page("pagename").
Sync
87. What is difference between
text and text area checkpoint?
A. Text
checkpoint captures the complete text displayed on the object but textarea
checkpoint captures the text in the specified specified area on an object.
88. What use of “On Error Resume Next”?
A. On Error Resume Next causes execution to
continue with the statement immediately following the statement that caused the
run-time error, or with the statement immediately following the most recent
call out of the procedure containing the On Error Resume Next statement. This
allows execution to continue despite a run-time error. You can then build the
error-handling routine inline within the procedure.
89. What are the different scripting languages
QTP supports?
A. You can write your QTP
automation programs in any Languages and development environment that supports
automation. For example: you can use: VBScript, javaScript, Visual Basic,
Visual C++, or Visual Studio.
90. What are the Technologies supportedby Quick
Test?
A. Java, MS.Net, SAP, People Soft, Siebel,
PoweBuilder, Flash ….Etc
91. How do you set permissions
for executing the Quick Test scripts from Quality center?
A. In Quick Test; Goto Tools à Options à Run à selects other Mercury/Hp products to run tests
and components.
92. What is the purpose of
Terminal emulator add-in in QTP?
A. To test mainframe environment application
objects.
93. What is the syntax to open
any windows based application from QTP?
A. Invokeapllication(“path of
application”)
Or
SystemUtil.Run(“path of application”)
94. When i started recording
the program / adding the objects, the tool is not able to recognize any of the
objects in the web application, what could be the reason?
A.Corresponding object class
may be userdefined class by development team
95. What is difference between
Reusable action and function?
A. Even
though both can call from whenever we from the other test or other action
function execute as external library where as reusable action calls the same
action with separate datatable.
96. How do you debug the
program?
A.Using Step commands(Step out ,Step Into,Step
Over) and Debud Viewer, we can debug the test script.
97. What is difference between
step into and step out?
A.During debugging the script
we can use these options
Step into will execute the script line by
line in main test & also in subtests where as Step over will execute line
by line in the main test and executes all the statements at single instance in
called function or sub test.
98. How do you comment the
script or statements in QTP?
A.Using single quote (‘) at the
start of the statement, we can comment a statement.
For commenting multiple lines or a block of
code, select the block and press “Ctrl+M”
For uncommenting multiple lines
or a block of code, select the block and press “Ctrl+Shift+M”
99.How do you execute a single
action in Quick Test?
A. Select the current action; goto Automation à and select Run Current Action.
100.How do you execute the
script from a selected location in the Action block?
A.
Place the cursor focus in the specified location
in the script; goto Automation à and
select Run from Step
Or
Ctrl+F5
101.What is the syntax for
creating an object using VBScript in Quick Test?
A. Set Objetvariable=CreateObject (“server
name”,”type name”)
102. Can you write a function
to accept 2 numbers and return the product?
A. Dim
a, b, r
Public function fn_mul (a, b)
Fn_mul=a*b
End function
r =fn_mul(5,7)
Msgbox r
103. Which Framework was
implemented in your project?
A. Keyword driven framework, by implemnting
User Defined Functions
104. What is the extension of
Recovery Scenario File?
A.When we create a recovery scenario and save in the system
the scenario is created with file extension
as “.qrs”(QuickTest recovery scenario)
105. What is smart identification?
A.Usually QTP tool will recognize the objects On the
applicaiton based on Mandatory Properties, configured in Object Identification,
if there is any conflict in identifying the object then Quick Test will try to
identify the object based on the Assistive Properties, still if there is a
conflict in identifying the object, then Auick Test will invoke the Smart
Identification mechanism in identifying the object based on the Base Filter and
Optional Fileter Properties configured.
106. What is Ordinal
Identifier?
A. The ordinal identifier assigns the object a numerical
value that indicates its order relative to other objects with an otherwise
identical description (objects that have the same values for all properties
specified in the mandatory and assistive property lists). This ordered value
enables QuickTest to create a unique description when the mandatory and
assistive properties are not sufficient to do so.
QuickTest can use the following types of ordinal identifiers
to identify an object:
Index: Indicates the order in which
the object appears in the application code relative to other objects with an
otherwise identical description
Location: Indicates the order in which
the object appears within the parent window, frame, or dialog box relative to
other objects with an otherwise identical description
CreationTime: (Browser object only.)
Indicates the order in which the browser was opened relative to other open
browsers with an otherwise identical description
107. What are mandatory
properties and Assistive properties?
A.These are the
properties of an object configured in object identification, by default when
the tool learn an object, it will learn the Mandatory Properties, if tool
identify any 2 similar objects then Assistive Properties are also learned.
108.
What is the function to extract a part/portion of a string?
A.We
can use mid function:
Syntax: variable=mid (string, starting
position, length)
Ex: For instance if you want to fetch
“Systems” from the below string
Str="mindqSystems"
X=mid(str,6,7)
Msgbox X
or
If you want to fetch the complete string
from 6th position
X=mid(str,6)
Msgbox X
109. What are the views under Test Pane in Quick
Test?
A.
QTP displays the test script in 2 views
·
Keyword view: The
Keyword View enables you to create and view the steps of your component in a
keyword-driven, modular, table format. The Keyword View is comprised of a
table-like view, in which each step is a separate row in the table, and each
column represents different parts of the steps. You can modify the columns
displayed to suit your requirements.
·
Expert View: A test
or component consists of statements coded in Microsoft VBScript. These
statements are composed of objects, methods, and/or properties that instruct
QuickTest to perform operations or retrieve information
110. Suppose there are 4 actions in my Test, How
do we change the Sequence of Execution of these actions
A. In Keyword viewà Click action and drag to the required position
or order
Or
In QTP when we save the script
with multiple actions, in the test a folder with “Action0” will be created, in
the “Action0” folder open the “script.mts” file and change the sequence of
actions to be executed.
111. How do you configure an
object as virtual object?
A. Using virtual object manager
we can configure as follows:
Tools menuàVirtual
Object ManageràClick on NewàSelect the Class Name to assignàpoint the
object using hand symbolàselect
Object Name, Collection name to storeàselect
Finish.
112. What is the difference
between independent action and nested actions?
A.In nested action if parent
action properties are changed will affect the child actions, & if parent
action is called automatically all the child actions are also called. In
independent actions, each action acts as independent & will not depend on
another action
113. How do you reduce the size
of QTP script file?
A.While saving the file,
unselect the option to save active screen, i.e. without active screen if we
save the script, the size of the script file is decreased.
114. How do you reduce the size
of Active Screen file?
A.By selecting Customize option
in Tools menuàActive screenàSelect customizeàedit
optionsàclick on OK.
115. Can you tell why do you
use QTP and why not the other tools?
A. Apart from so many no.of GUI
options QTP supports all latest technologies including Struts (in J2EE), NET
Framework, MainFrames etc., it provides alternative method for Record and
playback called Descriptive Programming (DP). We can also create an object for
working with the applications using “createobject” function.
116. Can you write script to
count the number of links in a web page?
A. set
decobj=descripton.create()
Decobj(“micclass”)=”link”
Set objcoll=Browser(“Browser name”).page(“page
name”).childobjects(Decobj)
Objcount=objcoll.count
Msgbox objcount
117. Can you write script to
get the value from a text box?
A. Using “GetvisibleText”
method, Using Text output value, Text area Output value we can retrieve the
value from a text box.
Ex:
x=Window(“sample”).winedit(“edit1”).getvisibletext()
Msgbox x
118. Can you write script to
display numbers from 1 to 10?
A. For i=1 to 10
Msgbox i
next
119. Can you write script to
check whether the window is exist or not?
A. z = Window(“window
name”).Exist
if(z=true)then
reporter.ReportEvent
0,"existance of window","window is exists"
else
reporter.ReportEvent
1,"existance of window","window doesn't exists"
end if
120. Can you write script to
set data in text box, using descriptive programming?
A. Ex: Dialog ("name:
=Login"). Activate
Dialog
("name: =Login"). WinEdit ("x: =20","y: =59").
Set "mindq"
Or
By describing the object:
Set lgn=description.create
Lgn(“name”).value=”Login”
Set uname=description.create
Uname(“x”).value=”20”
Uname(“y”).value=”59”
Dialog(lgn).winedit(uname).set “Mindq”
121. What is Descriptive
Programming?
A. Identifying the objects based on its properties in the
script without storing the object descriptions in object repository. We can use
or implement this mechanism when the repository is growing huge which might
reduce the performance of Quick Test
We can achieve Descriptive Programming in two ways:
i) Static: You
list the set of properties and values that describe the object directly in a
VBScript statement.
Ex: Browser("name:=MercuryTours").Page("title:=MercuryTours").WebEdit("html
id:=username").set “Mindq”
ii) Dynamic: You
add a collection of properties and values to a Description object, and then
enter the Description object name in the statement.
Ex: set
br=description.create
Br(“name”).value=”MercuryTours”
set
pge=description.create
pge(“title”).value=”MercuryTours”
set
lun=description.create
lun(“html
id”).value=”username”
browser(br).page(pge).webedit(lun).set
“Mindq”
122. How does QTP tool will
recognize the object in the application?
A. When script is recorded in
Quick Test, the tool learns the object details & these details will be
stored in object repository, during execution the tool will identify the
runtime object on the application based on the description properties of the
object in the object repository
123. How do you find the
available properties of any object in the application?
A. Using Object Spy
Navigation: Tools àObject Spy
124. Suppose you have learned
the properties of an object to object repository from the application, now the
object properties have changed, how will you update the properties in the
object repository?
A. “Update From
Application”option from Resource menu so that updated propertie will be added
to repository.
125. What is the difference between Test datatable
and Runtime datatable?
A. The datatable associated
with every test before or after test execution where as the Runtime datatable
is the datatable present during test execution, we can accept values to script
from runtime datatable and we can also write output to runtime datatable from
script. The runtime datatable will be present in the results page after the
test execution.
126. What is difference between
while and do. while loop?
A. A While...Wend statement
instructs QuickTest to perform a statement or series of statements while a
condition is true
Syntax: while condition
Statements.
Wend
127. Can you do performance testing in QTP / how do you do
performance testing in QTP? We can
conduct performance testing using Begin transaction & End transaction statements in the script
A. Ex: Services.StartTransaction "Tran1"
Dialog
("Login"). Activate
Dialog
("Login"). WinEdit ("Agent Name:"). Set "mindq"
Dialog
("Login"). WinEdit ("Password:"). Set "mercury"
Dialog ("Login"). WinButton ("OK").
Click
Services.EndTransaction "Tran1"
The above script can show the
performance time to login into Flight application
128. How to run win runner
program from QTP?
A. Insert àcall to Winrunner testà Browse the path of the testàselect options àclick
on OK
129. How to connect to QC /TD
from QTP?
A. FileàQuality
Center ConnectionàSpecify the Server NameàClick Connect.
130. Can you give any example
how to use Regular Expression?
A. As Quick Test cannot
recognize sequetional windows(Fax order No.1 No.2 etc) we can make Quick Test
to recongnize the object using regular expressions. As follows
Resource àObject Repository à Select
“Fax order No.” from the list àselect
physical descriptionàedit
text property as follows
“Fax Order No.*”àclick on OK
131. In how many ways we can
create test script in QTP?
A. We can create a test script
in 3 ways:
i) Through recording.
ii) Through Step generator
iii) Through DP(Descriptive
Programming)
132. What is objective of Dim?
A. It is used to declare
multiple variables in a single statement as dimension, so that the variable
accepts of int, long, float etc.
133. What is the objective of split action?
A. Split action divides the
existing action into no.of independent or nested actions. So that separate
memory will be allocated, datasheet in datatable will be created.
133.What is missing resources?
How can we identify missing resources?
A. If a test has resources that
cannot be found, such as missing shared object repositories or calls to missing
actions, or if it uses a repository parameter that does not have a defined
value, QuickTest indicates this in the Missing Resources pane.
134.what is the advantage of
‘With’ in Quick Test?
A. The With statement allows
you to perform a series of statements on a specified object without
requalifying the name of the object
Ex:
With MyLabel
.Height = 2000
.Width = 2000
.Caption = "This is
MyLabel"
End With
135 What is the extension of
QTP Script file?
A. .mts (mercury test script)
136.What is dictionary object?
A. A Dictionary object is the
equivalent of a PERL associative array. Items can be any form of data, and are
stored in the array. Each item is associated with a unique key. The key is used
to retrieve an individual item and is usually an integer or a string, but can
be anything except an array.
Ex: Dim d
' Create a variable.
Set d = CreateObject("Scripting.Dictionary")
d.Add "a", "Athens"
' Add some keys and items.
d.Add "b", "Belgrade"
d.Add "c", "Cairo"
137.What is the use of Update
Run mode?
A. QuickTest updates the set of
properties for each object class in your associated object repositories
according to the properties currently defined in the Object Identification
dialog box. You can use this option to modify the set of properties used to
identify an object of a certain type.
Update Run mode updates
expected vales with latest values automatically.
138. What are the technologies supported by Quick Test 9.5?
A. a) NET Framework
1.1, 2.0, 3.0, and 3.5.
c) Java run-time environments- Sun JDK, JRE, and Plug-in versions 1.4.2, 1.5.0,
and 1.6.0 Sun Java Web Start 1.4.x, 1.5.x,
and 1.6.x, JDK, JRE, and Plug-in, versions 1.3.0 and
1.4.2
d) Oracle Forms 6i, 9i, and 10g (Releases
1 and 2)
e) SAP Gui for Windows 7.1
f) PeopleSoft applications 8.X (8.0, 8.4,
8.8, 8.9, 9.0)
139. How to increase the speed
of QTP execution?
A. By runnig in fast mode we
can increase the speed of execution.
140. What is the diff between
language and scripting language?
A. In Language compilation and
execution are of different process where as Scripting Language Interpretation
exists(no compilation and execution).
141.What is default data type of QTP?
A. Default datatype in Vbscript is ‘variant’.
142.How to create an User Defined Function?
A. 1) Create An UDF in notepad & save with .vbs extension.
2) File MenuàSettingsàresourcesàBrowse
the vbscript fileàclick
on “set as default” to apply for all
tests.
3) call UDF using function name
in the test.
143. How can i check if a
environment variable exist or not?
A.
When we use Environment("Param1").value then QTP expects the
environment variable to be already defined. But when we use
Environment.value("Param1") then QTP will create a new internal environment variable if it does not exists. So to be sure that variable exist
in the environment try using Environment("Param1").value.
Environment.value("Param1") then QTP will create a new internal environment variable if it does not exists. So to be sure that variable exist
in the environment try using Environment("Param1").value.
When
we use Environment ("Param1").value then QTP expects the environment
variable to be already defined. But when we use
Environment.value ("Param1") then QTP will create a new internal environment variable if it does not exists already. So to be sure that variable exist
in the environment try using Environment ("Param1"). Value.
Environment.value ("Param1") then QTP will create a new internal environment variable if it does not exists already. So to be sure that variable exist
in the environment try using Environment ("Param1"). Value.
144.What are the features of
Global sheet?
A. i) Parameters in Global sheet
are global, they can be used in all the actions in the test.
ii) The test iterations are based on
number of rows of data present in the Global sheet.
145. What is the use of datepart
function?
A. Returns the specified part of a
given date.
GetQuarter = DatePart ("q", TheDate)
146. What is test object?
A.
It’s an object that is stored in object repository with which Qucik Test uses
to recognize an object on the application. Each test object has one or more
properties and methods that can be used to perform operations on that object.
Each object also has a number of identification properties that can describe
the object.
147.
How to execute QTP from Command prompt?
A. From
DOS prompt give the below command
C:\\ qtpro.exe
148. What are the different scripting languages you
could use when working with QTP ?
A. VBScript, Java Script
149. How do we know the name of associated
environment file to the current test?
A. Using a method called
“environment.externalfilename” we can retrieve the name of associated
environment file to the current test.
x=environment.ExternalFileName
Msgbox x
150.What is difference between Internal and External
environmental variables?
A. Scope of Internal environmental variables is
limited to current test so that we can use in all actions in the test where as
external environmental variables are global, hence we can use in any action of
any test.
151.Write script to delete a file from file system?
A. Using file System Object “Delete Method” we can delete a
file.
Ex: set
fso=createobject(“scripting.filesystemobject”)
Fso.deletefile
“D:\demo.xml”
152.How do you execute scripts in a batch mode in Quick
Test?
A. Using Test Batch Runner. The file extension of a batch
file is .mtb (mercury test batch)
Navigation: start à
programs à QTPà Tools à Test
Batch Runner
153. What is the file extension of the script file
& object repository file in Quick Test?
A.
Extension of script file is - .mts(mercury test script) Local Object Repository
is - .mtr(mercury test repository) Shared Object Repository Extension is -
.tsr(test shared repository)
154. How can we merge two shared repositories in
Quick Test?
A. Using Object Repository Merge Tool
Navigation:
Resourcesà Object Repository manager à Tools à Object repository Merger Tool
155.What is the diff between public and private?
A. If we declare a function as public then we can
call the function from any test or action, but private function can be created
and used within that action of a test.
156.What is the diff between GET TOProperty and
SETTOProperty?
A. Using GET TOProperty we can retrieve a single
property of a test object, using SETToProperty we can set property(s) of n test
object during runtime.
157.What is Function definition generator?
A. Using function definition generator we can create
user defined functions.
Navigation: Insert menuàFunction Defnition
generator
158. Explain advantages of Active screen?
A. We can
perform the following operations using Active Screens:
i) Insert
Standard, Text and Bitmap checkpoints
ii) Insert
Standard Output value
iii) View
and Add Object to object repository
iv) Generate
script for an object using Step generator.
159. Explain Active screen Modes?
Windows
application:(capture level)
a.
Complete
b.
Partial
c.
Minimum
d.
None
For
web application:
Disable Active Screen Capture
Capture Original HTML Source
160. During Normal
or Context Sensitive recording, what will happen in QTP?
A. Script
is generated for the objects, on which the user performs the operations,
snapshots are captured in active screen and the objects are captured in Object
Repository.
In Normal
recording quick test will generate a script based on the window or screen area
coordinates.
161. Explain how QTP recognizes Run time object
during execution time?
A. By
comparing the Description Properties of every Test Object with the Runtime
Object
162. Explain Object Repository?
A. It is a
common or central place where quick test will capture all the properties on an
object, which will make use of identifying the objects during runtime
163. Explain how we can associate shared repository
through script?
A. Using
Repositories collection method.
Synatx: Repositoriescollection.add(“shredrepositoryfilename”)
164. What is checkpoint? Explain how it will work?
A. A
checkpoint is a verification point that compares a current value for a
specified property with the expected value for that property. This enables you
to identify whether your application is functioning correctly.
165. When we insert a checkpoint, how QTP saves that
information?
A. When we insert a checkpoint and saved it
internally system creates a .dat file and stores the information of the
checkpoint in the file. We can’t edit the file directly, we can edit only from
QTP.
166. How to know checkpoint pass of fail during
execution time? How to get return status of checkpoint?
A. Var=<object hierarchy>. Check (checkpoint
(“object”))
It
returns “True” value if check point pass, other wise it returns “False” value
167. How to suppress warning messages in test result
window?
A. Reporter.Filter=<filter value>
Filter
value can be 0, 1,2,3
0-Default. All reported events are displayed in the Test Results
1-Only
event with a warning or fail status are displayed in the Test Results.
2-Only
events with a fail status are displayed in the Test Results.
3-no
events are displayed in test result window
168. How to find text is occurred in the given
string or not?
A.
InStr function
169. If the object does not support GetItemsCount
method then how to find no of items in a combo box?
A. A web list
box doesn’t support the method GetItemsCount instead it supports a property
called “ItemsCount”. So we have to
use GetROProperty (“ItemsCount”)
170. Write the script to print all properties
available in the object Repository?
A. Set
props=window (“Sample”). GetTOProperties
Propscount=Props.Count
For I=0
to Props.Count-1
Propsname=Props(I).Name
Propsval=props(i).Value
msgbox
propsname&space(5)&propsval
171. Write script to change Global Synchronization
value?
A. Dim App
Set App
= CreateObject("QuickTest.Application")
App.Test.Settings.Run.ObjectSyncTimeOut = 20000
172. If I am not interest to use Transaction points
how to find some portion of script execution time?
A.
Starting time=now
<Portion of test script>
End
time=now
Timetaken=(DateDiff(“s”,starttime,endtime)
173. How to associate external environmental variable
file to current test/action Script?
A.
Environment.LoadFromFile “Path of .xml file”
Var=Environment.Value(“env. Variable name”)
174. Write the script to find folder path where the
current test results are saved?
A.
Msgbox(Environment.Value(“ResultDir”))
175. Write the script to find path of the folder in
which the test is located?
A.
Msgbox(Environment.Value(“TestDir”))
176. Write the script to find which action is
currently running?
A.
Msgbox(Environment.Value(“ActionName”))
177. Write the script to find Local Host name?
A.
Msgbox(Environment.Value(“LocalHostName”))
178. Write script for to invoke multiple web
applications from a single instance?
A. Set
IE1=Createobject(“Internet Explorer.Application”)
IE1.Visible=True
IE1.Navigate “http://www.mindqsystems.com”
IE1.Navigate http://Rediffmail.com
180. Explain Absolute path and Relative path?
A. The
actual path of file as it resides on the hard drive is called absolute path.
The
path of file relative to a given folder is called the relative path.
181. Write script to find number of rows filled in
local sheet of Action1?
A.
Var=DataTable.GetSheet(“Action1).GetRowCount
182. Syntax for setting the parameter id in runtime
datatable?
A.
variable=datatable.getsheet(“sheet id”).addparameter(“parameter id”,”parameter
value”).name
183. Explain DATE and TIME functions?
A. These
are default b functions, Date is to fetch the system current date and Time to
fetche the system current time.
184. How to compare two strings?
A.
Strcomp(string1,string2)
Returns a value indicating the result of a string comparison.
String1 is less than string2à -1
String1 is greater than string2à 1
String1 is equal to string2à 0
185. Write the function to return a string in which
the characters order of a specified string is reversed?
A. Dim
string
String=”Mindq”
String1(StrReverse(“string”))
Msgbox
string1
186.Write the script to read values from Text file?
A. Dim fso,f
Set
fso=createobject(“scripting.filesystemobject”)
Set
f=fso.opentextfile(“path of .txt file”,1)
While
f.atendofline<>true
S=f.readline()
Msgbox s
Wend
F.close()
187.Write script to create a .txt file and to write
“mindqsystems” message?
A. Set
fso=createobject(“scripting.filesystemobject”)
Set
f=fso.createtextfile(“path of .txt file”,8)
f.writeline(“mindqsystems”)
f.close()
188.Write script to create .doc file and to write
“mindqsystems” message?
A. Set
fso=createobject("scripting.filesystemobject")
Set
f=fso.createtextfile("E:\abc.doc")
f.writeline("mindqsystems")
f.close()
189. Write script to work on excel sheets?
A. Set
excelapp=createobject("Excel.Application")
excelapp.workbooks.Add
excelApp.visible=true
Set
excelsheet=ExcelApp.Activesheet
Set
getsheet=excelapp.worksheets
'to get
sheet count
msgbox(getsheet.count)
'to enter
data
excelsheet.cells(1,1)="Madhu"
excelsheet.cells(2,1)="mindqsystems"
'to add
sheet
getsheet.add
to delete
sheet
setworksheet=excelbooksheet(4)
worksheet.delete
to read the
value
var1=excelsheet.cells(1,1)
var2=excelsheet.cells(2,1)
msgbox(var1&vblf&var2)
to save
worksheet
excelbook.saveas “path of location”
excelapp.quit
set
excelapp=nothing
190. Write script to retrieve all similar objects
located inside a parent object?
A. set obj1=description.create
obj1(“Class Name”).value=”WebEdit”
set objcoll=browser(“Yahoo”).page(“Yahoo..Mail”).childobjects(obj1)
objcnt=objcoll.count
“objcnt”
will have the count of the webedits on the given page.
191. Where can I find a web pages cookie?
A. The
cookie used by the browser can be accessed through the browsers document object
model (DOM).
Ex:
browser (“browser name”). Page (“pagename”).object.cookie
192. Does QTP recognize two
diff browsers at a time..?If possible how..? Is it possible run scripts on
Mozilla which are recorded on IE..?..How..?
A. QTP will recognize two
browsers at a time with the help of Creation Time. We can not run the scripts
on Mozilla which is recorded on IE. We will face few issues. In that case its
better if we use DP(Descriptive Programming)
193. How can you capture (Read)
the values from a Table?
If the given table is web table
then we can capture the values from web table by using this method
Browser
("Browser").Page
("PageName").WebTable("TableName").
GetCellData(rowindex,columnindex)
194.Why you are Using
Descriptive programming instead of Object Repository?
A. Descriptive Programming is
an advanced concept in QTP.we can handle the Application by implementing the DP
instead of OR.
Advantages of DP:
1 DP Script is reusable Script
2 we can modify the script easily compare to QTP Code.
3 we can write script without application in hands based on the properties of objects.
4 DP is flexible for high performance of application compare to OR
5 DP script is very flexible for meet the object implementation problem in application.
1.
If
there are two web objects with the same properties then how a specific object
can be Identified?
A.
We
can handle this situation several ways like
1.
through
Smart Identification Process
2.
Through
Index Property
3.
Through
Dynamic handling through Descriptive Programming.
2.
What
function can be used to find the number of occurrences of sub strings within a
string?
Function Body
Function SubStrOccur(Str, SubStr)
Occr = split(Str, SubStr)
SubStrOccur = ubound(Occr)
End Function
Function Call Statement:
Str = "SairamSairam Sairam"
SubStr = "Sai"
msgbox "Given SubString("&SubStr&") appeared "&SubStrOccur
(Str, SubStr)&" time(s) in given String("&Str&")"
195.
What
is the concept of hooking in QTP?
A. When the QTP is in recording mode then the Automation tool automatically associate with the windows manager itself. This association process is called hooking process in QTP.
196.
How
to load vbs file to qtp through scripting?
In your script include the following line of code, .vbs file will be loaded
A.
ExecuteFile
"Path of file .vbs "
197.
What
is absolute path and relative path in QTP..? How to access them and what are
the differences between them...?
A. Absolute path means we have to mention full path in script.
Example: executefile "E:\project name\libraries\main.vbs"
Relative path menas no need to give full path just mention file name
Example: executefile "main.vbs"
But here if you want to convert this Absolute file path as relative path. you should do following steps
Tools menu-->options-->folders tab
Here you have to add this path example "E:\project name\libraries"
Then you can use direct filename as above mentioned in the relative path example instead of absolute path example.
198.
How
do we Access, retrieve and edit the runtime objects in Automation Testing using
QTP?
A. We cannot edit runtime objects in Automation Testing, because Runtime objects means the Objects available in AUT, we can only use the properties available for objects and we
Can change the property/properties available in OR during runtime by using SETTOPROPERTY
We can retrieve the property and its value by using
GetRoProperty
eg:
dialog("Login").Activate
dialog("Login").WinButton("OK").SetTOProperty "text","Cance"
print dialog("Login").WinButton("OK").GetROProperty("text")
It returns "Cance"
199.
In
how many ways we can use checkpoints to an application using QTP?
A. In 3 ways we can use checkpoints to an application
1-while recording the application
2-using the active screen we can add check points
3-while writing the scripts if we want to insert checkpoint there itself then we have to right.
200.
How
can we call an external library file in QTP apart from using the Executefile
statement..? Is there any other way we can call the external library file in
QTP?
A. Yes we can associate the library files without using "Executefile" statement. But you should use AOM method
Example:
Dim qApp
Dim qLibs
Set qApp = CreateObject("QuickTest.Application")
qApp.Launch
qApp.Visible = True
qApp.Open "E:\Test1", False, False ' Open a test
Set qLibs = qtApp.Test.Settings.Resources.Libraries ' Get
the libraries collection object
qLibs.Add "C:\Utilities.vbs", 1 ' Add the library to the
collection
qApp.Test.Save
qApp.Quit
Set qLibs = Nothing
Set qApp = Nothing
201.
How
to load an object repository file in to QTP during runtime?
A.
We
can use RepositoriesCollection method ,
Syntax: RepositoriesCollection.Add(shared Object
repository file path)
We can also associate
this file with AOM concept
Ex:
Dim qtAppn
Dim qtObjRes
Set qtAppn = CreateObject("QuickTest.Application")
qtAppn.Launch
qtAppn.Visible = True
qtApp.Open "E:\Test\Test2", False, False
Set qtObjRes = qtApp.Test.Actions
("Create").ObjectRepositories
qtObjRes.Add "E:\OR\ObjRes.tsr", 1
The above example Add the Object Repository (ObjRes.tsr) to the "Create" action
202.
Is
QTP a compiler or interpreter, Can we execute a QTP Script file in a system
which does not have QTP installed?
A.
QTP
is an Interpreter. We cannot execute QTP script in another system which does
not have QTP installed.
203.
What
is the default ordinal identifier in QTP?
A. Default ordinal Identifier is "Location"(Tools Menu--> Object identification)
204.
What
are the send keys in QTP?
A.
Send
keys are used for sends one or more keystrokes to the active window.
205.
Suppose
there are 100 links in a web page and the number of links will be changing
dynamically from time to time. Write a code such that every time it will click
on the last Link of the web page?
A.
' Set a description object to identify links.
Set oDesc = Description.Create()
oDesc("html tag").Value = "A"
' Get a collection of links
Set oLinkCollection = Browser("test").Page
("test").ChildObjects(oDesc)
Set obj=oLinkCollection.Item(oLinkCollection.Count-1)
obj.Click
206.
Difference
between Dim and Redim Statement?
A. The ReDim statement is used to change the size of the array within the script:
for example you have declared an array
Dim Customers (50)
But now you want to change the size of the array so you can do that with the help of Redim
ReDim Customers (100)
No comments:
Post a Comment