45937502 automation framework

Upload: haibye424

Post on 07-Aug-2018

223 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/20/2019 45937502 Automation Framework

    1/100

    For more QTP scripts, Log onto www.ramupalanki.com 

    www.ramupalanki.com

    QTP

    Frame Work

    http://www.ramupalanki.com/http://www.ramupalanki.com/

  • 8/20/2019 45937502 Automation Framework

    2/100

    For more QTP scripts, Log onto www.ramupalanki.com 

    Table of Contents

    1. Automation Architecture ....................................................... 31.1 Design ........................................................................................................................ 31.2 Approach for Test Automation .................................................................................. 4

    2. Introduction to QTP ........................................................ 112.1 QTP Environment ompati!i"it# ............................................................................. 122.2 $ersions of QTP ...................................................................................................... 13

    3. Add-Ins ............................................................................... 213.1 T#pes of A%%&'ns ..................................................................................................... 213.2 on%itions for A%%&ins ............................................................................................ 22

    4. Conventions ......................................................................... 234.1 Test ase (aming onventions) .............................................................................. 23

    4.2 *cript an% Action (aming onventions) ................................................................ 234.3 $aria!"es an% onstants) .......................................................................................... 2+4.4 Data*heet (aming an% Parameter (aming onventions) ....................................... 24.+ Function (aming onventions ................................................................................ 2-

    5. Settings ............................................................................... 28+.1 QTP Test *ettings .................................................................................................... 2+.2 /ecor% an% /un *ettings .......................................................................................... 20+.3 Active *creen apture Leve" ................................................................................... 20+.4 !ect /epositor# .................................................................................................... 3+.+ Epert $ie5 ............................................................................................................. 32+. *etting re"ate% to the App"ication 6se%) .................................................................. 3+

    . !"#ects ............................................................................... 38.1 !ects .................................................................................................................... 3

    $. %ata Ta"&e .......................................................................... 4'-.1 Datata!"e !ect an% re"ate% Functions) ................................................................. 4-.2 rgani7ing Data *heets for 8"o!a" 9 Loca" varia!"es ............................................ 41-.3 Parameteri7ing using Data %riven :i7ar% ............................................................. 42-.4 'mporting an% Eporting Datasheets) ................................................................... 4

    8. Actions ................................................................................ 4(.1 Actions *ettings ....................................................................................................... 40.2 'terations using ro5s ................................................................................................ +.3 Action Temp"ate ....................................................................................................... +1

    .4 *cript *tartup ........................................................................................................... +1.+ *p"itting Actions, /e&usa!"e Actions, 'nterna";Eterna" Actions ............................ +2

    (. !"#ect )e*ositor+ ................................................................ 530.1 Per Action;*hare% !ect /epositor#) ..................................................................... +30.2

  • 8/20/2019 45937502 Automation Framework

    3/100

    For more QTP scripts, Log onto www.ramupalanki.com 

    1.2 Test Parameters ...................................................................................................... 11.3 Environment $aria!"es .......................................................................................... 31.4 $aria!"e passing from one Action to another ....................................................... 41.+ *cope of $aria!"es .................................................................................................

    11. Chec Points ...................................................................... 8

    11.1 T#pes of hec=points ............................................................................................ 11.2 utput $a"ues for $erification .............................................................................. -

    12. )eusa"&e i"rar+ ................................................................ $212.1 'ntro%uction ........................................................................................................... -312.2 >o5 to esta!"ish a /eusa!"e Li!rar# ..................................................................... -312.3 >o5 to use this /eusa!"e Li!rar#.  ........................................................................ -+

    13. )egu&ar /0*ressions .......................................................... $513.1 Description ............................................................................................................. -+

    14. )ecover+ Scenario ............................................................ 8'14.1 Eceptiona" >an%"ing using /ecover# *cenarios .................................................. 114.2 *amp"e for /ecover# *cenario) ........................................................................... -

    15. !*tiona& Ste*s ................................................................... (31+.1 Description) ........................................................................................................ 03

    1. )e*orting ........................................................................... (51.1 Different ptions for /eporting ............................................................................. 01.2 Functions use% for /eporting .............................................................................. 0-1.3 /eporting Formats ................................................................................................. 00

    1. Automation Architecture

    1.1 Design

    www.ramupalanki.com

    http://www.ramupalanki.com/http://www.ramupalanki.com/

  • 8/20/2019 45937502 Automation Framework

    4/100

    For more QTP scripts, Log onto www.ramupalanki.com 

    1.2 Approach for Test Automation

    Description

    www.ramupalanki.com

    http://www.ramupalanki.com/http://www.ramupalanki.com/

  • 8/20/2019 45937502 Automation Framework

    5/100

    For more QTP scripts, Log onto www.ramupalanki.com 

    Approach for Test Automation is use% for !ui"%ing a strateg# for automation startingfrom the /e?uirement phase ti"" the %ep"o#ment phase. Approach for automation !egins5ith fin%ing out the con%itions an% !usiness ru"es given !# the c"ient an% groupingsimi"ar con%itions, !usiness ru"es together as Test cases or Test *cenarios.

    Steps involved in Approach for Test Automation are as follows:

    • /e?uirement gathering from the c"ient

    • 6n%erstan%ing an% Ana"#7ing the /e?uirement

    • 8rouping the re?uirement into Test cases

    • Preparing the Design for Automation

    • @ui"%ing *cripts %epen%ing on the Design

    • /evie5 of *cripts at ffshore

    • De"iver# to the "ient

    For eamp"e in the 6ni"ever proect)

    *ince it is Proect for Automation of *AP, Team 5as %ivi%e% into t5o,*AP onsu"tants.Testing Team.

    /e?uirement gathering from the c"ient inc"u%e% =no5"e%ge transfer at onsite, 5here a""the transactions inc"u%ing the customi7e% transactions 5here ep"aine% to the *APonsu"tants of sat#am, 6n%er stan%ing of re?uirements 5as %one at the c"ient si%e,Depen%ing on the f"o5 of transactions, a"" the transactions 5here groupe% together as%ifferent scenarios. :hi"e *AP onsu"tants 5here onsite for gathering /e?uirements,

    :or= %one at the offshore 5as to ana"#7e on the appropriate version of the QTP Too" to !e use% an% to get "icenses for QTP, user accounts for *AP access, 'nsta""ation of QTPan% *AP. A"" the '%entifie% *cenarios 5hich consists of %ifferent transactions 5here ep"aine% toTesting Team. Then common functiona"ities 5here i%entifie%, an% groupe% together as%ifferent Test cases.

    After %efining %ifferent Test cases, %esign for automation of scripts 5as %one, 5here/eusa!i"it# 5as one of the main aspects, 5here a"" the transactions, 5hich are common inthe scenarios, are i%entifie% as /eusa!"e transactions.

    Automation ramework:

    For Qua"it# %e"ivera!"es, important things that shou"% !e fo""o5e% are)

    • Fo""o5ing common co%ing structure for a"" the scripts

    www.ramupalanki.com

    http://www.ramupalanki.com/http://www.ramupalanki.com/

  • 8/20/2019 45937502 Automation Framework

    6/100

    For more QTP scripts, Log onto www.ramupalanki.com 

    • onsistent co%ing conventions

    • 6se of /eusa!i"it# for ma=ing co%e efficient an% minima"

    • Efficient use of !ect /epositor#

    • 6se of Error an% Eception han%"ing Functions

    • 6se of Data ta!"e o!ect, Environment varia!"es for using %ata

    For eamp"e in the 6ni"ever proect)

    o%ing *tructure use% is that there 5i"" a main Action for a"" the scripts 5hich is name%as correspon%ing Test case name, This Action intern 5i"" ca"" a"" the other actions EachTransaction use% in the script 5ou"% !e an actionB in the script. !mporting and"#porting of sheets is a"so %one in this main action. !mporting of sheets is %one at the !eginning !efore ca""ing other actions an% eporting of sheets is %one at the "ast. *heetscorrespon%ing to a"" the actions in the scripts are importe%, so that the %ata in the fie"%s ofthe 'mporte% sheets are use% as input %ata to the script, output %ata from the script is a"soco""ecte% an% e#ported to the correspon%ing sheet.

    There are man# transactions 5hich are reused in the scripts, simi"ar transactionsActionsB are ma%e as reusa!"e so that its not re?uire% to recor% those transactions againan% again, 5hich ever transaction 5as common among scripts, 5ere recor%e% in onescript an% is reused in a"" the scripts 5here the transaction is re?uire%.

    "rror handling in the unilever automation is %one !# using $ecover% Scenario 5hereeach $ecover% scenario ca""s a function 5hich han%"es the recover# !# eiting a"" theother transactions actionsB 5hen recover# fires.

  • 8/20/2019 45937502 Automation Framework

    7/100

    For more QTP scripts, Log onto www.ramupalanki.com 

    Actions transactionsB in the script

      a""s

    E) *14C1 Action (ameB E)

  • 8/20/2019 45937502 Automation Framework

    8/100

    For more QTP scripts, Log onto www.ramupalanki.com 

    Design of the Approach for Test Automation is given below

    www.ramupalanki.com

    '%entification of Test ases for Automation

    '%entification of ommon Functiona"it#

    o%ing *tan%ar%s, (aming onventions 9 Temp"ates

    App"ication Login,Logout, ommonFunctiona"it#

    /e"ate% co%e etc

    Too" 9 App"ication*ettings, /estoring,!ect /epositor#,

    /ecover#, >ouse

     eeping etc

    8enera" "i!rar#containing *tringhan%"ing, Date han%"ing,Fi"e >an%"ing, DataTa!"e han%"ing

    Error han%"ing, Log/eporting,messaging etc

    *cript Deve"opment using /ecor% 9 P"a# !ac= 

      @ui"%ing the /e&6sa!"e Li!rar#

    De"iver the script after $erification 9 $a"i%ation

    http://www.ramupalanki.com/http://www.ramupalanki.com/

  • 8/20/2019 45937502 Automation Framework

    9/100

    For more QTP scripts, Log onto www.ramupalanki.com 

    Design for Automation of Test cases for *nilever oods:

     

    'tGs a %escription of Automating a test case !e"ongs to *AP !# ep"aining a scenario*14&1

    Scenario (b)ective:

  • 8/20/2019 45937502 Automation Framework

    10/100

    For more QTP scripts, Log onto www.ramupalanki.com 

    -uidelines followed for identification of Test Cases for Automation

    • Tests that nee% to run once an% those that nee% fre?uent human

    intervention are usua""# not 5orth the investment to automate an% have not

     !een consi%ere% for automation.

    • As Automate% testing can !e use% to verif# the performance of app"ication

     paths that are use% 5ith a high %egree of fre?uenc# 5hen the soft5are is

    running in fu"" pro%uction e.g. creating customer recor%s, 'nvoicing an%

    other high vo"ume activities 5here soft5are fai"ure 5ou"% occur fre?uent"#

    have !een consi%ere%.

    • an%"ing an%Data *heet'mporting

    *APApp"ication*essionLogin

    *cript for@usinessTransaction;Test ase

    Test /esu"ts/eportingan%

    App"ication"osing.

    /e&6sa!"e Li!rar#)8eneric Li!rar# ca""s for han%"ing %ata, %ate, string etcError han%"ing Li!rar#/ecover# *cenarioActions

    http://www.ramupalanki.com/http://www.ramupalanki.com/

  • 8/20/2019 45937502 Automation Framework

    11/100

    For more QTP scripts, Log onto www.ramupalanki.com 

    • App"ications 5ith Long Life span I Longer the app"ication in pro%uction

    greater the !enefits from automation.

    • Avoi%ing %#namic screens. Though possi!"e to automate this increases the

    comp"eit# of the script.

    • Avoi%ing screens 5here o!ects are create% %#namica""#

    • Avoi%ing !usiness scenarios 5here comp"e har%5are is invo"ve%

    • *e"ecting a ro5 in a ta!"e resu"ts in an a%%itiona" cha""enge from. *ome

    automation too"s provi%e the faci"it# to rea% each ro5 in a ta!"e an% for

    focusing on a specific ro5. 'f the num!ers of ro5s 5ere ver# high the

    eecution time of the script 5ou"% !e high. This "ea%s to performance

    issues of the recor%e% script. >ence, it is !etter to prove the !usiness

    scenario 5herein ta!"es 5ith ro5 se"ections figure !# i%entif#ing a fie%

    ro5 num!er. This scenario is face% ver# fre?uent"# in enterprise

    app"ications as in pricing ta!"es an% "ea%s to the comp"eit# of the script

    an% su!se?uent"# the effort.

    • Avoi%ing scenarios that re?uire high %egree of co%ing 5hi"e automating so

    that scriptGs comp"eit# is re%uce% an% high maintaina!i"it# of the script is

    ensure%.

    2. !ntroduction to ,T&

    www.ramupalanki.com

    http://www.ramupalanki.com/http://www.ramupalanki.com/

  • 8/20/2019 45937502 Automation Framework

    12/100

    For more QTP scripts, Log onto www.ramupalanki.com 

    2.1 ,T& "nvironment Compatibilit%

    QTP versionB supports a 5i%e range of 5or=ing environments an% there!# can !e use%for practica""# an# app"ication.

    Core "nvironments Supported b% ,T&:

    & :in%o5s app"ications TT

  • 8/20/2019 45937502 Automation Framework

    13/100

    For more QTP scripts, Log onto www.ramupalanki.com 

    & rac"e& T

  • 8/20/2019 45937502 Automation Framework

    14/100

    For more QTP scripts, Log onto www.ramupalanki.com 

    /emor%:  12

  • 8/20/2019 45937502 Automation Framework

    15/100

    For more QTP scripts, Log onto www.ramupalanki.com 

    +ame &rog!d

    FarPoint *prea%sheet 2.+ FP*prea%.*prea%.1

    FarPoint *prea%sheet 3. FP*prea%.*prea%.2

    FarPoint *prea%sheet 3.+ FP*prea%.*prea%.3

    FarPoint *prea%sheet . FP*prea%.*prea%.4

    FarPoint *prea%sheet 3. LED@B FP*prea%AD.fp*prea%.2

    FarPoint *prea%sheet 3.+ LED@B FP*prea%AD.fp*prea%.3

    FarPoint *prea%sheet LED@B FP*prea%AD.fp*prea%.4

  • 8/20/2019 45937502 Automation Framework

    16/100

    For more QTP scripts, Log onto www.ramupalanki.com 

    /ultimedia Applications

    QTP.+ supports testing on the fo""o5ing mu"time%ia app"ications)

  • 8/20/2019 45937502 Automation Framework

    17/100

    For more QTP scripts, Log onto www.ramupalanki.com 

    S%stem $e8uirements

    To successfu""# insta"" an% run QTP., #ou nee% the fo""o5ingminimum s#stem re?uirements)

    Computer3&rocessor: '@

  • 8/20/2019 45937502 Automation Framework

    18/100

    For more QTP scripts, Log onto www.ramupalanki.com 

    +ote: *ie!e" A%%&in .+, the .(ET A%%&in .+, the A%%&in for *APso"utions .+, or an# . a%%&ins,cannot be used  5ith Quic=TestProfessiona" ..1 

    Supported "nvironments and &rograms

    Quic=Test Professiona" . supports creating, recor%ing, an% runningtests or components using the environments an% programs %escri!e% !e"o5.

    Standard 'indows Applications

    1.:in32 AP'

      2.

  • 8/20/2019 45937502 Automation Framework

    19/100

    For more QTP scripts, Log onto www.ramupalanki.com 

    +ame &rog!d

    FarPoint *prea%sheet 2.+ FP*prea%.*prea%.1

    FarPoint *prea%sheet 3. FP*prea%.*prea%.2

    FarPoint *prea%sheet 3.+ FP*prea%.*prea%.3

    FarPoint *prea%sheet . FP*prea%.*prea%.4

    FarPoint *prea%sheet 3. LED@B FP*prea%AD.fp*prea%.2

    FarPoint *prea%sheet 3.+ LED@B FP*prea%AD.fp*prea%.3

    FarPoint *prea%sheet LED@B FP*prea%AD.fp*prea%.4

  • 8/20/2019 45937502 Automation Framework

    20/100

    For more QTP scripts, Log onto www.ramupalanki.com 

    /icrosoft "#cel

    :hen using

  • 8/20/2019 45937502 Automation Framework

    21/100

    For more QTP scripts, Log onto www.ramupalanki.com 

    . Add9!ns

    .1 T%pes of Add9!ns

      QTP version Add-ins

      ;.2

     Java a%%&in .+ rac"e a%%&in .+

     *ie!e" a%%&in . Termina" Emu"ator a%%&in . . (et a%%&in .2

    Default Add9!ns) Active K ontro"s,:e! 9$isua" @asic

     

    ;.7

      . (et a%%&in .+.1  *ap a%%&in .+.1  Java a%%&in .+  Peop"e*oft a%%&in .+  rac"e a%%&in .+  Termina" Emu"ator a%%&in .+

    Default Add9!ns: Active K ontro"s,:e! 9$isua" @asic

      . . (et  :e!  Java  K

  • 8/20/2019 45937502 Automation Framework

    22/100

    For more QTP scripts, Log onto www.ramupalanki.com 

    .2 Conditions for Add9ins

    .2.1 To5ever, if a :e! app"icationcontains comp"e contro"s "i=e ActiveK or other contro"s %eve"ope% in .(et "i=e A*P.(etserver contro"s, it is re?uire% to use the .(et a%%&in to achieve o!ect recognition.

    .2. Sap Add9!n

      The *ap a%%&in is re?uire% for a"" *AP app"ications. 'n *AP app"ication 8ri% Ta!"es,*tatus @ar messages, La!e"s can !e i%entifie% on"# if *AP A%%&in is insta""e%.

    www.ramupalanki.com

    http://www.ramupalanki.com/http://www.ramupalanki.com/

  • 8/20/2019 45937502 Automation Framework

    23/100

    For more QTP scripts, Log onto www.ramupalanki.com 

    =. Conventions

    The onventions for (aming for test cases, *cripts an% Actions var# from Proect toProect %epen%ing upon the "ient.

    =.1 Test Case +aming Conventions:

    Test cases shou"% !e name% in a manner that ena!"es eas# i%entification of thecorrespon%ing 6se case or the *cenarioB for 5hich the Test ase is 5ritten. Then"oo=er shou"% !e a!"e to trace the test case !ac= to the use cane name or *cenarioname !# the name of the Test ase. onsistenc# shou"% !e maintaine% in fo""o5ing thehierarch# of naming.

      6se ase  r Test ase  *cenario

    or e#ample)

    Eamp"e 1) onsi%ering that Each 6se case is associate% 5ith one Test case. 'f the nameof the 6se ase 5ere 6C1 then the Test case name 5ou"% !e TC1.

    Eamp"e 2) 'n the 6ni"ever Automation Proect, *AP transactions are %ivi%e% into%ifferent mo%u"es, in those mo%u"es %ifferent transactions are groupe% together as ascenario, so for 5riting the test case for a particu"ar scenario naming convention use% ismo%u"e name fo""o5e% !# scenario name. 

    For

  • 8/20/2019 45937502 Automation Framework

    24/100

    For more QTP scripts, Log onto www.ramupalanki.com 

    6se ase 

    Test ase

     on%ition1 on%ition2 on%ition3

      Test ase Test script

    on%ition 1 Action1

      on%ition2 Action2 Therefore for a Test *cript correspon%ing to a Test ase name% TC1 5ou"% !eQT*C1.The hierarch# shou"% !e maintaine% in case the use cases or test cases areneste%.

    E.g.) TC1C14 5ou"% have a ,TP Test Script as QT*C1C14.

    Action +aming:

    Each Test *cript can contain one or more Actions, 5ith one or more actions representinga test on%ition.Actions can !e name% in 2 5a#s)

    1. Functiona"it# of the Action2. >ierarch# of the Action in the Test *cript.

    1. unctionalit% of the Action:

    T#pica""# Actions are segregate% !# their functiona"it# in the Test *cript.Therefore it 5ou"% !e easier to un%erstan% the Action if the name of the actionrepresents the Functiona"it#.

    For E.g.) An Action 5ritten or recor%e% for "ogging the user shou"% !e name% asogin or Authentication for eas# un%erstan%a!i"it#.An Action for !oo=ing tic=ets shou"% !e name% as 5ook>TicketsAn Action for eiting the app"ication name% as "#it.

      This a"so a%%s a huge a%vantage 5hen the Actions are ma%ereusable. /eusa!"e Actions can !e use% !et5een various scripts. :hen an Actionis to !e ma%e reusa!"e the action shou"% !e name% as $"*S">?Action [email protected]"e) $"*S">ogin.

    www.ramupalanki.com

    http://www.ramupalanki.com/http://www.ramupalanki.com/

  • 8/20/2019 45937502 Automation Framework

    25/100

    For more QTP scripts, Log onto www.ramupalanki.com 

    2. 4ierarch% of the Action in the Script:

    *ince Actions are a part of the Test *cript, for purpose of "arit# an% trac=ing,Actions can !e name% as per >ierarch#.

    For e.g.) Test ase (ame TC1

      QTP Test *cript (ame QT*C1

      (ame of 1st action in the *cript QT*C1C1

      *imi"ar"# (ame of 0th Action in the *criptQT*C1C0

    =. 0ariables and Constants:

    QTP *cripts are in $@ *cript. Therefore, the naming conventions for varia!"es can !e

    fo""o5e% a"i=e $@ *cript (aming onventions.

    8enera" onventions fo""o5e% in $@*cript are)

    Data T%pe &refi#es:

    @# using %ata t#pe prefies, #our varia!"es a"5a#s in%icate 5hat the# are %esigne% for.'m using ust si prefies)

    &refi# Data T%pes "#ample

     ! @oo"ean true or fa"seB !hec=e% R True

    % Date;time %*tartTime R (o5

    iA"" numeric %ata t#pes@#te, 'nteger, urrenc#, Long, *ing"e, Dou!"eB

    iTa R iPrice S .-

    o !ects *et oFi"e R (othing

    s *trings sTit"e R :e"comeU

    u 6ser interface e"ements uPara.st#"e.%isp"a# R !"oc=

    Constants &refi#:

    6sua""# there are on"# a han%fu" of constants in an# scripts. 'n%icating the %ata t#petherefore is "ess important for constants. Prefi "etter c for a"" constants can !e use%.e.g. Const cTitle = "Welcome!"6Document.tit"e R cTit"e

    www.ramupalanki.com

    http://www.ramupalanki.com/http://www.ramupalanki.com/

  • 8/20/2019 45937502 Automation Framework

    26/100

    For more QTP scripts, Log onto www.ramupalanki.com 

    =.= DataSheet +aming and &arameter +aming Conventions:

    Ever# QTP Test *cript contains 2 t#pes of sheets.1. 8"o!a" %ata sheet2. Loca" %ata sheets 

    The 8"o!a" %ata sheet, 5hich is a common sheet for a"" the actions of the script, isname% !# %efau"t as %tCg"o!a"sheet. This can !e rename% as -lobal for a"" the *cripts forconsistenc#.

    T#pica""#, Each Action in the *cript contains one %ata sheet, 5hich is "oca" to theAction. This is !# %efau"t, name% after the Action to 5hich it !e"ongs. Therefore thename of the %atasheet fo""o5s %irect"# the name of the Action, 5hich 5hen name%

    fo""o5ing its naming conventions, can !e use% efficient"# for the %ata sheet too.

    &arameter +aming:

    $arious T#pes of Parameters use% in QTP are)

    1@ Test &arameters

    a@ Test !nput &arameters:  These shou"% !e name% as !+>?relevant variable [email protected]!nG %enoting that itGs an input parameter for the Test in 5ho"e. The name fo""o5ing !+

    shou"% !e a re"evant name for the varia!"e, %enoting the purpose of its use. This shou"%a"so comp"# 5ith the stan%ar% varia!"e naming conventions."#ample: '(C!F"ag, '(Ci'ncrement etc.,

    b@ Test (utput &arameters: n the simi"ar "ines of 'nput Parameters, these shou"% !ename% as (*T>?relevant variable name@.  (*T representing that itGs an output parameter."#ample: 6TCs*tatus.

    2@ Action &arameters

    a@ Action !nput &arameters: These are "oca" to Action of a Test. These can !e name% asACT!+>?variable name@. ACT!+ %enoting that itGs an Action 'nput Parameter."#ample: AT'(Ci/esu"t

    b@ Action (utput &arameters: These cou"% !e name% as ACT(*T>?var name@.

    www.ramupalanki.com

    http://www.ramupalanki.com/http://www.ramupalanki.com/

  • 8/20/2019 45937502 Automation Framework

    27/100

    For more QTP scripts, Log onto www.ramupalanki.com 

    "#ample: AT6TC!F"ag

    @ "nvironment 0ariables:

    Environment varia!"es are either built9in or *ser defined. @ui"t&in varia!"es cannot !e%ec"are% name% !# the user, so their naming convention is not %iscusse%.

    6ser Define% Environment $aria!"es are either 'nterna" or Eterna".!nternal 0ariables: "+0>!+T>?variable name@

    "#ternal 0ariables: "+0>"6T>?0ariable name@

    =. unction +aming Conventions

    Functions shou"% !e name% as unc>?name@. This can provi%e c"arit# an% %ifference !et5een a /eusa!"e Action an% a Function that can !e use% 5ithin Actions."#ample: FuncC*ave , FuncCA%%

     

    www.ramupalanki.com

    http://www.ramupalanki.com/http://www.ramupalanki.com/

  • 8/20/2019 45937502 Automation Framework

    28/100

    For more QTP scripts, Log onto www.ramupalanki.com 

    5. Settings

    .1 ,T& Test Settings

    @efore /unning or /ecor%ing an# test on QTP, the QTP Test settings nee% to !e set as per the re?uirements of the Test. *etting these Test *ettings !efore starting a Test p"a#s acrucia" part in the !ehavior of the test.

    These can !e foun% at the path TestSettings. A %ia"og !o pops up, in 5hich variousta!s are present 5hich a""o5 one to set

    • Properties of the test "i=e A%%&'ns use%

    • /un time Preferences

    • /esources "i=e fi"es, %ata ta!"es, an% repositor# to !e use%.

    • Parameters re?uire% in the Test.

    • Environment varia!"es use%

    • :e! navigation• /ecover# *cenarios

     

    +ote: For further %etai"s a!out the use of each ta!, refer to QTP Test *ettings 

    www.ramupalanki.com

    http://www.ramupalanki.com/http://opt/scribd/conversion/admin/Local%20Settings/Documents%20and%20Settings/pkasireddy/Local%20Settings/ra18713/Mahesh&RK/29-12/Reference%20documents/QTP%20Test%20Settings.dochttp://opt/scribd/conversion/admin/Local%20Settings/Documents%20and%20Settings/pkasireddy/Local%20Settings/ra18713/Mahesh&RK/29-12/Reference%20documents/QTP%20Test%20Settings.dochttp://opt/scribd/conversion/admin/Local%20Settings/Documents%20and%20Settings/pkasireddy/Local%20Settings/ra18713/Mahesh&RK/29-12/Reference%20documents/QTP%20Test%20Settings.dochttp://www.ramupalanki.com/

  • 8/20/2019 45937502 Automation Framework

    29/100

    For more QTP scripts, Log onto www.ramupalanki.com 

    .2 $ecord and $un Settings

    After *etting the Test *ettings at TestSettingsB the net important settings for actua""#

    recor%ing the app"ication an% running it for Testing are to !e set at the Test$ecord and$un Settings. This %ia"og !o opens automatica""#, 5hen recor%ing a test for the firsttime. The %etai"s of 5hich app"ication to recor% are set in this %ia"og !o.

     

    For further %etai"s a!out these settings refer to /ecor% an% /un *ettings. 

    . Active Screen Capture evel

    ne of the most usefu" fetaures of QTP is the various vie5s it provi%es, out of 5hichActive view is the most uni?ue.The se"ection of the appropriate Active *creen apture"eve" inf"uences the storage space, properties store% an% the vie5 of the Active screen.The se"ection can !e ma%e !# going to Tools(ptionsActive Screen.The Active screen settings can a"so set at the Test$ecord and $un Settings.The active screen capture "eve" can !e set to an# of the 4 "eve"s i.e. omp"ete, Partia",

  • 8/20/2019 45937502 Automation Framework

    30/100

    For more QTP scripts, Log onto www.ramupalanki.com 

    For %etai"s a!out each capture "eve", refer to ActiveScreen Capture evel.

    .= (b)ect $epositor%

    :hen a test is recor%e%, QTP a%%s each o!ect on 5hich an operation is performe%, tothe Toolsob)ect repositor%. !ects can !e a%%e% to the repositor# 5hi"e e%iting thetests too.:hi"e recor%ing, !ects are a%%e% to the repositor# in either of the t5o 5a#s)

     a. !ect /epositor# per Action

     !. *hare% !ect /epositor#.

    www.ramupalanki.com

    http://www.ramupalanki.com/http://opt/scribd/conversion/admin/Local%20Settings/Documents%20and%20Settings/pkasireddy/Local%20Settings/ra18713/Mahesh&RK/29-12/Reference%20documents/Active%20Screen%20Capture%20Level.dochttp://opt/scribd/conversion/admin/Local%20Settings/Documents%20and%20Settings/pkasireddy/Local%20Settings/ra18713/Mahesh&RK/29-12/Reference%20documents/Active%20Screen%20Capture%20Level.dochttp://opt/scribd/conversion/admin/Local%20Settings/Documents%20and%20Settings/pkasireddy/Local%20Settings/ra18713/Mahesh&RK/29-12/Reference%20documents/Active%20Screen%20Capture%20Level.dochttp://www.ramupalanki.com/

  • 8/20/2019 45937502 Automation Framework

    31/100

    For more QTP scripts, Log onto www.ramupalanki.com 

    The settings can !e change% !# going to

    TestSettings$esources(b)ect $epositor% T%pe

     

    'n the Per&Action mo%e, o!ects are i%entifie% an% separate% on the !asis of each

    action an% the correspon%ing o!ect repositor# for the test is create% in the testfo"%er.'n the *hare% mo%e, the user ma# choose a "ocation to save the share%o!ect repositor# fi"es for a"" the tests.

    A"" the !ects recor%e% %uring a test,an% their properties can !e seen an%manipu"ate% in the Tools(b)ect $epositor%.There are provisions in this !ect/epositor# Dia"og !o to a%% ne5 o!ects,sp# o!ects, fin% an% rep"ace propert#va"ues etc.

    www.ramupalanki.com

    http://www.ramupalanki.com/http://www.ramupalanki.com/

  • 8/20/2019 45937502 Automation Framework

    32/100

    For more QTP scripts, Log onto www.ramupalanki.com 

    The First *ection of !ect /epositor# Dia"og @o contains provisions toa. A%% !ects ) A @utton to a%% ne5 o!ects to the repositor#. !. >igh"ight) To high"ight the o!ect se"ecte% in the repositor#, 5hen the app"ication

    is open.c. !ect *p#) To *p# an# !ect, to see its Properties.%. Eport) To Eport an# o!ects to an outsi%e "ocation.

    The secon% section of the %ia"og !o contains provision to Fin%, /ep"ace, A%%, an%/emove the properties of an o!ect in the /epositor# a"so set an# %efau"t va"ues for the properties. 

    . "#pert 0iew

    :hi"e recor%ing Tests in QTP, there are 3 important vie5s that ena!"e us to un%erstan%c"ear"#, the various representations of the *cript. The# are

    a. Epert $ie5 !. e#5or% $ie5) >ierarchica" /epresentation of Actionsc. Active *creen $ie5) Pictoria" vie5 of the current"# active *creen.

    www.ramupalanki.com

    http://www.ramupalanki.com/http://www.ramupalanki.com/

  • 8/20/2019 45937502 Automation Framework

    33/100

    For more QTP scripts, Log onto www.ramupalanki.com 

    'n the Epert $ie5, QTP %isp"a#s each operation performe% on the app"ication in theform of a script. The script is comprise% of $@*cript statements an% the vie5 is a scripte%itor 5ith man# script e%iting capa!i"ities. For each o!ect an% metho% in an Epert$ie5 statement, a correspon%ing ro5 eists in the e#5or% $ie5 an% a correspon%ing

    Active *creen in the Active *creen vie5, 5hich ena!"es eas# tracea!i"it#.

     Fig) Active *creen omponent correspon%ing to Epert $ie5 *tatement

    www.ramupalanki.com

    http://www.ramupalanki.com/http://www.ramupalanki.com/

  • 8/20/2019 45937502 Automation Framework

    34/100

    For more QTP scripts, Log onto www.ramupalanki.com 

    Fig) e#5or% vie5 an% Active *creen vie5 correspon%ing to one epert vie5 statement

    ..1 Step -enerator:

    'f the user is fami"iar 5ith $@*cript, the user can a%% an% up%ate statements an% enhancethe tests an% components 5ith programming. After the test or an Action is recor%e%, its po5er an% f"ei!i"it# can !e increase% !# a%%ing recor%a!"e an% non&recor%a!"e $@*criptstatements as re?uire% for tas=s "i=e hec= Points,Datata!"es etc.,.These a%%itiona" stepscan !e a%%e% either manua""# or using !nsertStep Step -enerator .5henever a step isa%%e% to a script, then an# *#nta errors of the step can !e '%entifie% in its e#5or%vie5.

    www.ramupalanki.com

    http://www.ramupalanki.com/http://www.ramupalanki.com/

  • 8/20/2019 45937502 Automation Framework

    35/100

    For more QTP scripts, Log onto www.ramupalanki.com 

    The *tep 8enerator ena!"es #ou to a%% steps ?uic="# an% easi"#, !# se"ecting from a rangeof contet&sensitive options an% entering the re?uire% va"ues.The generate% step getsa%%e% at the position of cursor in the epert vie5.The *tep 8enerator ena!"es #ou to a%% steps ?uic="# an% easi"#, !# se"ecting from a rangeof contet&sensitive options an% entering the re?uire% va"ues. 'n the *tep 8enerator %ia"og !o #ou can %efine steps that use)• test o!ect metho%s an% properties• uti"it# o!ect metho%s an% properties• ca""s to "i!rar# functions, $@*cript functions, an% interna" script functions

    . Setting related to the Application *sed:

    The %ifferent =in% of App"ications that can !e teste% using QTP are 5in%o5sapp"ications,5e! !ase%ava an% .(etB,*AP,rac"e etc.Apart from the 5in%o5sapp"ications using

  • 8/20/2019 45937502 Automation Framework

    36/100

    For more QTP scripts, Log onto www.ramupalanki.com 

    A%%&in 5hich is !ought an% insta""e%, resu"ts in a ne5 ta! in a"" the setting %ia"og !oes ,using 5hich various setting options can !e chosen.'t pure"# %epen%s on the t#pe ofapp"ication , ho5 to choose a particu"ar setting option.

    Eamp"e of a *AP A%%&in )

     

    Fig) The A%%&in manager %ia"og 5ith *AP a%%&in

    www.ramupalanki.com

    http://www.ramupalanki.com/http://www.ramupalanki.com/

  • 8/20/2019 45937502 Automation Framework

    37/100

    For more QTP scripts, Log onto www.ramupalanki.com 

    Fig) /ecor% an% /un *ettings 5ith a *AP A%%&in.For %etai"e% information of the settings of the ta!s other than the specia" ta!s refer /ecor% 

    an% run settings.

    www.ramupalanki.com

    http://www.ramupalanki.com/http://opt/scribd/conversion/admin/Local%20Settings/Documents%20and%20Settings/pkasireddy/Local%20Settings/ra18713/Mahesh&RK/29-12/Reference%20documents/Record%20and%20Run%20Settings.dochttp://opt/scribd/conversion/admin/Local%20Settings/Documents%20and%20Settings/pkasireddy/Local%20Settings/ra18713/Mahesh&RK/29-12/Reference%20documents/Record%20and%20Run%20Settings.dochttp://opt/scribd/conversion/admin/Local%20Settings/Documents%20and%20Settings/pkasireddy/Local%20Settings/ra18713/Mahesh&RK/29-12/Reference%20documents/Record%20and%20Run%20Settings.dochttp://opt/scribd/conversion/admin/Local%20Settings/Documents%20and%20Settings/pkasireddy/Local%20Settings/ra18713/Mahesh&RK/29-12/Reference%20documents/Record%20and%20Run%20Settings.dochttp://www.ramupalanki.com/

  • 8/20/2019 45937502 Automation Framework

    38/100

    For more QTP scripts, Log onto www.ramupalanki.com 

    . (b)ects

    .1 (b)ects

    !ects are the things 5hich contains %ifferent properties an% metho%s.

    For Eamp"e) :in%o5 is sai% to !e an o!ect 5hich consists of properties such asEist, 8et/Propert# an% metho%s such as hi"%!ects, Activate, maimi7e,minimi7e etc.

    &ropert%:

    Propert# %escri!es a!out the o!ect %efine%, each o!ect has %ifferent properties,

    5hich is necessar# to %escri!e the o!ect, 5hich %ifferentiates the given o!ect5ith other o!ects.

    For eamp"e) 'f 5e ta=e a window o!ect, 5e first have to %efine to 5hich c"ass it !e"ongs to 5hich is one of the propert#, it !e"ongs to a window class. "#ist is a propert# 5hich is common to man# o!ects 5hich returns true if that o!ect eists.

    /ethods:

  • 8/20/2019 45937502 Automation Framework

    39/100

    For more QTP scripts, Log onto www.ramupalanki.com 

    Sample for (b)ect hierarch%:

    'n the a!ove samp"e of co%e, there are t5o main !ects, one is Dia"og an%the other is :in%o5 o!ect. This o!ects contain chi"% o!ects, For Dia"ogo!ect 5hich is name% as VLoginW has :inE%it o!ect 5ith name as VAgent (ame)W as chi"%o!ect, here *et is the metho% use% to set a tet into the:inE%it o!ect.

    V*etW is the metho% associate% 5ith V:inE%itW o!ect

    www.ramupalanki.com

    VDia"ogW !ect

    hi"% !ectfor VDia"ogW!ect

  • 8/20/2019 45937502 Automation Framework

    40/100

    For more QTP scripts, Log onto www.ramupalanki.com 

    . Data Table

    'n QTP scripting there are man# o!ects that are use%, ne of the !ects use% inQTP scripting is DataTa!"e !ect.

    .1 Datatable (b)ect and related unctions:

    Description

    @asic use of Datata!"e o!ect is to create an o!ect for a%%ing, %e"eting, up%ating %ataof an ece" sheet use%.

    /ain functions of the datatable ob)ect:

    • !mportsheet : This function is use% to 'mport sheet into the script, so that a""the %ata in the importe% sheet can !e use% in the script.

    *#nta)

    Datata!"e.'mportsheetVnameofEce"fi"e5ithpathW,VnameofthesourcesheetW, Vnameofthe%estinationsheetWB

    • "#portsheet : This function is use% to Eport sheet from the script, a"" the%ata inc"u%ing output va"ues are store% in the %efau"t sheet for the action, thissheet is eporte% an% store% in a specifie% "ocation using this function.

    *#nta)

    Datata!"e.EportsheetVnameofEce"fi"e5ithpathW,V(ameofthesheetWB

    • Addsheet : 6se% for a%%ing a sheet into the script fi"e.

    • -et$owCount: This function is use% to get the no of ro5s in a particu"arsheet.

    *#nta)

    Datata!"e.A%%*heetV*heetnameWB.8et/o5ount

    www.ramupalanki.com

    http://www.ramupalanki.com/http://www.ramupalanki.com/

  • 8/20/2019 45937502 Automation Framework

    41/100

    For more QTP scripts, Log onto www.ramupalanki.com 

    • -etCurrent$ow: This function is use% to get the current ro5 of a particu"arsheet.

    :hen an action is run !# using run setting as Vrun on a"" ro5sW, that action5i"" run as man# times as the num!er of ro5s in the ece" sheet of the action,in or%er to fin% the ro5 for 5hich action is running current"# 5e use8eturrent/o5 function.

    *#nta)

    Datata!"e.8et*heetV*heetnameWB.8eturrent/o5

    .2 (rganiing Data Sheets for -lobal E ocal variables

    Description

     There are t5o t#pes of sheets in an# QTP *cript, the# are 

    8"o!a"sheet  Loca"sheet

    -lobalsheet:  8"o!a"sheet in an# script is uni?ue, 8"o!a"sheet is use% in or%er to store

    va"ues in the sheet an% the va"ues store% in 8"o!a"sheet can !e use% in a"" the actions. For storing a va"ue in the g"o!a" sheet 5e use the fo""o5ing function) 

    Datata!"e.$a"ueVFie"%nameW,W8"o!a"WB R $a"ue

    For using the va"ues from the g"o!a" sheet 5e use the fo""o5ing function) 

    $a"ue R Datata!"e.$a"ueVFie"%nameW,W8"o!a"WB

    ocalsheet) Each an% ever# action in the script 5i"" have its o5n Loca"sheet, name of the

    Loca"sheet of a particu"ar action is same as the action name.

    For using the %ata from the Loca" sheet 5e use fo""o5ing function)

    Datata!"e.$a"ueVFie"%nameW,%t"oca"sheetBr 

    Datata!"e.$a"ueVFie"%nameW,W*heetnameWB

    www.ramupalanki.com

    http://www.ramupalanki.com/http://www.ramupalanki.com/

  • 8/20/2019 45937502 Automation Framework

    42/100

    For more QTP scripts, Log onto www.ramupalanki.com 

    rgani7ation of 8"o!a" an% Loca" sheets 5ith the actions use% in the script are sho5n !e"o5)

    . &arameteriing using Data driven 'iard

    Description

    The Data Driver ena!"es #ou to ?uic="# parameteri7e severa" or a""B propert#va"ues for test o!ects, chec=points, an%;or metho% arguments containing the sameconstant va"ue 5ithin a given action.

    Oou can choose to rep"ace a"" occurrences of a se"ecte% constant va"ue 5ith a parameter, in the same 5a# that #ou can use a ind and $eplace All operationinstea% of a step&!#&step ind and $eplace process. Quic=Test can a"so sho5#ou each occurrence of the constant so that #ou can %eci%e 5hether or not to parameteri7e the va"ue.

    'f an# propert# of an o!ect is ta=en, that propert# can !e parameteri7e% using Datadriven 'iardB

    www.ramupalanki.com

    Action name)VLoginW

    8"o!a"*heet

    Loca" *heet forVLoginWAction

    http://www.ramupalanki.com/http://www.ramupalanki.com/

  • 8/20/2019 45937502 Automation Framework

    43/100

    For more QTP scripts, Log onto www.ramupalanki.com 

    Different steps for parameteri7ation using Data %riven :i7ar% is as fo""o5s)

    • 8o to too" !ar option Too"s an% se"ect Data Driver  option

    • :e 5i"" get a "ist of a"" the properties of a"" the o!ects 5hich can !e

     parameteri7e% i.e. for a"" the o!ects 5here a va"ue for a propert# is given inthe scriptB

    For eamp"e consi%er script for entering Login name 5hich is as fo""o5s  Dia"ogLoginB.:inE%itAgent (ame)B.*et name

    The *et propert# of :inE%it !ect appears in the "ist of Data%river 5ith VnameW as$a"ue representing the *et propert# of VAgent (ameW E%it!o, 5hich is as given !e"o5)

    • *e"ect a va"ue 5hich shou"% !e parameteri7e% an% c"ic= on VParameteri7eW !utton.

    • There 5i"" !e t5o options to !e se"ecte% as given !e"o5)

    www.ramupalanki.com

    http://www.ramupalanki.com/http://www.ramupalanki.com/

  • 8/20/2019 45937502 Automation Framework

    44/100

    For more QTP scripts, Log onto www.ramupalanki.com 

    Step9b%9step &arameteriation: Ena!"es #ou to vie5 the current va"ues of each stepcontaining the se"ecte% va"ue. For each step, #ou can choose 5hether or not to parameteri7e the va"ue, an% if so, 5hich parameteri7ation options #ou 5ant to use, the+e#t !utton is ena!"e% 5hen #ou se"ect this option, this 5i"" ena!"e us to se"ect an other

    instance of the constant se"ecte% an% parameteri7e that instant, it 5i"" continue the same process ti"" a"" the instances of the given va"ue are %one.

    www.ramupalanki.com

    http://www.ramupalanki.com/http://www.ramupalanki.com/

  • 8/20/2019 45937502 Automation Framework

    45/100

    For more QTP scripts, Log onto www.ramupalanki.com 

    &arameterie all:  Ena!"es #ou to parameteri7e a"" occurrences of the se"ecte% va"uethroughout the action.:hen #ou se"ect this option the &arameter details area is ena!"e%. The inish !utton isena!"e% 5hen #ou se"ect this option.

    www.ramupalanki.com

    http://www.ramupalanki.com/http://www.ramupalanki.com/

  • 8/20/2019 45937502 Automation Framework

    46/100

    For more QTP scripts, Log onto www.ramupalanki.com 

    >ere Parameter ta! can !e se"ecte% using the !utton given at the VParameterW ra%io !utton, an% in the net screen se"ect the %atata!"e Fie"% from 5here the propert# for5hich the va"ue !e"ongs is parametereri7e%, c"ic= on VFinishW !utton thus a"" the instancesof the va"ue se"ecte% for parameteri7ation 5i"" !e parameteri7e%.

    .= !mporting and "#porting Datasheets:

    Description

    'mporting an% Eporting of Datasheets are use% for rea%ing, 5riting an% manipu"ating the%ata in an ece" sheet.

    !mporting Datasheet:

    Description

    'mports a sheet of a specifie% fi"e to a specifie% sheet in the run&time Data Ta!"e. The%ata in the importe% sheet rep"aces the %ata in the %estination sheet see SheetDestargumentB.

    www.ramupalanki.com

    http://www.ramupalanki.com/http://www.ramupalanki.com/

  • 8/20/2019 45937502 Automation Framework

    47/100

    For more QTP scripts, Log onto www.ramupalanki.com 

    +ote:  A"" the fie"%s in the importe% sheets shou"% match 5ith the %ata use% in the script.There are t5o functions for 'mporting, 'mporting the 5ho"e ece" fi"e an% 'mporting thesheets in the fi"e.

    Function for 'mporting the 5ho"e Ece" fi"e)

    'mports the fi"e into the script 5ith a"" the sheets 5hich are there in the ece" fi"e.

    +ote: *heets in the ece" fi"e shou"% match 5ith the Actions in the script to use the %ataefficient"#, since action name an% correspon%ing sheet name shou"% !e same.

    S%nta#:

    'mport Vfi"ename5ithpathW

    Function for 'mporting the sheets from the ece" fi"e)

    'mports the specifie% sheet into the script.

    S%nta#:

    'mportsheet Vfi"ename5ithpathW,WsourcesheetnameW,W%estinationsheetnameW

    "#porting Datasheet:

    Description

    Eports a specifie% sheet of the run&time Data Ta!"e to the specifie% fi"e.

    • 'f the specifie% fi"e %oes not eist, a ne5 fi"e is create% an% the specifie% sheet issave%.

    • 'f the current fi"e eists, !ut the fi"e %oes not contain a sheet 5ith the specifie%sheet name, the sheet is inserte% as the "ast sheet of the fi"e.

    • 'f the current fi"e eists an% the fi"e contains the specifie% sheet, the eporte%sheet over5rites the eisting sheet.

    *ame as 'mporting, There are t5o functions for Eporting, Eporting the 5ho"e ece" fi"ean% Eporting the sheets in the fi"e.

    Function for Eporting the 5ho"e Ece" fi"e)

    Eports the fi"e into the script 5ith a"" the sheets 5hich are there in the ece" fi"e.

    www.ramupalanki.com

    http://www.ramupalanki.com/http://www.ramupalanki.com/

  • 8/20/2019 45937502 Automation Framework

    48/100

    For more QTP scripts, Log onto www.ramupalanki.com 

    S%nta#:

    Eport Vfi"ename5ithpathW

    Function for Eporting the sheets from the ece" fi"e)

    Eports the specifie% sheet into the script.

    S%nta#:

    Eportsheet Vfi"ename5ithpathW,WsourcesheetnameW,W%estinationsheetnameW

    www.ramupalanki.com

    http://www.ramupalanki.com/http://www.ramupalanki.com/

  • 8/20/2019 45937502 Automation Framework

    49/100

    For more QTP scripts, Log onto www.ramupalanki.com 

    ;. Actions

    ;.1 Actions Settings

    Oou can use the $un ta! of the Action a"" Properties %ia"og !o to instruct Quic=Test torun on"# one iteration on the ca""e% action, to run iterations on a"" ro5s in the Data Ta!"e,or to run iterations on"# for certain ro5s in the Data Ta!"e.

     

    www.ramupalanki.com

    http://www.ramupalanki.com/http://www.ramupalanki.com/

  • 8/20/2019 45937502 Automation Framework

    50/100

    For more QTP scripts, Log onto www.ramupalanki.com 

    ;.2 !terations using rows

    The /un ta! inc"u%es the fo""o5ing options)

    (ption Description

    $un one

    iteration

    onl% 

    /uns the ca""e% action on"# once, using the ro5 in the actions %atasheet that correspon%s to the current g"o!a" iteration num!er. 'f theactions %ata sheet contains fe5er ro5s than the g"o!a" sheet, the "astro5 of the actions %ata sheet is use% for each su!se?uent testiteration.

    For eamp"e, suppose an actions %ata sheet has t5o ro5s an% theg"o!a" sheet has four ro5s. 'f #ou choose to run one iteration on"#

    for the action an% #ou choose to run iterations on a"" ro5s of theg"o!a" %ata sheet, then %uring each iteration of the test, this action5i"" run on"# one iteration. The %ata that the action parameters use%uring each repetition of the test are !ase% on the iteration num!erfor the test.During the first iteration of the test, Data Ta!"e parameters in theaction ta=e %ata from the first ro5 of the actions %ata sheet. 'n thesecon% iteration of the test, Data Ta!"e parameters in the action ta=e%ata from the secon% ro5 of the actions %ata sheet. 'n the thir% an%su!se?uent iterations of the test, the Data Ta!"e parameters in theaction continue to ta=e %ata from the secon% i.e. the "ast ro5 of the

    actions %ata sheet.

    $un on all

    rows /uns the ca""e% action 5ith the num!er of iterations accor%ing to thenum!er of ro5s in the actions Data Ta!"e.

    $un from

    row >> to

    row >>  

    /uns the ca""e% action 5ith the num!er of iterations accor%ing to thespecifie% ro5 range.

    The /un ta! of the Action a"" Properties %ia"og !o app"ies to in%ivi%ua" action ca""san% refers to the ro5s in the actions %ata sheet.

    www.ramupalanki.com

    http://www.ramupalanki.com/http://www.ramupalanki.com/

  • 8/20/2019 45937502 Automation Framework

    51/100

    For more QTP scripts, Log onto www.ramupalanki.com 

    ;. Action Template

    Creating an Action Template

    'f #ou 5ant to inc"u%e one or more statements in ever# ne5 action in #our test, #ou can

    create an action temp"ate. For eamp"e, if #ou a"5a#s enter #our name as the author of anaction, #ou can a%% this comment "ine to #our action temp"ate. An action temp"ate app"ieson"# to actions create% on #our computer.To create an action template:

    1. reate a tet fi"e containing the comments, function ca""s, an% other statementsthat #ou 5ant to inc"u%e in #our action temp"ate. The tet fi"e must !e in thestructure an% format use% in the Epert $ie5.

    2. *ave the tet fi"e as ActionTemplate.mst   in #our F,uickTest !nstallationolderGdat fo"%er. A"" ne5 actions #ou create contain the script "ines from the

    action temp"ate.

    n"# the fi"e name ActionTemplate.mst is recogni7e% as an action temp"ate.

     To view the Action template refer to ActionTemplate.mst

    ;.= Script Startup

    • hec= for the re?uire% a%%&ins for an app"ication.• 'nc"u%e action temp"ate for ever# test containing script i%, Action name, Action

    Description, /ecover# scenario use% etc.

    • Ever# action, scenario must !e specifie% 5ith an appropriate name.

    • hec= for man%ator# input fie"%s for a"" iterations in the %atasheets that are !eingimporte%.

    Eamp"e)The /esources ta! of the Test *ettings %ia"og !o can !e use% to associate specific fi"es5ith the test, such as Data Ta!"e fi"es.

    The option area (ther location instructs Quic= Test to use %ata store% in the specifie%Data Ta!"e "ocation. The Data Ta!"e can !e an#

  • 8/20/2019 45937502 Automation Framework

    52/100

    For more QTP scripts, Log onto www.ramupalanki.com 

    For a samp"e eterna" fi"e refer to *amp"e Eterna" Fi"e

    • hec= for the VData ta!"e iterationsW un%er the test settings for 5hich the test hasto !e run.

    For further %etai"s refer to QTP test settings %oc.

    ;. Splitting ActionsB $e9usable ActionsB !nternal3"#ternal Actions

    Actions he"p %ivi%e #our test into "ogica" units, specific activities that #ou performin #our app"ication.

    A test is ma%e up of ca""s to actions. :hen #ou create a ne5 test, it contains a ca"" to asing"e action or create tests that ca"" mu"tip"e actions !# inserting ca""s to them, to ma=ethe %esign more mo%u"ar an% efficient tests.

    www.ramupalanki.com

    http://www.ramupalanki.com/http://opt/scribd/conversion/admin/Local%20Settings/Documents%20and%20Settings/pkasireddy/Local%20Settings/ra18713/Mahesh&RK/29-12/Reference%20documents/external_data.xlshttp://opt/scribd/conversion/admin/Local%20Settings/Documents%20and%20Settings/pkasireddy/Local%20Settings/ra18713/Mahesh&RK/29-12/Reference%20documents/external_data.xlshttp://opt/scribd/conversion/admin/Local%20Settings/Documents%20and%20Settings/pkasireddy/Local%20Settings/ra18713/Mahesh&RK/29-12/Reference%20documents/QTP%20Test%20Settings.dochttp://opt/scribd/conversion/admin/Local%20Settings/Documents%20and%20Settings/pkasireddy/Local%20Settings/ra18713/Mahesh&RK/29-12/Reference%20documents/external_data.xlshttp://opt/scribd/conversion/admin/Local%20Settings/Documents%20and%20Settings/pkasireddy/Local%20Settings/ra18713/Mahesh&RK/29-12/Reference%20documents/QTP%20Test%20Settings.dochttp://www.ramupalanki.com/

  • 8/20/2019 45937502 Automation Framework

    53/100

    For more QTP scripts, Log onto www.ramupalanki.com 

    There are three =in%s of actions)

    • reusable action Nan action that can !e ca""e% mu"tip"etimes !# the test 5ith 5hich is store% in the "oca" test as 5e"" as !#other tests.•

    e#ternal action Na reusa!"e action store% 5ith another test.Eterna" actions are rea%&on"# in the ca""ing test. The# can !emo%ifie% on"# in the test 5ith 5hich the# are store%.• +on&resuable9actions Nan action that can !e ca""e% on"#in the test 5ith 5hich it is store%, an% can !e ca""e% on"# once.

     

    For further %etai"s on creation 9 sp"itting of actions refer to Actions.

    H. (b)ect $epositor% 

    H.1 &er Action3Shared (b)ect $epositor%:

    www.ramupalanki.com

    http://www.ramupalanki.com/http://opt/scribd/conversion/admin/Local%20Settings/Documents%20and%20Settings/pkasireddy/Local%20Settings/ra18713/Mahesh&RK/29-12/Reference%20documents/Actions.dochttp://opt/scribd/conversion/admin/Local%20Settings/Documents%20and%20Settings/pkasireddy/Local%20Settings/ra18713/Mahesh&RK/29-12/Reference%20documents/Actions.dochttp://www.ramupalanki.com/

  • 8/20/2019 45937502 Automation Framework

    54/100

    For more QTP scripts, Log onto www.ramupalanki.com 

    *etting the *hare% ;per action !ect /epositor# option

    To set onl% one test to use the Shared (b)ect $epositor% option:

    1. "ic= the (e5 !utton or go to Fi"e & (e5 to open a ne5 test.

    2. 8o to Test & *ettings.3. *e"ect the /esources ta!.4. 'n the !ect repositor# t#pe !o, se"ect one of the options)

    • *e"ect Per&action to set the !ect /epositor# mo%e for #our test to the !ect/epositor# per action mo%e.

    @e"o5 are some of the factors !ase% on 5hich Per Action option is se"ecte%

    www.ramupalanki.com

    http://www.ramupalanki.com/http://www.ramupalanki.com/

  • 8/20/2019 45937502 Automation Framework

    55/100

    For more QTP scripts, Log onto www.ramupalanki.com 

    • :henever there are no common o!ects across transactions

    • Ease of !ui"%ing o!ect repositor#.

    • Loa%ing of per Action o!ect repositor# ta=es "ess time as the si7e is "ess

    • *e"ect *hare% to set the !ect /epositor# mo%e for #our test to the *hare%

    !ect /epositor# mo%e.

    @e"o5 are some of the factors !ase% on 5hich *hare% Action option is se"ecte%

    • :henever there are common o!ects across transactions

  • 8/20/2019 45937502 Automation Framework

    56/100

    For more QTP scripts, Log onto www.ramupalanki.com 

    The !ect /epositor# Fi"e

  • 8/20/2019 45937502 Automation Framework

    57/100

    For more QTP scripts, Log onto www.ramupalanki.com 

    !ect/epositor#

  • 8/20/2019 45937502 Automation Framework

    58/100

    For more QTP scripts, Log onto www.ramupalanki.com 

    +ote: 'f #ou are ca""ing reusa!"e Actions, #ou ma# !e a!"e to have more than 2++Actions 5ithin the script. This can !e accomp"ishe% if #ou are ca""ing the same Actionmore than one time 5ithin the script. The %ata sheet for the Action 5i"" on"# !e "oa%e%once. This app"ies to ca"" to Actions on"#.

    Example:'n a ne5 script, insert a ca"" to a reusa!"e Action. :hen the Action is a%%e% to thescript, #ou 5i"" see the %ata sheet a%%e% to the %ata ta!"e. 'nsert another ca"" to to thesame Action. The %ata sheet 5i"" not !e a%%e% again.

    17. 0ariables

    'n QTP scripting there are main"# 3 t#pes of varia!"e that 5e use. The# are)

    www.ramupalanki.com

    http://www.ramupalanki.com/http://www.ramupalanki.com/

  • 8/20/2019 45937502 Automation Framework

    59/100

    For more QTP scripts, Log onto www.ramupalanki.com 

    • Action Parameters.

    • Environment $aria!"es.

    • $@ $aria!"es, 5hich 5e %ec"are in the script.

    17.1 Action &arameters

    Action parameters ena!"e #ou to transfer va"ues !et5een actions an% their neste%actions in #our test, from #our test to a top&"eve" action, or from a step in a top&"eve" action !ac= to the script or action that ran ca""e%B #our test. For eamp"e,#ou can output a va"ue from a step in a neste% action an% store it in an outputaction parameter, an% then use that va"ue as input in a "ater step in the ca""ing parent action.

    Oou %efine the parameters that an action can receive an% the output va"ues that it can

    return in the Parameters ta! of the Action Properties %ia"og !o. Oou specif# the actua"va"ues that are provi%e% to these parameters an% the "ocations in 5hich the output va"uesare store% in the Parameter $a"ues ta! in the Action a"" Properties %ia"og !o.

    Oou can specif# input parameters for an action so it can receive input va"ues frome"se5here in the test. 'nput va"ues for an action can !e retrieve% from the test for a top&"eve" actionB or from the parameters of the action that ca""s it for a neste% actionB. Ooucan a"so specif# output parameters for an action, so that it can output va"ues for use "aterin the test, or pass va"ues !ac= to the app"ication that ran ca""e%B the test.

    Setting Action &arameters

    Oou can specif# input parameters for an action so that steps in the action can use va"uessupp"ie% from e"se5here in the test. 'nput va"ues for an action parameter can !e retrieve%from the test for a top&"eve" actionB or from the parameters of the action that ca""s it fora neste% actionB. Oou can specif# output parameters for an action, so that it can returnva"ues for use "ater in the test. For each input or output action parameter, #ou %efine aname an% a t#pe. Oou can a"so specif# a %efau"t va"ue for each action input parameter, or#ou can use the %efau"t va"ue that Quic=Test provi%es for the parameter va"ue t#pe that#ou choose. The %efau"t va"ue is save% 5ith the action an% is use% !# the action if a va"ueis not %efine% for a parameter in the action ca"". Oou can %efine, mo%if#, an% %e"ete input

    an% output parameters in the Parameters ta! of the Action Properties %ia"og !o.

    www.ramupalanki.com

    http://www.ramupalanki.com/http://www.ramupalanki.com/

  • 8/20/2019 45937502 Automation Framework

    60/100

    For more QTP scripts, Log onto www.ramupalanki.com 

    To add a new input or output action parameter:

    1. "ic= the Add !utton net to the !nput parameters or (utputparameters "ists to a%% a ne5 parameter to the appropriate "ist. A ro5 for the ne5 parameter is a%%e% to the re"evant "ist.2. "ic= in the +ame !o an% enter a name for the parameter.3. *e"ect the va"ue t#pe for the parameter in the T%pe !o. Oou can se"ectone of the fo""o5ing t#pes)o String NA character string enc"ose% 5ithin a pair of ?uotation

    mar=s, for eamp"e, (e5 Oor=. 'f #ou enter a va"ue an% %o not inc"u%e the?uotation mar=s, Quic=Test a%%s them automatica""# 5hen the va"ue is inserte% inthe script %uring the test run. The %efau"t va"ue is an empt# string.o 5oolean NA true or fa"se va"ue. 'f #ou se"ect a 5oolean va"ue

    t#pe, #ou can c"ic= in the Default 0alue co"umn an% c"ic= the arro5 to se"ect aTrue or alse va"ue. The %efau"t va"ue is True.o Date NA %ate string, for eamp"e, 3;2;2+. 'f #ou se"ect a Date

    va"ue t#pe, #ou can c"ic= in the Default 0alue co"umn an% c"ic= the arro5 toopen a ca"en%ar from 5hich #ou can se"ect a %ate. The %efau"t va"ue is to%a#s%ate.

    www.ramupalanki.com

    http://www.ramupalanki.com/http://www.ramupalanki.com/

  • 8/20/2019 45937502 Automation Framework

    61/100

    For more QTP scripts, Log onto www.ramupalanki.com 

    o +umber NAn# positive or negative num!er. The %efau"t va"ue is

    .o &assword NAn encr#pte% pass5or% va"ue. 'f #ou se"ect a

    &assword va"ue t#pe, the pass5or% characters are mas=e% 5hen #ou enter the pass5or% in the Default 0alue fie"%. The %efau"t va"ue is an empt# string.

    o An% NA variant va"ue t#pe, 5hich accepts an# of the a!ove va"uet#pes. (ote that if #ou se"ect the An% va"ue t#pe, #ou must specif# the va"ue inthe format that is re?uire% in the "ocation 5here #ou inten% to use the va"ue. Foreamp"e, if #ou inten% to use the va"ue "ater as a string, #ou must enc"ose it in?uotation mar=s. :hen #ou specif# a va"ue of An% t#pe, Quic=Test chec=s5hether it is a num!er. 'f the va"ue is not a num!er, Quic=Test automatica""#enc"oses it in ?uotation mar=s. 'f #ou are e%iting an eisting va"ue, Quic=Testautomatica""# enc"oses it in ?uotation mar=s if the previous va"ue ha% ?uotationmar=s. The %efau"t va"ue is an empt# string.4. 'f #ou are %efining an input action parameter, c"ic= in the Default 0alue !o an% enter a %efau"t va"ue for the parameter or #ou can "eave the %efau"t va"ue

     provi%e% !# Quic=Test for the parameter va"ue t#pe. The %efau"t va"ue is re?uire%so that #ou can run the action 5ithout receiving parameter va"ues from e"se5herein the test.+. 'f #ou 5ish, c"ic= in the Description !o, then enter a %escription of the parameter, for eamp"e, the purpose of the parameter in the action.

    To modif% an e#isting action parameter:

    1. *e"ect the parameter #ou 5ant to mo%if# from the !nput parameters or(utput parameters "ist.2.

  • 8/20/2019 45937502 Automation Framework

    62/100

    For more QTP scripts, Log onto www.ramupalanki.com 

    The Parameters ta! contains t5o parameter "ists)

    • !nput parameters N*pecifies the parameters that receiveva"ues from sources that are eterna" to the test or component.• (utput parameters N*pecifies the parameters that passva"ues to sources that are eterna" to the test or component.

    Oou can e%it an eisting parameter !# se"ecting it in the appropriate "ist an%mo%if#ing its %etai"s.

    Oou can a%% an% %e"ete input an% output parameters for #our test or componentusing the parameter contro" !uttons)

    (ption Description

    www.ramupalanki.com

    http://www.ramupalanki.com/http://www.ramupalanki.com/

  • 8/20/2019 45937502 Automation Framework

    63/100

    For more QTP scripts, Log onto www.ramupalanki.com 

    A%%s a parameter to the appropriate parameter "ist. Enter a name for thene5 parameter an% se"ect the parameter t#pe. Oou can enter a %escriptionfor the parameter, for eamp"e, the purpose of the parameter in thecomponent. 'f #ou are %efining an input parameter, enter a %efau"t va"uefor the parameter in the Default 0alue co"umn.

    Oou %efine test or component parameters in the same 5a# #ou %efineaction parameters.

    /emoves the se"ecte% parameter from the test or component.

    Defining 0alues for !nput &arameters

    :hen the test or component runs, Quic=Test uses the %efau"t va"ue for each%efine% input parameter if a specific va"ue has not !een %efine% for the parameterin either Quic=Test or Qua"it# enter.

    :hen #ou run a test or !usiness component from Quic=Test, input parameterva"ues for tests an% components are ta=en from in the 'nput Parameters ta! of the/un %ia"og !o.

    *sing Test or Component &arameters

    nce #ou have %efine% test or component parameters, #ou insert them in #our testor component !# specif#ing the test or component parameter name 5ith the&arameter reserve% o!ect, in the format) ParameterParameter(ameB.

    17. "nvironment 0ariables

    Quic=Test can insert a va"ue from the Environment varia!"e "ist, 5hich is a "ist ofvaria!"es an% correspon%ing va"ues that can !e accesse% from #our test. Throughout thetest run, the va"ue of an environment varia!"e remains the same, regar%"ess of the num!erof iterations, un"ess #ou change the va"ue of the varia!"e programmatica""# in #our script.

    There are three t#pes of environment varia!"es)

    • *ser9Defined !nternal Nvaria!"es that #ou %efine 5ithin the test. Thesevaria!"es are save% 5ith the test an% are accessi!"e on"# 5ithin the test in 5hich

    the# 5ere %efine%.

    Oou can create or mo%if# interna", user&%efine% environment varia!"es for#our test in the Environment ta! of the Test *ettings %ia"og !o or in theParameter ptions %ia"og !o.

    www.ramupalanki.com

    http://www.ramupalanki.com/http://www.ramupalanki.com/

  • 8/20/2019 45937502 Automation Framework

    64/100

    For more QTP scripts, Log onto www.ramupalanki.com 

    Tip: Oou can a"so create environment output va"ues, 5hich retrieve va"ues%uring the test run an% output them to interna" environment varia!"e parameters for use in #our test.

    • *ser9Defined "#ternal Nvaria!"es that #ou pre%efine in the active

    eterna" environment varia!"es fi"e. Oou can create as man# fi"es as #ou 5ant an%se"ect an appropriate fi"e for each test, or change fi"es for each test run. (ote thateterna" environment varia!"e va"ues are %esignate% as rea%&on"# 5ithin the test.

    • 5uilt9in Nvaria!"es that represent information a!out the test an% thecomputer on 5hich the test is run, such as Test path an% perating s#stem. Thesevaria!"es are accessi!"e from a"" tests, an% are %esignate% as rea%&on"#.

    +ote: Quic=Test a"so has a set of pre%efine% environment varia!"es that

    #ou can use to set the va"ues of the /ecor% an% /un *ettings %ia"ogoptions. Oou shou"% not use the names of these varia!"es for an# other purpose.

    17.= 0ariable passing from one Action to another

    Quic=Test ena!"es #ou to retrieve va"ues in #our test or component an% to store them asoutput va"ues. Oou can su!se?uent"# retrieve these va"ues an% use them as input at a%ifferent stage in the run session. Oou can pass varia!"es from one action to another !#

    setting Action a"" Parameter $a"ues. Oou use the Parameter $a"ues ta! of the Actiona"" Properties %ia"og !o to specif# the va"ues of input action parameters use% !# theca""e% action an% to specif# the "ocations in 5hich #ou 5ant to store output action parameter va"ues. Oou can a"so parameteri7e the va"ue use% for a particu"ar input action parameter using an# avai"a!"e parameter t#pe.

    The actua" input an% output action parameters that an action can receive or return, an%their t#pes, are %efine% in the Action Properties %ia"og !o. 'f #ou %o not set a va"ue foran input action parameter in the Action a"" Properties %ia"og !o, the %efau"t va"ue thatis specifie% in the Action Properties %ia"og !o is use%.

    www.ramupalanki.com

    http://www.ramupalanki.com/http://www.ramupalanki.com/

  • 8/20/2019 45937502 Automation Framework

    65/100

    For more QTP scripts, Log onto www.ramupalanki.com 

    Oou can specif# a "ocation in 5hich to store the output action parameter va"ues, 5hichcan !e use% in the ca""e% action.

    To specif% a location in which to store an output action parameter value:

    1. 'n the (utput parameters area, c"ic= in the Store !n !o for the

     parameter an% enter a varia!"e name.

    www.ramupalanki.com

    http://www.ramupalanki.com/http://www.ramupalanki.com/

  • 8/20/2019 45937502 Automation Framework

    66/100

    For more QTP scripts, Log onto www.ramupalanki.com 

    'f 5e choose varia!"e to store the va"ue, then the va"ue is store% in a run&time varia!"e for the %uration of the run session. Oou can accept the%efau"t name assigne% to the varia!"e or enter a %ifferent varia!"e name.

    A"ternative"#, #ou can c"ic= the output storage !utton in the Store !n

     !o to open the *torage Location ptions %ia"og !o in 5hich #ou canspecif# a "ocation for storing the output va"ue. Oou can se"ect to store theva"ue in a test or action parameter, a Data Ta!"e parameter, or anenvironment parameter.

    2. /epeat this proce%ure for each output action parameter va"ue in the "ist.

    17. Scope of 0ariables

  • 8/20/2019 45937502 Automation Framework

    67/100

    For more QTP scripts, Log onto www.ramupalanki.com 

    %efine% for the action #ou copie%. :hen #ou sp"it an action, the action parameters arecopie% to !oth actions. The action ca"" va"ues for the secon% action are ta=en from the%efau"t va"ues of that actions parameters.

    Environment varia!"es can !e accesse% from #our test. Throughout the test run,

    the va"ue of an environment varia!"e remains the same, regar%"ess of the num!erof iterations, un"ess #ou change the va"ue of the varia!"e programmatica""# in#our script.

    There are three t#pes of environment varia!"es)

    *ser9Defined !nternal Nvaria!"es that #ou %efine 5ithin the test. Thesevaria!"es are save% 5ith the test an% are accessi!"e on"# 5ithin the test in 5hichthe# 5ere %efine%.

    Oou can create or mo%if# interna", user&%efine% environment varia!"es for

    #our test in the Environment ta! of the Test *ettings %ia"og !o or in theParameter ptions %ia"og !o.

    *ser9Defined "#ternal Nvaria!"es that #ou pre%efine in the activeeterna" environment varia!"es fi"e. Oou can create as man# fi"es as #ou 5ant an%se"ect an appropriate fi"e for each test, or change fi"es for each test run. (ote thateterna" environment varia!"e va"ues are %esignate% as rea%&on"# 5ithin the test.

    5uilt9in Nvaria!"es that represent information a!out the test an% the

    computer on 5hich the test is run, such as Test path an% perating s#stem. Thesevaria!"es are accessi!"e from a"" tests, an% are %esignate% as rea%&on"#.

    www.ramupalanki.com

    http://www.ramupalanki.com/http://www.ramupalanki.com/

  • 8/20/2019 45937502 Automation Framework

    68/100

    For more QTP scripts, Log onto www.ramupalanki.com 

    11. Check &oints

    A checkpoint  is a verification point that compares a current va"ue for a specifie% propert#5ith the epecte% va"ue for that propert#.

    11.1 T%pes of Checkpoints

    'n QTP the fo""o5ing t#pes of chec=points can !e inserte% to chec= various o!ects in a:e! site or app"ication.

    • Standard Checkpoint chec=s the propert# va"ue of an o!ect in #ourapp"ication or :e! page. The stan%ar% chec=point chec=s a variet# of o!ectssuch as !uttons, ra%io !uttons, com!o !oes, "ists, etc. For eamp"e, #ou canchec= that a ra%io !utton is activate% after it is se"ecte% or #ou can chec= the va"ue

    of an e%it fie"%.

    +ote: *tan%ar% chec=points are supporte% for a"" a%%&in environments

    • !mage Checkpoint chec=s the va"ue of an image in the app"ication or :e! page.For eamp"e, 5e can chec= that a se"ecte% images source fi"e is correct.

    +ote: 'mage chec=point can !e create% !# inserting a stan%ar% chec=point on animage o!ect.

    'mage chec=points are supporte% on"# for the :e! environment

    • 5itmap Checkpoint chec=s an area of a :e! page or an app"ication as a !itmap. For eamp"e, consi%er a :e! site that can %isp"a# a map of a cit# the userspecifies. The map has contro" =e#s for 7ooming. :e can recor% the ne5 map thatis %isp"a#e% after one c"ic= on the contro" =e# that 7ooms in the map. 6sing the !itmap chec=point, 5e can chec= that the map 7ooms in correct"#.

    +ote: @itmap chec=points are supporte% for a"" a%%&in environments

    • Table Checkpoint chec=s information 5ithin a ta!"e. For eamp"e, supposean app"ication or :e! site contains a ta!"e "isting a"" avai"a!"e f"ights from (e5Oor= to *an Francisco. Oou can a%% a ta!"e chec=point to chec= that the time ofthe first f"ight in the ta!"e is correct.

    www.ramupalanki.com

    http://www.ramupalanki.com/http://www.ramupalanki.com/

  • 8/20/2019 45937502 Automation Framework

    69/100

    For more QTP scripts, Log onto www.ramupalanki.com 

    +ote: Oou create a ta!"e chec=point !# inserting a stan%ar% chec=point on a ta!"eo!ect.

    Ta!"e chec=points are supporte% for :e! an% ActiveK environments 9 for man#other eterna" a%%&in environments.

    • Te#t Checkpoint chec=s that a tet string is %isp"a#e% in the appropriate p"ace in the app"ication or a :e! page. For eamp"e, consi%er an app"ication or:e! page that %isp"a#s the sentence F"ight %eparting from (e5 Oor= to *anFrancisco. :e can create a tet chec=point that chec=s that the 5or%s (e5Oor= are %isp"a#e% !et5een F"ight %eparting from an% to *an Francisco.

    Tet chec=points are supporte% for a"" a%%&in environments

    • Te#t Area Checkpoint chec=s that a tet string is %isp"a#e% 5ithin a %efine%

    area in a :in%o5s app"ication, accor%ing to specifie% criteria. For eamp"e,suppose #our $isua" @asic app"ication has a !utton that sa#s $ie5 Doc (um,5here (um is rep"ace% !# the four %igit co%e entere% in a form e"se5here inthe app"ication. Oou can create a tet area chec=point to confirm that the num!er%isp"a#e% on the !utton is the same as the num!er entere% in the form.

    Tet area chec=points are supporte% for *tan%ar% :in%o5s, $isua" @asic, an%ActiveK a%%&in environments Tet area chec=points are a"so supporte% for someeterna" a%%&in environments.

    Accessibilit% Checkpoint i%entifies areas of #our :e! site that ma# notconform to the :or"% :i%e :e! onsortium :3B :e! ontent Accessi!i"it#8ui%e"ines. For eamp"e, gui%e"ine 1.1 of the :3 :e! ontent Accessi!i"it#8ui%e"ines re?uires #ou to provi%e a tet e?uiva"ent for ever# non&tet e"ement.Oou can a%% an Alt propert# chec= to chec= 5hether o!ects that re?uire the Alt propert# un%er this gui%e"ine, %o in fact have this tag.

    Accessi!i"it# chec=points are supporte% for the :e! environment

    • &age Checkpoint chec=s the characteristics of a :e! page. For eamp"e, #ou canchec= ho5 "ong a :e! page ta=es to "oa% or 5hether a :e! page contains !ro=en

    "in=s.

    +ote: Oou create a page chec=point !# inserting a stan%ar% chec=point on a pageo!ect.

    Page chec=points are supporte% for the :e! environment

    www.ramupalanki.com

    http://www.ramupalanki.com/http://www.ramupalanki.com/

  • 8/20/2019 45937502 Automation Framework

    70/100

    For more QTP scripts, Log onto www.ramupalanki.com 

    • Database Checkpoint chec=s the contents of a %ata!ase accesse% !# #our:e! site. For eamp"e, #ou can use a %ata!ase chec=point to chec= the contentsof a %ata!ase containing f"ight information for #our :e! site.

    Data!ase chec=points are supporte% !# a"" environments.

    • 6/ Checkpoint chec=s the %ata content of K

  • 8/20/2019 45937502 Automation Framework

    71/100

    For more QTP scripts, Log onto www.ramupalanki.com 

    • To a%% chec=points 5hi"e recor%ing• To a%% a chec=point 5hi"e e%iting the test

    For more information refer to hec=points

    (utput 0alues &roperties Dialog 5o#

    The utput $a"ue Properties %ia"og !o ena!"es #ou to choose 5hich propert# va"ues tooutput an% to %efine the settings for each va"ue that #ou se"ect.+ote: 'f #ou insert an output va"ue on a :e! page, the Page utput $a"ueProperties %ia"og !o opens. This %ia"og ecept that it contains t5o a%%itiona"option areas, >T

  • 8/20/2019 45937502 Automation Framework

    72/100

    For more QTP scripts, Log onto www.ramupalanki.com 

    • ActionYTest Parameter.

    This option is given in the output options %ia"og !o

    12. $eusable ibrar%

    Description

    www.ramupalanki.com

    http://www.ramupalanki.com/http://www.ramupalanki.com/

  • 8/20/2019 45937502 Automation Framework

    73/100

    For more QTP scripts, Log onto www.ramupalanki.com 

    :hen forming a ne5 pro%uct the tra%itiona" engineer can ta=e a%vantage of rea%#&ma%esu!assem!"ies. To the test engineer, reusa!"e soft5are components offer the same possi!i"itiesX the same components can !e incorporate% into man# 5ho"e ne5 s#stems,thus saving the consi%era!"e time an% effort it can ta=e to generate ne5 soft5are.

    *tarting 5ith an intro%uction to soft5are reuse an% a %iscussion of its feasi!i"it#, theauthors go on to consi%er ho5 the components that ma# !e foun% cou"% !e use%. Thereusa!"e "i!rar# 5as %esigne% 5ith reuse ver# much in min%, ma=ing it essentia""# asma"", !ut inva"ua!"e, "i!rar#.

    12.1 !ntroduction

    'n QTP 5e can create $@*cript "i!rar# fi"es containing $@*cript functions, su!routines,c"asses, mo%u"es, etc., an% then associate the fi"es 5ith our test. :e can ca"" an# $@*cript

    function, su!routine, etc., containe% 5ithin an# "i!rar# fi"e that is associate% 5ith our test.An# tet fi"e 5ritten in stan%ar% $@*cript s#nta can act as a "i!rar# fi"e.

    a@ unctions

    i. 5uilt9!n

    ii. *ser defined

    :e can specif# the %efau"t "i!rar# fi"es for a"" ne5 tests in the Test*ettings %ia"og !o Test Settings $esources ta!B. :e can a"so e%it

    the "ist of associate% "i!rar# fi"es for an eisting test in the Test *ettings%ia"og !o. (ote that once a test is create%, the "ist of fi"es specifie% in theTest *ettings %ia"og !o is in%epen%ent of the fi"es set as %efau"t in theTest *ettings %ia"og !o. hanges to the %efau"t "i!rar# fi"es "ist in theTest.

    12.2 4ow to establish a $eusable ibrar%

    a. Defining $esource Settings for Iour Test

    www.ramupalanki.com

    http://www.ramupalanki.com/http://www.ramupalanki.com/

  • 8/20/2019 45937502 Automation Framework

    74/100

    For more QTP scripts, Log onto www.ramupalanki.com 

    :e can use the /esources ta! of the Test *ettings %ia"og !o to associate specific fi"es5ith #our test, such as $@*cript "i!rar# fi"es an% Data Ta!"e fi"es, an% to specif# theo!ect repositor# mo%e an% fi"e to use for our test. :e can a"so set the current"#associate% "i!rar# fi"es an% o!ect repositor# settings as the %efau"t settings for a"" ne5tests.

    b. "#ecuting "#ternall%9Defined unctions from Iour Test

    :e can create a $@*cript fi"e an% ca"" its functions, su!routines, c"asses, etc., from anaction in #our test or from an associate% "i!rar# fi"e !# inserting an "#ecuteilestatement in our action or "i!rar# fi"e.

    :hen 5e run our test, the "#ecuteile statement eecutes a"" g"o!a" co%e in the specifie%fi"e in or%er to ma=e a"" %efinitions in the fi"e avai"a!"e from the g"o!a" scope of theactions or "i!rar# fi"esB script.

    To eecute an eterna""#&%efine% function)

    www.ramupalanki.com

    http://www.ramupalanki.com/http://www.ramupalanki.com/

  • 8/20/2019 45937502 Automation Framework

    75/100

    For more QTP scripts, Log onto www.ramupalanki.com 

    1. reate a $@*cript fi"e using stan%ar% $@*cripts#nta.2. *tore the fi"e in an# fo"%er that #ou can access fromthe machine running #our test.3. A%% an "#ecuteile statement to an action in #our

    test or in an associate% "i!rar# fi"e using the fo""o5ing s#nta)

    "#ecuteile  FileName 5here FileName is the a!so"ute or re"ative path of our $@*cript fi"e.

    1. 6se the functions, su!routines, c"asses, etc., from thespecifie% $@*cript fi"e as necessar# in #our action or 5ithin otherfunctions in an associate% "i!rar# fi"e.

    12. 4ow to use this $eusable ibrar%.

    1. $egular "#pressions

    1.1 Description

    www.ramupalanki.com

    http://www.ramupalanki.com/http://www.ramupalanki.com/

  • 8/20/2019 45937502 Automation Framework

    76/100

    For more QTP scripts, Log onto www.ramupalanki.com 

    :hi"e creating chec=points 5e have an option on"# to search or chec= for a specific tet string or a specific va"ue of a propert#. To increase the f"ei!i"it# an% a%apta!i"it#

    of the tests 5e use regu"ar epressions./egu"ar Epressions ena!"e Quic= Test to i%entif# o!ects an% tet strings 5ith var#ingva"ues.

    A regu"ar epression is a string that specifies a comp"e search phrase. @# using specia"characters 5e %efine the con%itions of the search.

    The most common epressions that can !e use% to create regu"ar epressions are)

    1. *sing the 5ackslash Character

    A !ac=s"ash YB instructs Quic= Test to treat the net character as a "itera"character, if it is other5ise a specia" character. The !ac=s"ash YB can a"so instruct

    Quic= Test to recogni7e certain or%inar# characters as specia" characters.

    For eamp"e, consi%er a :e! site ca""e%)

    mercur%tours.mercur%interactive.com

    The perio% 5ou"% !e mista=en as an in%ication of a regu"ar epression. Toin%icate that the perio% is not part of a regu"ar epression, #ou 5ou"% 5rite it asfo""o5s)

    mercur%toursG.mercur%interactiveG.com

    2. /atching An% Single Character

    A perio% .B instructs Quic= Test to search for an# sing"e character ecept for YnB.For eamp"e)

    welcome.

    matches 5e"comes, 5e"come%, or 5e"come fo""o5e% !# a space or an# othersing"e character. A series of perio%s in%icates the same num!er of unspecifie%characters.To match an# sing"e character inc"u%ing Yn, enter) ?.JGn@

    . /atching An% Single Character in a ist

    *?uare !rac=ets instruct Quic=Test to search for an# sing"e character 5ithin a "ist ofcharacters. For eamp"e, to search for the %ate 10-, 10, or 100, 5rite) 1HK;HL

    =. /atching An% Single Character +ot in a ist

    www.ramupalanki.com

    http://www.ramupalanki.com/http://www.ramupalanki.com/

  • 8/20/2019 45937502 Automation Framework

    77/100

    For more QTP scripts, Log onto www.ramupalanki.com 

    :hen a caret ZB is the first character insi%e s?uare !rac=ets, it instructs Quic=Test tomatch an# character in the "ist ecept for the ones specifie% in the string. For eamp"e)KMabL

    matches an# character ecept a or !.

    . /atching An% Single Character within a $ange

    'n or%er to match a sing"e character 5ithin a range, #ou can use s?uare !rac=ets [ \B 5iththe h#phen &B character. For instance, to match an# #ear in the 10s, 5rite) 1HK79HL

    A h#phen %oes not signif# a range if it is %isp"a#e% as the first or "ast character 5ithin !rac=ets, or after a caret MB.For eamp"e, [9a9\ matches a h#phen or an# "o5ercase "etter.

    . /atching Nero or /ore Specific Characters

    An asteris= OB instructs Quic=Test to match 7ero or more occurrences of the prece%ingcharacter. For eamp"e)caOr matches carB caaaaaarB and cr. 

    . /atching (ne or /ore Specific Characters

    A p"us sign B instructs Quic=Test to match one or more occurrences of the prece%ing character. For eamp"e)caPr  matches car an% caaaaaar, !ut not cr. ;. /atching Nero or (ne Specific Character

    A ?uestion mar= QB instructs Quic= Test to match 7ero or one occurrences of the prece%ing character. For eamp"e)caQr matches car an% cr, !ut nothing e"se.

    H. -rouping $egular "#pressions

    Parentheses BB instruct Quic= Test to treat the containe% se?uence as a unit, ustas in mathematics an% programming "anguages.6sing groups is especia""# usefu" for %e"imiting the argumentsB to an a"ternationoperator ] B or a repetition operator S , , ^ , _ ` B.

    17. /atching (ne of Several $egular "#pressions

    A vertica" "ine ]B instructs Quic=Test to match one of a choice of epressions. Foreamp"e) fooJbar causes Quic=Test to match either foo or bar. fo?oJb@ar causes Quic= Test to match either fooar or fo!ar.11. /atching the 5eginning of a ine

    www.ramupalanki.com

    http://www.ramupalanki.com/http://www.ramupalanki.com/

  • 8/20/2019 45937502 Automation Framework

    78/100

    For more QTP scripts, Log onto www.ramupalanki.com 

    A caret ZB instructs Quic=Test to match the epression on"# at the start of a "ine,or after a ne5"ine character.For eamp"e) bookmatches !oo= 5ithin the "inesN bookB m% bookB and book listB 5hi"eMbook  @. For eamp"e)GwO causes Quic=Test to match 7ero or more occurrences of the a"phanumericcharactersNA&b, a&7, &0, an% the un%erscore CB. 't matches A!, r0, or12CuOLgeuC43+.For eamp"e)Gw causes Quic= Test to match 3 occurrences of the a"phanumeric characters A9NB a9B 79HB an% the un%erscore ? > B. 't matches Ab=B rH>B or >/. 1=. /atching An% +on9Alpha+umeric Character

    G' instructs Quic=Test to match an# character other than a"phanumeric charactersan% un%erscores. For eamp"e)G' matches EB OB MB UB RB and V . 1. Combining $egular "#pression (perators

    Oou can com!ine regu"ar epression operators in a sing"e epression to achievethe eact search criteria #ou nee%.For eamp"e, #ou can com!ine the . an% S characters in or%er to fin% 7ero ormore occurrences of an# character ecept GnB.For eamp"e, start.Omatches startB startedB startingB starterB etc.Oou can use a com!ination of !rac=ets an% an asteris= to "imit the search to acom!ination of non&numeric characters. For eamp"e)Ka9A9NLO

    Creating checkpoints with $egular "#pressions 

    www.ramupalanki.com

    http://www.ramupalanki.com/http://www.ramupalanki.com/

  • 8/20/2019 45937502 Automation Framework

    79/100

    For more QTP scripts, Log onto www.ramupalanki.com 

    /egu"ar epressions are genera""# use% in the contet of creating chec=points tochec= a range of va"ues.For more information on creating chec=points 5ith regu"ar epressions refer/egu"ar Epressions

    Anal%ing a Test with $egular "#pressions:hen the test run is comp"ete%, the Test /esu"ts 5in%o5 opens.

    1. "#amine the checkpoint results.

    'n the resu"ts tree, epan% B Test $eg"#pression Summar% $eg"#pression !teration 1 ?$ow 1@ Action1 Summar% light

    $eservations a# (rder +o. 12

    *e"ect hec=Point Fa r%er (oY. [&0\[&0\.

    The chec=point passe% !ecause the tet 5as %isp"a#e% in the format specifie% !#the regu"ar epression.

    www.ramupalanki.com

    http://www.ramupalanki.com/http://opt/scribd/conversion/admin/Local%20Settings/Documents%20and%20Settings/pkasireddy/Local%20Settings/ra18713/Mahesh&RK/29-12/Reference%20documents/Regular%20Expressions.dochttp://opt/scribd/conversion/admin/Local%20Settings/Documents%20and%20Settings/pkasireddy/Local%20Settings/ra18713/Mahesh&RK/29-12/Reference%20documents/Regular%20Expressions.dochttp://www.ramupalanki.com/

  • 8/20/2019 45937502 Automation Framework

    80/100

    For more QTP scripts, Log onto www.ramupalanki.com 

    1=. $ecover% Scenario

    Oou can instruct Quic= Test to recover from unepecte% events an% errors that occur in#our testing environment %uring a test run.

    6nepecte% events, errors, an% app"ication crashes %uring a test run can %isrupt #our testan% %istort test resu"ts. This is a pro!"em particu"ar"# 5hen running tests unatten%e%Nthetest is suspen%e% unti" #ou perform the action nee%e% to recover.The /ecover# *cenario

  • 8/20/2019 45937502 Automation Framework

    81/100

    For more QTP scripts, Log onto www.ramupalanki.com 

    :hen #ou run a test for 5hich #ou have %efine% recover# scenarios an% an error occurs,Quic= Test "oo=s for the %efine% trigger eventsB that cause% the error. 'f a trigger eventhas occurre%, Quic= Test performs the correspon%ing recover# an% post&recover#operations.

    Oou can a"so contro" an% activate #our recover# scenarios %uring the test run !# inserting$ecover% statements into #our test.

    +ote: 'f #ou choose (n error in the Activate recover% scenarios !o in the /ecover#ta! of the Test *ettings %ia"og !o, the recover# mechanism %oes not han%"e triggers thatoccur in the "ast step of a test. 'f #ou chose this option an% nee% to recover from anunepecte% event or error that ma# occur in the "ast step, #ou of a test can %o this !#a%%ing an etra step to the en% of #our test.

    1=.1 "#ce