Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
265 views30 pages

F Our QTP

Download as docx, pdf, or txt
Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1/ 30

f our qtp vb Script may be Currepted then What we want do?

IBM
Through array we can execute the testcase how ? give me example TCS
which browsers versions are supported in loadrunner 8.1?if any patches are
TCS 
required for browsers?
How to swap two numbers by using parameter passing method byref in a
CTS 
fucntion and return the result to outside of the function?
How to integrate the qualitycenter with qtp Wipro
What is deference between Action and Test? with Examples? Satyam
How to capture checkbox properties when properties of the object keep
TCS
changing on relogin to the application.
what is descriptive programming?
ell me types of environment variables? what r they? explain
IBM
details? pls give anwer any one?

In smart identification, explain about 1. Base filter properties 2. optional filter


properties with examples?

give me descriptive programing code sample flight application in qtp?

hi all QTP recognizing objects as "string_1","string_2","string_3","string_4" like that


but when using FOR LOOP for these.QTP not proceeding further can i declare these
_1,_2,_3,_4 as a single variable

Important : Does QTP work in UNIX environment.

How to switch between browser tabs? )moving from one tab to another tab)
Answer Press Ctrl+Tab to switch between browser tabs

1.In VB Script 100 lines Script. How can check the Syntax errors? 2. Write a VB Script for
X = India/Srilanka/Australia/England/South Africa.I need the Output Country wise? [ 1st
Msgbox India , 2nd Msgbox Srilanka] ---- 3. How can Choose these test cases to be
automated?
Answer 1.Information tab. It will display all
#1 syntax errors in the
script while moving from expert view to
keyword view.

2.Dim str
str=Split(X,"/")
for i=0 to ubound(str)
msgbox str(i)
next
3.testcases which needs to be executed for
each and every
build.

 how to count the word "IS" is repeated in the application using DP


Answer str="mismismis"
# 2 p=1
cnt=0
while instr(p,str,"is")>o
cnt=cnt+1
p=instr(P,STR,"is")+les("is")
wend
msgbox"is is repeted for "&cnt

1.How to find in which row or column,string "Hyderabad" exist in excel sheet? 2.How to find
how many times character "a" repeated in a given string "Koteswararao"

Answer
# 1
Option Explicit
Dim a,b,c,i,leng,var
b=0
c="a"
a="Koteswararao"
leng=len(a)
msgbox "length of"&" "&a&" "&"is"&" "&leng 'optional step

For i=1 to leng


var=mid(a,i,1)
If cstr(var)=cstr(c)Then
b=b+1
End If
Next
msgbox "Total Number of a's in Koteswararao are"&" "&b

Answer
# 2

str="Koteswararao"
st=Split(str,"a")
Msgbox ubound(st)
Please let me know if u have simplest answer than this.
How often you do the load test in your current project?
Answer
# 1
Load Test is ideally done only once, and only after all the
Functional Testing (UAT/SIT).

Otherwise, i could depend on your client requirement.

This also depends on the Project / application demand.


For Example if the application is like depends on the Data
that is going to change every day with heavy fluctuations.
Then we will keep certain time period (say 30 days) we will
test the LOAD during these 30 days on every day to moniter
the performance behaviour of the application.
Suppose there is a bitmap with some text in it how do you write the script to get the text.
Answer With quick test professional 9.2, you
#2 should try using Text
Area Checkpoint, which will extract the
text out of the image

What is the difference between Systemutil.run and Navigate.


Answer Go through the below script, u may get the better
#2 answer

SystemUtil.Run "iexplore.exe","www.google.com"

Browser("name:=Google").Navigate "http://www.cnn.com/"

Browser("name:=CNN.com - Breaking News,").Page


("title:=CNN.com - Breaking News,").Link
("name:=Health").Click
wait(10)
browser("name:=CNN.com - Breaking News,").Back

SystemUtil.Run : By using SystemUtil.Run we can run


any
application from specified location. (as above
SystemUtil.Run "iexplore.exe","www.google.com")

2nd example: to run the flight reservation login


window
SystemUtil.Run "C:\Program Files\Mercury
Interactive\QuickTest
Professional\samples\flight\app\flight4a.exe"

Navigate : Open a specified URL in the browser


i.e object.Navigate "URL specified" and here the
object is
the test object of type browser (as per above i.e
Browser
("name:=Google").Navigate "http://www.cnn.com/")

It is very much important to know the difference


between
SystemUtil.Run, Navigation and Invoke Application?????

There is web page with the webtable,this contains some data, how do you manipulate
the data.
Answer we have two methods to get the data from webtable
#2
1)getrowwithcelltext(we can get the rownum )

syntax:- Browser("micclass:=Browser").page
("micclass:=Page").WebTable("micclass:=WebTable","htm
l
tag:=Table").getrowwithcelltext("text")

2)getcelldata

