Вы находитесь на странице: 1из 12

1. How Does Run time data (Parameterization) is handled in QTP?

A) You can then enter test data into the Data Table an inte!rated
s"readsheet with the #ull #unctionalit$ o# %&cel to mani"ulate data
sets and create multi"le test iterations without "ro!rammin! to
e&"and test case co'era!e. Data can be t$"ed in or im"orted #rom
databases s"readsheets or te&t #iles.
() )hat is *e$word 'iew and %&"ert 'iew in QTP?
A) Quic*Test+s ,e$word Dri'en a""roach test automation e&"erts
ha'e #ull access to the underl$in! test and ob-ect "ro"erties 'ia an
inte!rated scri"tin! and debu!!in! en'ironment that is round.tri"
s$nchronized with the ,e$word /iew.
Ad'anced testers can 'iew and edit their tests in the %&"ert /iew
which re'eals the underl$in! industr$.standard /01cri"t that
Quic*Test Pro#essional automaticall$ !enerates. An$ chan!es
made in the %&"ert /iew are automaticall$ s$nchronized with the
,e$word /iew.
2) To which en'ironments does a QTP su""ort?
A) Quic*Test Pro#essional su""orts #unctional testin! o# all enter"rise
en'ironments includin! )indows )eb ..3%T 4a'a54(%% 1AP
1iebel 6racle Peo"le1o#t /isual 0asic Acti'e7 main#rame
terminal emulators and )eb ser'ices.
8) )hat is QTP?
A) Quic*Test is a !ra"hical inter#ace record."la$bac* automation tool. 9t is able to wor* with an$
web -a'a or windows client a""lication. Quic* Test enables $ou to test standard web ob-ects and
Acti'e7 controls. 9n addition to these en'ironments Quic*Test Pro#essional also enables $ou to
test 4a'a a""lets and a""lications and multimedia ob-ects on A""lications as well as standard
)indows a""lications /isual 0asic : a""lications and .3%T #ramewor* a""lications...
:) %&"lain QTP Testin! "rocess ?
A) The Quic*Test testin! "rocess consists o# : main "hases;
Create your test plan
Prior to automatin! there should be a detailed descri"tion o# the test includin! the e&act
ste"s to #ollow data to be in"ut and all items to be 'eri#ied b$ the test. The 'eri#ication
in#ormation should include both data 'alidations and e&istence or state 'eri#ications o#
ob-ects in the a""lication.
Recording a session on your application
As $ou na'i!ate throu!h $our a""lication Quic*Test !ra"hicall$ dis"la$s each step $ou
"er#orm in the #orm o# a colla"sible icon.based test tree. A ste" is an$ user action that
causes or ma*es a chan!e in $our site such as clic*in! a lin* or ima!e or enterin! data in
a #orm.
Enhancing your test
9nsertin! checkpoints into $our test lets $ou search #or a s"eci#ic 'alue o# a "a!e ob-ect or
te&t strin! which hel"s $ou identi#$ whether or not $our a""lication is #unctionin! correctl$.
36T%; <hec*"oints can be added to a test as $ou record it or a#ter the #act 'ia the
Acti'e 1creen. 9t is much easier and #aster to add the chec*"oints durin! the
recordin! "rocess.
0roadenin! the sco"e o# $our test b$ re"lacin! #i&ed 'alues with parameters lets $ou chec*
how $our a""lication "er#orms the same o"erations with multi"le sets o# data.
Addin! lo!ic and conditional statements to $our test enables $ou to add so"histicated chec*s
to $our test.
Debugging your test
9# chan!es were made to the scri"t $ou need to debu! it to chec* that it o"erates
smoothl$ and without interru"tion.
Running your test on a new version of your application
You run a test to chec* the beha'ior o# $our a""lication. )hile runnin! Quic*Test connects
to $our a""lication and "er#orms each ste" in $our test.
Analyzing the test results
You e&amine the test results to "in"oint de#ects in $our a""lication.
Reporting defects
As $ou encounter #ailures in the a""lication when anal$zin! test results $ou will create
de#ect re"orts in De#ect Re"ortin! Tool.
=) How QTP reco!nizes 6b-ects in A>T?
A) Quic*Test stores the de#initions #or a""lication ob-ects in a #ile called the 6b-ect Re"ositor$. As
$ou record $our test Quic*Test will add an entr$ #or each item $ou interact with. %ach 6b-ect
Re"ositor$ entr$ will be identi#ied b$ a logical name (determined automaticall$ b$ Quic*Test) and
will contain a set o# properties (t$"e name etc) that uni?uel$ identi#$ each ob-ect.
%ach line in the Quic*Test scri"t will contain a re#erence to the ob-ect that $ou interacted with a
call to the a""ro"riate method (set clic* chec*) and an$ "arameters #or that method (such as
the 'alue #or a call to the set method). The re#erences to ob-ects in the scri"t will all be identi#ied
b$ the logical name rather than an$ "h$sical descri"ti'e "ro"erties.
@) )hat are the t$"es o# 6b-ect Re"ositor$+s in QTP?
A) Quic*Test has two t$"es o# ob-ect re"ositories #or storin! ob-ect in#ormation; shared object
repositories and action object repositories. You can choose which t$"e o# ob-ect re"ositor$ $ou
want to use as the de#ault t$"e #or new tests and $ou can chan!e the de#ault as necessar$ #or
each new test.
The object repository per-action mode is the de#ault settin!. 9n this mode Quic*Test automaticall$
creates an ob-ect re"ositor$ #ile #or each action in $our test so that $ou can create and run tests
without creatin! choosin! or modi#$in! ob-ect re"ositor$ #iles. Howe'er i# $ou do modi#$ 'alues
in an action ob-ect re"ositor$ $our chan!es do not ha'e an$ e##ect on other actions. There#ore i#
the same test ob-ect e&ists in more than one action and $ou modi#$ an ob-ectAs "ro"ert$ 'alues in
one action $ou ma$ need to ma*e the same chan!e in e'er$ action (and an$ test) containin! the
ob-ect.
1B) %&"lain the chec* "oints in QTP?
A) . A checkpoint 'eri#ies that e&"ected in#ormation is dis"la$ed in a A""lication while the test is
runnin!. You can add ei!ht t$"es o# chec*"oints to $our test #or standard web ob-ects usin! QTP.
A page checkpoint chec*s the characteristics o# a A""lication
A text checkpoint chec*s that a te&t strin! is dis"la$ed in the a""ro"riate "lace on a
A""lication.
An object checkpoint (1tandard) chec*s the 'alues o# an ob-ect on a A""lication.
An image checkpoint chec*s the 'alues o# an ima!e on a A""lication.
A table checkpoint chec*s in#ormation within a table on a A""lication
An Accessiblity checkpoint chec*s the web "a!e #or 1ection 8B= com"liance.
An XML checkpoint chec*s the contents o# indi'idual 7CD data #iles or 7CD documents that are
"art o# $our )eb a""lication.
A database checkpoint chec*s the contents o# databases accessed b$ $our web site
9n how man$ wa$s we can add chec* "oints to an a""lication usin! QTP.
)e can add chec*"oints while recordin! the a""lication or we can add a#ter recordin! is
com"leted usin! Acti'e screen (3ote ; To "er#orm the second one The Acti'e screen must be
enabled while recordin!).
How does QTP identi#es the ob-ect in the a""lication
QTP identi#ies the ob-ect in the a""lication b$ Do!ical3ame and <lass.
Eor e&am"le ;
The %dit bo& is identi#ied b$
Do!ical 3ame; P16PT9631F01%FT9C%(B
<lass; )eb%dit
9# an a""lication name is chan!es #re?uentl$ i.e while recordin! it has name G)indow1H and
then while runnin! its G)indows(H in this case how does QTP handles?
QTP handles those situations usin! GRe!ular %&"ressionsH.
)hat is Parameterizin! Tests?
)hen $ou test $our a""lication $ou ma$ want to chec* how it "er#orms the same o"erations
with multi"le sets o# data. Eor e&am"le su""ose $ou want to chec* how $our a""lication res"onds
to ten se"arate sets o# data. You could record ten se"arate tests each with its own set o# data.
Alternati'el$ $ou can create a "arameterized test that runs ten times; each time the test runs it
uses a di##erent set o# data.
)hat is test ob-ect model in QTP ?
A) The test object model is a lar!e set o# ob-ect t$"es or classes that Quic*Test
uses to re"resent the ob-ects in $our a""lication. %ach test ob-ect class has a
list o# "ro"erties that can uni?uel$ identi#$ ob-ects o# that class and a set o#
rele'ant methods that Quic*Test can record #or it.
A test object is an ob-ect that Quic*Test creates in the test or com"onent to
re"resent the actual ob-ect in $our a""lication. Quic*Test stores in#ormation
about the ob-ect that will hel" it identi#$ and chec* the ob-ect durin! the
run session.
A run-time object is the actual ob-ect in $our )eb site or a""lication on
which methods are "er#ormed durin! the run session.
)hen $ou "er#orm an o"eration on $our a""lication while recordin!
Quic*Test;
identi#ies the Quic*Test test ob-ect class that re"resents the ob-ect on which
$ou "er#ormed the o"eration and creates the a""ro"riate test ob-ect
reads the current 'alue o# the ob-ect+s "ro"erties in $our a""lication and
stores the list o# "ro"erties and 'alues with the test ob-ect
chooses a uni?ue name #or the ob-ect !enerall$ usin! the 'alue o# one o# its
"rominent "ro"erties
records the o"eration that $ou "er#ormed on the ob-ect usin! the
a""ro"riate Quic*Test test ob-ect method
Eor e&am"le su""ose $ou clic* on a Find button with the #ollowin! HTCD
source code;
I93P>T TYP%JKsubmitK 3AC%JKEindK /AD>%JKEindKL
Quic*Test identi#ies the ob-ect that $ou clic*ed as a WebButton test ob-ect.
9t creates a )eb0utton ob-ect with the name Eind and records the #ollowin!
"ro"erties and 'alues #or the Eind )eb0utton;
9t also records that $ou "er#ormed a Clic method on the )eb0utton.
Quic*Test dis"la$s $our ste" in the ,e$word /iew li*e this;
Quic*Test dis"la$s $our ste" in the %&"ert /iew li*e this;
0rowser(KCercur$ 9nteracti'eK).Pa!e(KCercur$ 9nteracti'eK).
)eb0utton(KEindK).<lic*
)hat is 6b-ect 1"$ in QTP?
A) >sin! the 6b-ect 1"$ $ou can 'iew the "ro"erties o# an$ ob-ect in an o"en
a""lication. You use the 6b-ect 1"$ "ointer to "oint to an ob-ect. The 6b-ect
1"$ dis"la$s the selected ob-ect+s hierarch$ tree and its "ro"erties and 'alues
in the Pro"erties tab o# the 6b-ect 1"$ dialo! bo&.
1u""orted <hec*.Points in QTP?
)hat is the Di## between 9ma!e chec*."oint and 0it ma" <hec* "oint?
A) 9ma!e chec*"oints enable $ou to chec* the "ro"erties o# a )eb ima!e.
You can chec* an area o# a )eb "a!e or a""lication as a bitma". )hile
creatin! a test or com"onent $ou s"eci#$ the area $ou want to chec* b$
selectin! an ob-ect. You can chec* an entire ob-ect or an$ area within an
ob-ect. Quic*Test ca"tures the s"eci#ied ob-ect as a bitma" and inserts a
chec*"oint in the test or com"onent. You can also choose to sa'e onl$ the
selected area o# the ob-ect with $our test or com"onent in order to sa'e dis* 1"ace
Eor e&am"le su""ose $ou ha'e a )eb site that can dis"la$ a ma" o# a cit$
the user s"eci#ies. The ma" has control *e$s #or zoomin!. You can record the
new ma" that is dis"la$ed a#ter one clic* on the control *e$ that zooms in
the ma". >sin! the bitma" chec*"oint $ou can chec* that the ma" zooms
in correctl$.
You can create bitma" chec*"oints #or all su""orted testin! en'ironments
(as lon! as the a""ro"riate add.ins are loaded).
!ote" The results o# bitma" chec*"oints ma$ be a##ected b$ #actors such as
o"eratin! s$stem screen resolution and color settin!s.
How man$ wa$s we can "arameterize data in QTP ?
A) There are #our t$"es o# "arameters;
#est$ action or component parameters enable $ou to use 'alues "assed
#rom $our test or com"onent or 'alues #rom other actions in $our test.
Data #able parameters enable $ou to create a data-driven test (or action)
that runs se'eral times usin! the data $ou su""l$. 9n each re"etition or
iteration Quic*Test uses a di##erent 'alue #rom the Data Table.
Environment variable parameters enable $ou to use 'ariable 'alues #rom
other sources durin! the run session. These ma$ be 'alues $ou su""l$ or
'alues that Quic*Test !enerates #or $ou based on conditions and o"tions
$ou choose.
Random number parameters enable $ou to insert random numbers as
'alues in $our test or com"onent. Eor e&am"le to chec* how $our
a""lication handles small and lar!e tic*et orders $ou can ha'e Quic*Test
!enerate a random number and insert it in a number of ticets edit #ield.
%%& what does it mean when a chec point is in red color' what do u do'
Ans ; A red color indicates #ailure. Here we anal$ze the cause #or #ailure whether it is a 1cri"t
9ssue or %n'ironment 9ssue or a A""lication issue.
()& *ynta+ for how to call one script from another' and *ynta+ to call one ,Action, in
another'
Ans; RunAction Action3ame M9terationCode 9terationRan!e ParametersN
Here the action becomes reusable on ma*in! this call to an$ Action.
9terationRan!e 1trin! 3ot alwa$s re?uired. 9ndicates the rows #or which action iterations will
be "er#ormed. /alid onl$ when the 9terationCode is rn!9terations. %nter the row ran!e
(i.e. K1.OK) or enter rn!All to run iterations on all rows.
9# the action called b$ the RunAction statement includes an %&itAction statement the RunAction
statement can return the 'alue o# the %&itActionAs Ret/al ar!ument.
-.& how to add a runtime parameter to a datasheet'
Ans;
DataTable.Docal1heet
The #ollowin! e&am"le uses the Docal1heet "ro"ert$ to return the local sheet o# the
run.time Data Table in order to add a "arameter (column) to it.