syntax:- Browser("micclass:=Browser").page
("micclass:=Page").WebTable("micclass:=WebTable","htm
l
tag:=Table").getcelldata(rownum,colnum)

What is the difference between low level recording and virtual object.
Answer Low-Level Recording—enables you to record
# 2 on any object in your application, whether
or not QuickTest recognizes the specific
object or the specific operation. This
mode records at the object level and
records all run-time objects as Window
[Parent]or WinObject[child] test objects.
Use low-level recording for recording in
an environment or on an object not
recognized by QuickTest.

Virtual Obj. Means.....


Application may contaion objects that
behave like standard
objects but not recognize by QTP, u can
define these
objects as a virtual objects and map them
standard class

How do i relate the checkbox properties with webelement when checkbox properties
are changing on every login to the application
Answe we can solve this by using regular expression and setto
r pro
# 1 perty method
---------------------------------------------------------
---
1)by or
-------
1)go to or
2)select webcheckbox object
3)goto object properties pane
4)select the name property
5)in the value portion click 'configure value' buttton
6)replace constant with *.*
7)selct check box Regular expression ON
8)click ok
9)close or
10)now u run ur script

2nd way
----------
' by using setto property method we can change the
property
value dynamically as follows....

newval=oh.link("linkname").getroproperty("name")
objectheirarchy.link("link name").setto
property "name","newval"

'here first we r getting dynamic changing link object


pro "name" by getro prop in to the variable...
'then we are make using that variable to set into or

QUESTION : I have recorded a test using qtp to download a file in an


application.

Code:

Browser("MFA Work Queue Manager").Page("MFA Work Queue


Manager").Link("Rules Maintenance").Click
Browser("MFA Work Queue Manager").Page("Rule
Maintenance").WebEdit("txtSearch").Set "PmtType"
Browser("MFA Work Queue Manager").Page("Rule
Maintenance").WebButton("Search").Click
Browser("MFA Work Queue Manager").Page("Rule
Maintenance").WebButton("Export").Click
Browser("MFA Work Queue Manager").Dialog("File
Download").WinButton("Save").Click
Browser("MFA Work Queue Manager").Page("Rule
Maintenance").Sync
Dialog("Save As").WinButton("Save").Click
Dialog("Save As_2").WinButton("Yes").Click

Problem:

When running this test it gives an error at line no. 5 as


Save button object is not identified by it's parent object.

This code I ran 4 times after recording at it was working


fine but 5th time onwords, it starts giving me the above
problem. I used exist property option, Check Property
option but none of this changes work at all.

ANSWER: See, there are 2 "save" buttons in your script.


when you are running the script, QTP getting confused due
to the existance of 2 SAVE button, unable to identify them
properly. so they will be distinguished in 3 three way
i) Index value proerty
ii)creation time property
iii)Location property

Use any one of these property, i think it will work

 how to get no.of non empty rows in a excel sheet through vb-script

Answer by writing the for loop and you have to initialize for
# 1 (i=0;
i<==num(i), i++)
Next

This loop will include that the rowcount it will take


first 0 and total count it wil compare to the max of rows
if it wil true it will counts the nect row count

Answer
# 2 rcount=usedrange.rows.count

how to choose the framework in qtp ? 2)when we go for the descriptive programming ?

Answer It depens what exactly u want to carry out,if Checking


# 1 huge data then data Driven Frame work is enough......
ur writing all ur reusable asa functions and want to
call keyword could be good.
Descriptive programming for dynamically changing values

what is output parameters in qtp?explain? 2)

Answer standered output values,text


# 1 outputvalues,textarea,xml
o/p,database o/p
If i entered 2 columns and 4 rows inputs in DDT Like Mango fruit, Banana Fruit, Brinjal Veget,
Carrot Veget.. . My Q is How to get the 2nd column value for corresponding 1 column input
in 3rd row ie, ( i need to get "veget" in messge box @ run time

Answer datatable.SetCurrentRow(3)
# 1 x=datatable.Value("A",1)
msgbox x
datatable.Value("c",1)=x
msgbox c

--------------------------------------
A c
mango
banana
brinjal
carrot
Answer strCnt=DataTable.getRowsCount
# 2 For i=1 to strCnt
datatable.SetCurrentRow(i)
x=datatable.Value("A")
datatable("c")=x
Next
Answer datatable.setcurrentrow(3)
# 3
x=datatable.value(2,1)

'datatable.value(2,1) where 2 is column name and 1 is


sheet
no. ie., 1 is for global sheet

msgbox x

'output is veget
Answer i= inputbox "enter ur string" # say brinjal
# 4
r=datatable.getrowcount #get row count
for i=1 to r #loop till the end of the row
datatable.setcurrentrow(i)
aa=datatable.(a ,dtglobalsheet) # column 1 value into aa
if instr(aa,i,1)=1 #compare the strings
bb=datatable(b,dtglobalsheet)
msgbox bb
exit
else
i=i+1
next
How to export QTP results to an .xls file?

Answer It is not possible to Export the Results Directely into


# 6 Excel File,but it is possible to Export the Results into
Runtime Datatable.

EX:
datatable.AddSheet "venu"
datatable.DeleteSheet "Global"
datatable.DeleteSheet "Action1"
datatable.ImportSheet "C:\Documents and
Settings\Administrator\Desktop\Mallik.xls",1,"venu"
For i=1 to 9
datatable.SetCurrentRow(i)
systemutil.Run "C:\Program Files\Mercury
Interactive\QuickTest
Professional\samples\flight\app\flight4a.exe"
Dialog("Login").WinEdit("Agent Name:").Set datatable
("A","venu")
Dialog("Login").WinEdit("Password:").Set datatable
("B","venu")
Dialog("Login").WinButton("OK").Click
Window("Flight Reservation").WinMenu
("Menu").Select "File;Open Order..."
Window("Flight Reservation").Dialog("Open
Order").WinCheckBox("Order No.").Set "ON"
Window("Flight Reservation").Dialog("Open Order").WinEdit
("Edit_2").Set datatable("C","venu")
Window("Flight Reservation").Dialog("Open
Order").WinButton
("OK").Click
x = Window("Flight Reservation").WinEdit
("Name:").GetVisibleText()
Datatable("D","venu")=x
Window("Flight Reservation").Close
Next

Results:x values will be Printed into Runtime Datatatable


in D column
how can i pass parameters into function?

Answer We will defeinitely pass the parameters to


# 3 Function

Try with this Example

First parameterize the Agent name with


invalid data like sun
Dialog("Login").Einedit("AgentName").Set
datatable.Value
("Agent")
Call the function
Function Login(Sunny)
Dialog("Login").Einedit("AgentName").Set
datatable.Value
("Agent1")
End Function
Please explain me in detail! How to handle runtime errors in QTP useing recovery senario
or with out scenario

Answer There are 4 trigger events during which a recovery


# 1 scenario should be activated. They are
A pop up window appears in an opened application during
the test run.
A property of an object changes its state or value.
A step in the test does not run successfully.
An open application fails during the test run.
These triggers are considered as exceptions and more
details regarding how to use Recovery Manager is given
in the QTP User Guide. Since there is hardly any space
to put up snapshots
Answer Let me explain with out recovery scenario,
# 3 we can handle exeptions like pop windows by using IF
ELSE statements.

for example..

if window("XXXX").dialog("XXXX").exist then

window("XXXX").dialog("XXXX").winbutton("text:=XXXX").click
window(("XXXX)).winbutton("XXXX").click
else
<put remaining script here>

end if

and also by using methods like "on error resume next,


err.number, err.raise, err.information" methods.
We can also Stop the error by using below lines

MsgBox ("Error # " & CStr(Err.Number) & " " &


Err.Description)'this lines given the error number and
Description

Err.Clear 'this will clear the Error


Answer and also...
# 5
If any un-expected popup window appears
Then we can close all popup windows by using kill process
by window name. There is a QTP Utility function to kill
the
window by process. We can use this also.

How to add multiple values in rows, under a single column of a run time datatable?

Answer BY importing the data from external excel sheet


# 1
1) first addsheet
2) importheet from excel to the local datatable
datatable.addsheet(tagretsheet)datatable.importsheet
sourcefile,sourcesheet,targetsheet

or else
u can manualy give the values into the shhet
datatable.value(parametername,sheetname)=parametervalue
 I have 1 to 10 action are there, i want action1 output becomes to action 10 input?
pls any can give script for this scenario?
We need to create Action-Parameter for both Actions.

For eg.
in Action1_Properties:(Input-Parameter: InputName, Type)

'Assigning the InputName value to the Variable


in Action1_Script: Action1_Param=Parameter("InputName")

in Action10 properties (Output-Parameter: OutPutName,


Type)

THEN

RunAction "Action1", OneIteration


RunAction "Action10", OneIteration, OutPutName

what is the main use of reviews


To trace out whether the process is going on without any
interruption. By reviewing, we can get an insight what is
the status of the project, what are different things, are
there any obstacles while completing our project. If any
problems are arised, workarounds can be implemented.
For Better test coverage.

when we review the tectcases we have to identify the


mistakes but not solution.
how can we merge the object repositories?is ther any option in qtp to
merge the object repositories if we have two or three object repositories?

An Let us suppose that there are three object


sw repositories(shared)A,B,C
er Go to Resources-->Object Repository Manager--
# 5 >Tools-->Object
Repository Merge Tool

Then we will get one box with two options Primary


file and
secondary file. Select the path of the A and B
files using
buttons and select them. Then click ok button
and it will
merge the A and B repositories.

To merge C repository to this (same navigation as


above) andhere C is secondary file.
How can we open an Excel sheet through the script

Answer This question is


# 1 related to automation.
As an example we can
open an excel sheet in
QTP using the library
functions available in
the VB scripting.
Answer a) In QTP data table have two
# 2 types of the Excel sheet.
b) If the extra Excel sheet
wants then you create in the data
table window in QTP. This facility
is possible in QTP data table
window.
c) If you want script to excel
sheet then start the record and open
the one new excel sheet then stop
the record after check script. That
is the script of the excel sheet.
d) Once do this function of the
excel sheet. if you get the
scripts.
How to change the run-time value of a property for an object?