C$ParamJDataTable.Docal1heet.AddParameter(KTimeK K8;28K)
-/& What scripting language is 0#1 of'
Ans ; /0 1cri"tin!
-%& When we try to use test run option ,Run from *tep,$ the browser is not launching
automatically why'
Ans ; This is de#ault beha'iour.
-(&#able and DB Checpoints"
0$ addin! table chec*"oints to $our tests or com"onents $ou can chec* that a s"eci#ied
'alue is dis"la$ed in a cell in a table on $our a""lication. 0$ addin! database chec*"oints to $our
tests or com"onents $ou can chec* the contents o# databases accessed b$ $our a""lication.
The results dis"la$ed #or table and database chec*"oints are similar. )hen $ou run $our
test or com"onent Quic*Test com"ares the e&"ected results o# the chec*"oint to the actual
results o# the run session. 9# the results do not match the chec*"oint #ails.
You can chec* that a s"eci#ied 'alue is dis"la$ed in a cell in a table b$ addin! a table
chec*"oint to $our test or com"onent. Eor Acti'e7 tables $ou can also chec* the "ro"erties o# the
table ob-ect. To add a table chec*"oint $ou use the <hec*"oint Pro"erties dialo! bo&.
Table chec*"oints are su""orted #or )eb and Acti'e7 a""lications as well as #or a 'ariet$
o# e&ternal add.in en'ironments.
You can use database chec*"oints in $our test or com"onent to chec* databases accessed
b$ $our )eb site or a""lication and to detect de#ects. You de#ine a ?uer$ on $our database and
then $ou create a database chec*"oint that chec*s the results o# the ?uer$.
Database chec*"oints are su""orted #or all en'ironments su""orted b$ Quic*Test b$
de#ault as well as #or a 'ariet$ o# e&ternal add.in en'ironments.
There are two wa$s to de#ine a database ?uer$;
(a) >se Cicroso#t Quer$. You can install Cicroso#t Quer$ #rom the custom installation o#
Cicroso#t 6##ice.
(b) Canuall$ de#ine an 1QD statement.
The <hec*"oint timeout o"tion is a'ailable onl$ when creatin! a table chec*"oint. 9t is not
a'ailable when creatin! a database chec*"oint
--& Checing Bitmaps"
You can chec* an area o# a )eb "a!e or a""lication as a bitma". )hile creatin! a test or
com"onent $ou s"eci#$ the area $ou want to chec* b$ selectin! an ob-ect. You can chec* an
entire ob-ect or an$ area within an ob-ect. Quic*Test ca"tures the s"eci#ied ob-ect as a bitma"
and inserts a chec*"oint in the test or com"onent. You can also choose to sa'e onl$ the selected
area o# the ob-ect with $our test or com"onent in order to sa'e dis* s"ace.
)hen $ou run the test or com"onent Quic*Test com"ares the ob-ect or selected area o#
the ob-ect currentl$ dis"la$ed on the )eb "a!e or a""lication with the bitma" stored when the
test or com"onent was recorded. 9# there are di##erences Quic*Test ca"tures a bitma" o# the
actual ob-ect and dis"la$s it with the e&"ected bitma" in the details "ortion o# the Test Results
window. 0$ com"arin! the two bitma"s (e&"ected and actual) $ou can identi#$ the nature o# the
discre"anc$. Eor more in#ormation on test results o# a chec*"oint see /iewin! <hec*"oint Results.
Eor e&am"le su""ose $ou ha'e a )eb site that can dis"la$ a ma" o# a cit$ the user
s"eci#ies. The ma" has control *e$s #or zoomin!. You can record the new ma" that is dis"la$ed
a#ter one clic* on the control *e$ that zooms in the ma". >sin! the bitma" chec*"oint $ou can
chec* that the ma" zooms in correctl$.
You can create bitma" chec*"oints #or all su""orted testin! en'ironments (as lon! as the
a""ro"riate add.ins are loaded).
3ote; The results o# bitma" chec*"oints ma$ be a##ected b$ #actors such as o"eratin!
s$stem screen resolution and color settin!s.
-2&#e+t3#e+t Area Checpoint "
9n the Te&t5Te&t Area <hec*"oint Pro"erties dialo! bo& $ou can s"eci#$ the te&t to be
chec*ed as well as which te&t is dis"la$ed be#ore and a#ter the chec*ed te&t. These con#i!uration
o"tions are "articularl$ hel"#ul when the te&t strin! $ou want to chec* a""ears se'eral times or
when it could chan!e in a "redictable wa$ durin! run sessions.
3ote; 9n )indows.based en'ironments i# there is more than one line o# te&t selected the
<hec*"oint 1ummar$ "ane dis"la$s Mcom"le& 'alueN instead o# the selected te&t strin!. You can
then clic* <on#i!ure to 'iew and mani"ulate the actual selected te&t #or the chec*"oint.
Quic*Test automaticall$ dis"la$s the <hec*ed Te&t in red and the te&t be#ore and a#ter the
<hec*ed Te&t in blue. Eor te&t area chec*"oints onl$ the te&t strin! ca"tured #rom the de#ined
area is dis"la$ed (Te&t 0e#ore and Te&t A#ter are not dis"la$ed).
To desi!nate "arts o# the ca"tured strin! as <hec*ed Te&t and other "arts as Te&t 0e#ore
and Te&t A#ter clic* the <on#i!ure button. The <on#i!ure Te&t 1election dialo! bo& o"ens
<hec*in! 7CD ;
7CD (%&tensible Car*u" Dan!ua!e) is a meta.mar*u" lan!ua!e #or te&t documents that is
endorsed as a standard b$ the )P<. 7CD ma*es the com"le& data structures "ortable between
di##erent com"uter en'ironments5o"eratin! s$stems and "ro!rammin! lan!ua!es #acilitatin! the
sharin! o# data.
7CD #iles contain te&t with sim"le ta!s that describe the data within an 7CD document.
These ta!s describe the data content but not the "resentation o# the data. A""lications that
dis"la$ an 7CD document or #ile use either <ascadin! 1t$le 1heets (<11) or 71D Eormattin!
6b-ects (71D.E6) to "resent the data.
You can 'eri#$ the data content o# 7CD #iles b$ insertin! 7CD chec*"oints. A #ew common
uses o# 7CD chec*"oints are described below;
An 7CD #ile can be a static data #ile that is accessed in order to retrie'e commonl$ used
data #or which a ?uic* res"onse time is neededQ#or e&am"le countr$ names zi" codes or area
codes. Althou!h this data can chan!e o'er time it is normall$ ?uite static. You can use an 7CD #ile
chec*"oint to 'alidate that the data has not chan!ed #rom one a""lication release to another.
An 7CD #ile can consist o# elements with attributes and 'alues (character data). There is a
"arent and child relationshi" between the elements and elements can ha'e attributes associated
with them. 9# an$ "art o# this structure (includin! data) chan!es $our a""licationAs abilit$ to
"rocess the 7CD #ile ma$ be a##ected. >sin! an 7CD chec*"oint $ou can chec* the content o# an
element to ma*e sure that its ta!s attributes and 'alues ha'e not chan!ed.
7CD #iles are o#ten an intermediar$ that retrie'es d$namicall$ chan!in! data #rom one
s$stem. The data is then accessed b$ another s$stem usin! Document T$"e De#initions (DTD)
enablin! the accessin! s$stem to read and dis"la$ the in#ormation in the #ile. You can use an 7CD
chec*"oint and "arameterize the ca"tured data 'alues in order to chec* an 7CD document or #ile
whose data chan!es in a "redictable wa$.
7CD documents and #iles o#ten need a well.de#ined structure in order to be "ortable across
"lat#orms and de'elo"ment s$stems. 6ne wa$ to accom"lish this is b$ de'elo"in! an 7CD schema
which describes the structure o# the 7CD elements and data t$"es. You can use schema 'alidation
to chec* that each item o# content in an 7CD #ile adheres to the schema descri"tion o# the element
in which the content is to be "laced.
-) & 4b5ect Repositories types$ Which 6 when to use'
Decidin! )hich 6b-ect Re"ositor$ Code to <hoose
To choose the de#ault ob-ect re"ositor$ mode and the a""ro"riate ob-ect re"ositor$ mode
#or each test $ou need to understand the di##erences between the two modes.
9n !eneral the ob-ect re"ositor$ "er.action mode is easiest to use when $ou are creatin!
sim"le record and run tests es"eciall$ under the #ollowin! conditions;
You ha'e onl$ one or 'er$ #ew tests that corres"ond to a !i'en a""lication inter#ace or
set o# ob-ects.
You do not e&"ect to #re?uentl$ modi#$ test ob-ect "ro"erties.
You !enerall$ create sin!le.action tests.
<on'ersel$ the shared ob-ect re"ositor$ mode is !enerall$ the "re#erred mode when;
You ha'e se'eral tests that test elements o# the same a""lication inter#ace or set o#
ob-ects.
You e&"ect the ob-ect "ro"erties in $our a""lication to chan!e #rom time to time and5or
$ou re!ularl$ need to u"date or modi#$ test ob-ect "ro"erties.
You o#ten wor* with multi.action tests and re!ularl$ use the 9nsert <o"$ o# Action and
9nsert <all to Action o"tions.
-7& Can we *cript any test case with out having 4b5ect repository'
Yes usin! Descri"ti'e Pro!rammin!
-8& 9ow to handle Run:time errors'
(a) 6n %rror Resume 3e&t ; causes e&ecution to continue with the statement immediatel$
#ollowin! the statement that caused the run.time error or with the statement immediatel$
#ollowin! the most recent call out o# the "rocedure containin! the 6n %rror Resume 3e&t
statement. This allows e&ecution to continue des"ite a run.time error. You can then build the
error.handlin! routine inline within the "rocedure.
>sin! K%rrK ob-ect ms!bo& K%rror no; K R K K R %rr.3umber R K K R %rr.descri"tion R K K
R %rr.1ource R %rr.Hel"<onte&t
2.& 9ow to change the run:time value of a property for an ob5ect'
Ans ; 1etT6Pro"ert$ chan!es the "ro"ert$ 'alues used to identi#$ an ob-ect durin! the test
run.
6nl$ "ro"erties that are included in the test ob-ect descri"tion can be set
2/& 9ow to retrieve the property of an ob5ect'
Ans ; usin! KSetRoPro"ert$K.
2%& 9ow to open any application during *cripting'
Ans ; 1$stem>til ob-ect used to o"en and close a""lications and "rocesses durin! a run
session.
(a) A 1$stem>til.Run statement is automaticall$ added to $our test when $ou run an
a""lication #rom the 1tart menu or the Run dialo! bo& while recordin! a test
%.! ; 1$stem>til.Run K3ote"ad.e&eK
1$stem>til.<loseDescendentProcesses ( <loses all the "rocesses o"ened b$
QTP )
2(& #ypes of properties that 0uic #est learns while recording'
Ans ; (a) Candator$ (b) Assisti'e .
9n addition to recordin! the mandator$ and assisti'e "ro"erties s"eci#ied in the
6b-ect 9denti#ication dialo! bo& Quic*Test can also record a bac*u" ordinal identi#ier #or each test
ob-ect. The ordinal identi#ier assi!ns the ob-ect a numerical 'alue that indicates its order relati'e
to other ob-ects with an otherwise identical descri"tion (ob-ects that ha'e the same 'alues #or all
"ro"erties s"eci#ied in the mandator$ and assisti'e "ro"ert$ lists). This ordered 'alue enables
Quic*Test to create a uni?ue descri"tion when the mandator$ and assisti'e "ro"erties are not
su##icient to do so.
2-& What is the e+tension of script and ob5ect repository files'
Ans ; 6b-ect Re"ositor$ ; .tsr 1cri"t ; .mts %&cel ; De#ault.&ls
22& 9ow to suppress warnings from the ,#est results page,'
Ans ; Erom the Test results /iewer KTools L Eilters L )arnin!sK...must be K>nchec*edK.
8:& 9ow to mae arguments optional in a function'
Ans ; this is not "ossible as de#ault /01 doesnAt su""ort this. 9nstead $ou can "ass a blan*
strin! and ha'e a de#ault 'alue i# ar!uments r not re?uired.
27& E+plain Descriptive 1rogramming
Descriptive programming can be useful when you wish to perform the same operation on several objects
with certain identical properties. For example, when you perform a search in your application, you
cannot anticipate how many objects will be returned and add them to the object repository in advance.
Instead, use descriptive programming to create a general description of the object, then use another
property, such as the ordinal identifier, to act on a specific item.
Example:
Browser(!oogle".#age(!oogle".$eb%dit(&".'et test
Browser(!oogle".#age(!oogle".$ebButton(!oogle 'earch".(lic)
wait *
i + ,
Do $hile Browser(!oogle".#age(test - !oogle 'earch"..in)(html tag/+0, index/+1i".%xist
Browser(!oogle".#age(test - !oogle 'earch"..in)(html tag/+0, index/+1i".2ighlight
i + i 3 *
.oop
Descriptive programming is also useful when you need to perform an operation on an object whose
properties match a description determined dynamically during replay.
Example:
4rder5o + 6 7 assume the order number is generated during test execution
$indow(Flight 8eservation".$in%dit(attached text/+ 4rder 5o/, text/+1 4rder5o".2ighlight
How to create a new folder in the file system
9o create a new folder in the file system, use the 'cripting.File'ystem4bject object. :se the !etFolder and
'ubFolders methods to access the file system at the specified path, then use the 0dd method to create the
folder.
;ou can also use the File'ystem4bject (reateFolder method. For more information on the method, please refer
to the <icrosoft =B'cript 8eference.
Example:
'et fso + (reate4bject('cripting.File'ystem4bject"
'et f + fso.(reateFolder(d/>test?folder"
;ou can use the custom 0dd5ewFolder subroutine to do this.
'ub 0dd5ewFolder(path, folder5ame"
Dim fso, f, fc, nf
'et fso + (reate4bject('cripting.File'ystem4bject"
'et f + fso.!etFolder(path"
'et fc + f.'ubFolders
If folder5ame @A 9hen
If 5ot(fso.Folder%xists(path 1 folder5ame"" then 'et nf + fc.0dd(folder5ame" %nd If
%lse
'et nf + fc.0dd(5ew Folder"
%nd If
%nd 'ub
Example:
0dd5ewFolder c/>,myfolder
9he above code chec)s whether the specified folder exists before attempting to create it. If the folder exists,
nothing is done, otherwise the folder is created. If no name is specified for the folder, the folder will be created
with the name 5ew Folder.
How to close all open browsers and objects using VBSCripting ?
QTP works on the principles of unique object identification .f two or !ore browsers or application
windows are open and the sa!e object e"ist in both the browsers# QTP will get confused and unique
object identification will fail .n order to a$oid such failures# it is alwa%s preferred to close all open
browsers and objects using the following co!!ands.
S%ste!&til.CloseProcessB%'a!e ()ie"plore.e"e)*
S%ste!&til.CloseProcessB%'a!e ()e"cel.e"e)*
S%ste!&til.Close+escendentProcesses
,n% process that appears in the task !anager can be closed in this fashion.

Вам также может понравиться