Answer SetTOProperty changes the


# 1 property values used to identify
an object during the test run.
Only properties that are
included in the test object
description can be set.
Analyzing the Checkpoint results ?

Answer Standard Checkpoint: By adding


# 1 standard checkpoints to your tests or
components, you can compare the
expected values of object properties
to the object's current values during
a run session. If the results do not
match, the checkpoint fails.
Explain key word driven frame work?How to use in real time?

Answ In keyword driven framework we develop the


er functions for the scenarios nd these
functions are executed based on the objects.
# 1 And for a project we have to first create a
folder structure
1)Repository 2)Recovery 3)library functions
4)test data
5)Log file 6)environment 7)Test script...
create the desired repositories& save them in
corresponding folders.(repository folder)
create the desired recovery files nd save
them in
corresponding folders.
create the desired library files(vbs files)
nd save them in corresponding folders. like
wise we have to create all folders

Execute the test


Analyse the results.
ave .xls,.txt,.doc files are there (together). i want find only .xls file
among them? how can we write function?

Answer using the extention (.xls) in code..see


# 1 below code
Here i open the file from mentioned path
and read and write the values on that.

Set fso =
CreateObject("Scripting.FileSystemObject"
)
Set f = fso.OpenTextFile("c:\DIM.txt", 1,
True) ' open to empty file and also use
for open the file which is already
created
WriteLineToFile = f.ReadAll 'Read all
the file line to
line
msgbox WriteLineToFile

Set MyFile1 = fso.CreateTextFile


("c:\kamesh.txt",True) 'create new empty
file
MyFile1.WriteLine WriteLineToFile '
Write all the stuf
in created file
MyFile1.Close
Answer
# 2 Set
fileSysObj=CreateObject("Scripting.FileSystemObject"
)
folderPath="D:\"
If fileSysObj.folderexists(folderPath) then
Set fileObj=fileSysObj.getfolder(folderPath)
Set fileObjs=fileObj.files
For Each FileName In fileObjs
If FileName.type="Microsoft Excel
Worksheet" then
MsgBox("This is the excel file
"&FileName.Name)
End if
next
else
MsgBox("Folder does not exist")
End if
What is keyword driven framework, what is "key" in It.

Answer In Keyword framework , we pass


# 1 a keyword in the test script
and this keyword determine the
flow of the test script.
how to add run-time parameter to a datasheet?

Answer a =
# 1 Datatable.GetSheet("SheetNmae").GetParamete
rCount
If a = "" Then
b = inputbox ("Enter the no.of columns")
For i = 1 to b

Datatable.GetSheet("sheetname").AddParamete
r
("paraname","paravalue")
Next
End If
Syntax for how to call one script from another and Syntax to call one "Action" in
another?
Answer RunAction ActionName, [IterationMode , IterationRange ,
# 1 Parameters]

Here the actions become reusable on making this call to


any Action.
IterationRange String Not always required. Indicates the
rows for which action iterations will be performed. Valid
only when the IterationMode is rngIterations. Enter the
row range (i.e. "1-7"), or enter rngAll to run iterations
on all rows.
If the action called by the RunAction statement includes
an ExitAction statement, the RunAction statement can
return the value of the ExitAction's RetVal argument.
How can we perfom Action and Component parameter.?

Answer Resources-> map repository parameters.


# 1 There u can select for action or entire
test
What is a runtime datatable ?

Answer After running a test with Data Table parameters


# 2 and/or Data Table output value steps, the Run-Time
Data Table displays the parameterized values that
were used, as well as any output values stored in
the Data Table during the run. You can view the
contents of the run-time Data Table in the Test
Results window.
 How to retrive data from a data table which is in 3rd row,4th column and place it in main
script..like retrive name,date from data table..write script for this.

Answer 'set the current row to 2nd


# 1 DataTable.SetCurrentRow (2)
'get the value of 3rd coloumn of 1st
sheet.
abc = Datatable.value(3,1)
Answer a) That is the data table (column,
# 2 sheet)
b) If want script then start record
and retrieve the data table form 3rd row
and 4th common then stop the recording
the you get the script that is the
scripts
what is the extension for QTP files?

Answer there are 5 extns are there in QTP.


# 5
Batch test:.mtb(Mercury test batch)
Peraction Repository: .mtr(mercury test
repository)
Shared repository: .tsr(test shared repository)
script: .mts(mercury test script)
functions : .vbs
What is the Maximum syncronization timeout in seconds in QTP 9.5

Answer
# 1 20 secs.

st me out the shortcutkeys for some functionlities in the qtp for example to record ,to
run ... etc

Ans short cut key for record is F3


we short cut key for RUN is F5
r short cut key for Stop is F4
short cut key for Step into is F11
# 1 short cut key for Step over is F10
short cut key for Step out is shift+F11
short cut key for insert/remove break point is F9
short cut key for remove all break points is
ctrl+shift+F9
what is use of optionexplicit in variable declaration
option explicit means.. it is the statement which is
declared during the variable declaration...

Option explicit statement is available to require explicit


declaration of all variable ... That means one may mispell
the variable name in one or more places,causing unexpected
results when your script is run.

Advantages of Option Explicit:

1. Clearity of the Program enhanced by proper coding rules


• Professionals always instruct to use ‘Option Explicit’
on coding. This enables the programmer to enhance his code
to pre-declared standards.

2. Program code is easier to debug and read


• Programmer has clear idea about each variable he will
use because he has already declared what kind of data type
which will have by each variable. Therefore, even another
programmer can read the code and understand it easily than
an ‘option explicit’ off document.

3. Reducing mistyped variables instead of existing usable


variables
• User may use alternate names mistakenly for already
used variables. If you have ‘option explicit’, then the
mistyped variable will generate an compile error describing
an non-declared variable. But, if you haven’t ‘option
explicit’ in your program, this will be an programming error
which will give an erroneous result to end user.

4. Give more reliability on data


• ‘Option Explicit”cause programmer to have more
understanding on declared variables. This enables the
variable to have additional attention, and reduce any
attempt to misuse a variable unintentionally.

5. Can implement Error detection mechanisms using data types


• Data types define what kind of data that can be hold by
a given variable. If you try to assign date value
“21-08-1985” to character variable, then system will
automatically generate an exception or error. You can use
this error or exception to track the user, but you may want
to build several other mechanisms to track bad inputs if you
didn’t used ‘Option Explicit’

6. Faster memory allocation


• When declaring variables, VB assigns particular amount
of memory to that variable depending on its data type.
Typically, 32bits for Integer values etc… But if you are
looking to allocate memory while run-time, that will reduce
program’s performance.

7. No run-time dynamics
• Programmer can complete the building process as he has
given and knows all the resources needed by the program to
run. But, if program is designing memory capacities and
other things while run time, potential for generating an
error is much higher.

Disadvantages of Option Explicit:

1. Declaring variable names and its data types and all


other things take some time. It is not just about the
coding; programmer must design it at the specification stage
of the program. (That is even before he sit before an
computer to code the program)

2. After declaring an variable, the variable can have


fixed Range of values. This limits the productivity or the
usability of a variable, because when we don’t need the
existing value in a variable, still we can’t assign another
value which is not similar to variables’ data type.

3. When assigning values to declared variables, compiler


or interpreter need to check whether the input matches the
data type. This slows down the processing.

However, importance of ‘Option Explicit’ Statement has


increased by providing alternative mechanisms on ‘Option
Explicit’ disadvantages. For example, newer VB versions have
integer data types in different modes – 16 bit, 32 bit etc…
What is InStr()

Answer a) When the use the two are more string then use
# 2 instr ()
b) Ex: - This like instr (str1, str2, ?)
Think and Reply.. can we parameterize radio buttons, check boxes? as in flight web site on
flight preference page, choosing different flight produces trouble if from port and to port
been parameterize, and runs. Try it by own you will get the error.

Answer I think radio buttons and check boxes can't be


# 3 parameterized.

The values for radio buttons and check boxes are


ENABLE AND

DISABLE.Those values are constant. Other than these


values what else can u supply.
what is the script to select 2 or more than 2 options from a listbox.

Answer Browser().Page.().weblist().Select " "


# 1 Browser().Page.().weblist().Extendselect " "
by using extend method we can select ata time two name
sin list box
what is smart identification in qtp? pls any give details? thanks in advance

Answer Smart Identification : Its a mechanism provided by Quick


# 3 Test to identify dynamic bjects whose properties are
changing time to time....( Say a Submit button changes to
Save after clicking once)
Now the test property of that button is changed.If we
generate the script statement
Window("windowname").dialog("dialogname").winbutton
("submit").click

beacuse submit button is no more available in window

Generally Object Identification is done using the physical


description (Mandatory and Assistive properties) of that
object in the object repository.

But If we want to enable Smart Identification we have 2


ways.

1) enable Smart Identification for Object class


2) enable Smart Identification for a single Object

If we want to enable Smart Identification for entire object


class
Go to Object Identification---> select the environment--->
select the object class---> check the enable smart
identification checkbox in object Identification dialog

If we want to enable Smart Identification for a specific


object

Go to Object Repository---> select the environment--->


select the object class--->select the object---> check the
enable smart identification checkbox in object Repository
dialog

And we should select the Base Filter and Optional filter


properties for the selected object class/object.

When we enable this smart Identification Quick Test will


try to locate the object based on these properties only.
Can I do Game testing with QTP tool

Answer It depends on the technology and environment you are


# 1 using.

If the game contains multi-media, then you cannon


automate
with QTP.
QTP does not support Multimedia support. Where as in
earlier versions QTP6.5 supports multimedia.
How recognize QTP Dyanamic Image? (suppose tha wedpage contains 3 logos..1 square
2.circle 3.rectangel)there changing at same position how to capture that)

Answer We can add one square image in Object repository and


# 3 let's
say that its file name is "square.gif". Mow while
recognising circle and rectangle, we can set the file
names
dynamically in our code to "circle.gif" for circle
and "rectangle.gif" for rectangle respectively
what is object repository size?
QTP 8.2 Object Repository Size is 1.4 mb

What is the difference between Mandatory and BaseFilter Properies..Anybody please answer
me..Thanks in Advance

Answe Mandatory properties are those property which use by


r QTp to
recognize object od application.
#  3 Base Filter property used by Smart Identification
mechanismto recognize run time object properties
which change at run time 
How to handle Recovery scenario in QTP. give detailed explanation about recovery scenario.

Answer Unexpected events, errors, and application crashes


# 2 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.
The Recovery Scenario Manager provides a wizard that
guides
you through the process of defining a recovery
scenario,
which includes a definition of an unexpected event and
the
operation(s) necessary to recover the run session.

A recovery scenario consists of the following:

Trigger Event. The event that interrupts your run


session.
For example, a window that may pop up on screen, or a
QuickTest run error.

Recovery Operation(s). The operation(s) to perform to


enable QuickTest to continue running the test after the
trigger event interrupts the run session. For example,
clicking an OK button in a pop-up window, or restarting
Microsoft Windows.

Post-Recovery Test Run Option. The instructions on how


QuickTest should proceed after the recovery operations
have
been performed, and from which point in the test
QuickTest
should continue, if at all. For example, you may want
to
restart a test from the beginning, or skip a step
entirely
and continue with the next step in the test.
what are the different kinds of frameworks in automation?

Answer framework is nothing but ..reusable Structure Nd it is


# 2 a
complex internal architecture..means end user can
understand
easily...
types:
1.keyword driven
2.functional decomposition
3.hybrid
4.data-driven......
frame work is a set of guide lines, assumptions and process
developed by experts in order to perform a tasks in an
affective,efficient, and optimized way

automation frame work is not a qtp feature its a third


party concept and this is purely local concept "frame work
may vary from company to another types of frame works
--- record/playback or linearframe work (it is first
generation frame work)
--- modular frame work
---data driven frame work
---hybrid frame work
---key word driven frame work
in the above frame works key word driven frame work is
famous in the industry
Give me some scripts for 1). checking webpage links (counting links,opening web
pages,counting child elements)

Answer ' Create object references to the Browser and Page


# 1 objects.
Set BrowserObj =Browser("Yahoo!")
Set BrowserPageObj = Browser("Yahoo!").Page("Yahoo!")

' Set a description object to identify links.


Set oDesc = Description.Create()
oDesc("html tag").Value = "A"

' Get a collection of links


Set oLinkCollection = BrowserPageObj.ChildObjects(oDesc)
ItemCnt = oLinkCollection.Count-1
' Loop through the link collection
For i = 0 to ItemCnt
msg = ""
' Highlight and click link i.
Set oLink = oLinkCollection.Item(i)
oLink.Highlight
linkText = oLink.GetROProperty("innertext")

msg = "link text = " & linkText & vbNewLine


oLink.Click
BrowserObj.Sync

' Read page title.


titleStr =
mid(BrowserPageObj.GetROProperty("title"),1,50)
msg = msg & "page title = " & titleStr & vbNewLine

' Check if page load had error.


If instr(1,titleStr,"Cannot find server") > 0 or
instr(1,titleStr,"HTTP 404") > 0 Then
msg = msg & "==> broken link" & vbNewLine
Reporter.ReportEvent micFail, "Link " &
linkText, msg
else
msg = msg & "==> good link" & vbNewLine
Reporter.ReportEvent micPass, "Link " &
linkText, msg
End If

' Navigate back to links page.


BrowserObj.Back
BrowserObj.Sync

' Rebuild link collection, navigating away and back


destroys previous collection.
Set oLinkCollection =
BrowserPageObj.ChildObjects(oDesc)
Next

' Release the objects


Set oLinkCollection = nothing
Set BrowserObj = nothing
Set BrowserPageObj = nothing
Set oDesc = nothing
Explain the QTP Tool interface.

Answer It contains the following key elements:


# 1
1.Title bar, displaying the name of the currently open
test

2.Menu bar, displaying menus of QuickTest commands

3.File toolbar, containing buttons to assist you in


managing tests

4.Test toolbar, containing buttons used while creating


and
maintaining tests

5.Debug toolbar, containing buttons used while


debugging
tests.

Note: The Debug toolbar is not displayed when you open


QuickTest for the first time. You can display the Debug
toolbar by choosing View > Toolbars > Debug.

6.Action toolbar, containing buttons and a list of


actions,
enabling you to view the details of an individual
action or
the entire test flow.

Note: The Action toolbar is not displayed when you open


QuickTest for the first time. You can display the
Action
toolbar by choosing View > Toolbars > Action. If you
insert
a reusable or external action in a test, the Action
toolbar
is displayed automatically.

7.Test pane, containing two tabs to view your test-the


Tree
View and the Expert View Test Details pane, containing
the
Active Screen.

8.Data Table, containing two tabs, Global and Action,


to
assist you in parameterizing your test Debug Viewer
pane,
containing three tabs to assist you in debugging your
test-
Watch Expressions, Variables, and Command. (The Debug
Viewer pane can be opened only when a test run pauses
at a
breakpoint.)

9.Status bar, displaying the status of the test.


Hello! i am having two comboboxes.Each having 10 items in it.when i select first item in first
combobox,it is not similar in the second combobox.for ex in first combo if it is Hyderabad,in second it
should be some chenai or some other item .Write a VBSCRIPT for that?

Answer We can do this in two ways...


# 3
1. Get all items from two combo boxes and store in two
separate arrays or in DataTable... "Your convenient process"

2. Validate one after the other dynamically in Loop...

I will keep one way here which I feel Logically better

2.
dim exp,act,cmb_1,cmb_2

cmb_1_cnt=browser("...").page("....").weblist
("...").getitemcount

for i=1 to cmb_1_cnt

exp=browser("...").page("...").weblist("...").getitem(i)

call cmb_2_Func()

reporter.reportevent micPass,"Test is Passed","Two


comboBoxes contain Different Items"

Next

Function cmb_2_Func()

cmb_2_cnt=browser("...").page("...").weblist
("...").getitemcount

for i=1 to cmb_2_cnt

act=browser("...").page("...").weblist("...").getitem

if (act=exp) then

reporter.reportevent micFail,"Test is Failed","Two


ComboBoxes contain Same Item"
End For

End if

Next

End Function
Is there any option in QTP to add Java add-in after instaling the QTP?

Answer Yes, first you have to install QTP after you are
# 1 enable to install Add ins as .net, oracle, java, etc.

how can you describe the basic flow of automation with conditional and programmatic logic?

Answer if endif
# 1 for next
while-wend
do-loop
should be used to control the flow of automation
What is the abbrivation of .mtr in action reposirtory?
Answer
# 2 mtr stands for mercury test repository

does qtp runs on internet explorer 7.0


Since qtp does not require
IE to open unlike QC it really does not matter. Basically
QTP is independent of IE
IE7.0 works with QTP9.2
QTP 8.2 does not compatible with IE 7.0
QTP works on I.E 6.0,7.0 the same way if u record the
application and play back.

i.e Browser("name").Page("name"). in this case ur giving


the browser name and page name if there are 100 browsers
also QTP will run your script.

But if Browser("micClass:=").Page("micClass:="). in this


case u directly declare the class to which browser
belongs.Then QTP cant work on different Browsers and Page's

It depends on the way u have learnt QTP


If you have testcases that worked like a sharm with QTP +
IE6, but does not work with QTP + IE7. Then you should try
to disable the tabbed broswing functionality in IE ("Tools -
-> Internet Options --> General --> Tabs --> Settings" and
untick the "Enable tabbed browsing..."-checkbox).

QTP have some issues with the tabbed browsing functionality


in IE7.
What is the Difference between Environment variable and Globle variable,.. anybody can give
me answer..Thanks in advance...

Answer Environmental variables:it is like


# 4 a global variable.We can
use it in different tests and
actions.

Global variables:it can be used


within a test and multiple
actions.

local variables:it can be used


within a test and an action.
 

e: we have 10 more actions in our test and we are using exit action command to come out
from the action if any error s occured.In action 1 if any error occurs control is moving to
second action but if we get error in second action exitaction is throwing general run error.
Please give a idea to overcome .

Answer General Error occurs whenever QTP


# 1 intercepts any object
which it fails to identify
uniquely because the properties
given by you in the code matches
with many of the objects
present at that time.
So, the ExitAction cannot throw
such an error and this
error must be thrown by some line
code before you are
actually exiting the action.
Please confirm it n then reply in
case you find it nt the
case.
 

how u conduct GUI testing and PERFORMANCE testing on MS- WORD? and What r the GUI
Test Cases and performance Test Cases?

AnswerGui Testing can be done on MS-word


# 1 by following 6 standard
rules of microsoft.
gui test cases are
1)proper alignement of the menu
and submenu
2)no over lapping of menus
3)equals sizes of all the menu
items
Gui testing is done manually
Performance Test cases :
1. Load the Word document to its maximum pages(say more
than 1000 pages)
2.At this load, Try searching for a phrase in the
document
and check the resposne time.
3. Try to edit some line in the document and save the
document .check the responsetime to get saved.
4.close and reopen the document and test for its resposne
time.
5.Try adding some more data to the already loaded
document
and see the response time for the data to get pasted on
it.
 Synchronization methods?

Answer synchronization is a process of making


# 5 the speed of
application and the speed of QTP in
sink.

there are 4 ways of synchronization

1) inserting synchronization
point
2) inserting wait() method
3) using .exist() method
4) increasing the global
syncronization time
Hi, OUR PROJECT NAME IS: HOSPITAL CONTROL SYSTEM. IS IT COMES UNDER WHICH
DOMAIN(HEALTH CARE OR HEALTH INSURANCE)

Answer
# 1 it comes in Health care domain.

How u do the back end testing in QTP?

Answer To automate backend testing we can use


# 1 database check
point.during this testing testors r
checking the impact of
frond end operation on backend table in
terms of
verification and validation
You say it is a bug but developer say it is not a bug then what will you do?

Answer The requirements documentation is the


# 1 source of truth. If
the application is not behaving as
specified in the
requirements then it is a defect. If a
requirements change
is necessary then the only the Business
can approve this
change, not the developers or the testers
Hello, How can i capture first letter of any string using QTP. For ex.. i want "j" in the below
string "john" could any one explain me? Is there any function for that?
Answer str="john"
# 1 msgbox(left(str,1))

suppose i opened 6browsers and i want re-open the 4browser what is code for this..pls help
me..

Answer BrowserName =
# 2 Browser("CreationTime:=3").GetROProperty
("URL")
systemutil.Run BrowserName
 

What is the function of Filter in QC . give with a real time example.

Answer Function of Filter in QC is to retrive the


# 1 data from as per
your requirement.

Like :
1. If you want any perticular defect from
1000 logged
defect list.
2. You can filter Defect entered by some
person.
3. You can filter Defect Assigned to some
person.
4. You can filter Status of defect. etc
what is On Error Resume Next ?

Answer On Error Resume Next is one of the way to


# 3 handle the
predictible errors while running the QTP
Scripts.That is If
you can predict that a certain event may
happen at a
specific point in your test or
component,and to skip that
error we opt for "on error resume next",
rather than
depending on a recovery scenario.
WHAT IS THE SIZE OF OBJECT REPOSITORY USING IN YOUR COMPANY

there is no limit for QTP 9.2 and beyound....


the only thing is ".tsr" if too bulky or large ...then
difficult to handle.. there will be multiple redundency in
large OR (object repository)....
 the
object reposarity size is 64 mb
Will QTP Support Japanese Language?
Answer Whenever we want 2 test the Localization
# 2 Testing.
QTP support Japanese and English
languages.
But when u instal QTP.
U will select the Languages Option
Is it correct?
1.how can we report the QTP test result in a different excel sheet 2.

Answer 'Parameterization ... Data Table (Global Sheet) for


# 2 Flight
Reservation

Invokeapplication "C:\Program Files\Mercury


Interactive\QuickTest
Professional\samples\flight\app\flight4a.exe"
'or
'SystemUtil.Run "C:\Program Files\Mercury
Interactive\QuickTest
Professional\samples\flight\app\flight4a.exe"

Dialog("Login").WinEdit("Agent Name:").Set
DataTable("Agent_Name", dtGlobalSheet)
Dialog("Login").WinEdit("Password:").Set
DataTable("Pword",dtGlobalSheet)
Dialog("Login").WinButton("OK").Click

If Window("Flight Reservation").Exist then


Window("Flight Reservation").WinMenu("Menu").Select
"File;Exit"
DataTable.Value("Act_Res")="Pass"
Reporter.ReportEvent 0,"Login Details","Valid Values"
else
Dialog("Login").Activate
Dialog("Login").WinButton("Cancel").Click
DataTable.Value("Act_Res")="Fail"
Reporter.ReportEvent 1,"Login Details","Invalid
Values"
End If

er=DataTable("Exp_Res",dtGlobalSheet)
ar=DataTable("Act_Res",dtGlobalSheet)
If Strcomp(er,ar)=0 Then
DataTable.Value("Remarks")="OK"
Else
DataTable.Value("Remarks")="Defect"
End If
DataTable.Export("D:\QTP9\LoginResults.xls")

Note: Create a data table in QTP and enter the


following details
Agent_Name Pword Act_Res Exp_Res Remarks
puneeth mercury Pass
pooja mercury Pass
soumya mareiou Fail
mahesh miaoreu Fail
shivakumar mercury Pass
 hi testers,one script has three actions , at the of running three actions are running , how to
set run only perticular action and what is the use of split the action? when it will be useful?

Answer Hi,
# 2 If you don't split the test in to
action, each time
you run it'll run the whole test. which
is the waste of
time and efforts.Splitting the action is
useful especially
when we parameterize the object.When you
parameterize the
object if you don't split into actions
the whole test will
run that many iterations.
We can't set particular action to run
but we can specify
how many time the particular action
should run. This can be
done by selecting the action and right
click and select the
action call property and make sure the
run tab is selected
and in that you can specify how many
times the action
should run.
example-date format is 01-jan-09 in QTP.How to convert this format to 01-01-09?

Answer It's very simple question;


# 7 no need to write all the
excessive code.
Please convert the given value
into date format by using
the CDATE Function

val = "01-jan-09"
Conv_Val = cdate(val)
msgbox Conv_Val

Result : "01-01-2009"
WHAT ARE THE SHORTCUT KEYS IN QTP?

Answer record purpose : f3


# 1 to run the script :f5
get newpge :ctrl+n
to save the script :ctrl+s
to open test :ctrl+o
 

nswer object repository ctrl+r


# 2 for comment ctrl+m
for uncomment ctrl+shift+m
 

You might also like