Welcome to Scribd. Sign in or start your free trial to enjoy unlimited e-books, audiobooks & documents.Find out more
Standard view
Full view
of .
Look up keyword
Like this
0 of .
Results for:
No results containing your search query
P. 1
Driver script to run multiple QTP scripts

Driver script to run multiple QTP scripts

Ratings: (0)|Views: 1,460|Likes:
Published by api-19840982

More info:

Published by: api-19840982 on Nov 30, 2009
Copyright:Attribution Non-commercial


Read on Scribd mobile: iPhone, iPad and Android.
download as DOC, PDF, TXT or read online from Scribd
See more
See less





Sample of Driver script to run multiple QTP scripts
If you just wish to control the execution of QTP Actions, you don't need anything
I'll describe a simple way of achieving your goal with really minimum development
1) Let's agree that your QTP test is a script that should run a sequence of actions.
Each action can be a test on its own, or really a part of a more complex test.

2) In such a case:
a) Your main action (e.g., Action1) would contain the code as shown below.
b) Define environment variables as required:


You can define these in the test or in an external xml file to be loaded at run-time
GeSHi (qtp):
Created by GeSHI
Main Action code
GeSHi (qtp):
Dim arrActions, blnBreak, intMinAction, intMaxAction, intCurAction
arrActions =split(Environment("TEST_FLOW"),";")

'Remark: The TEST_FLOW environment variable would contain a concatenated string
with the actions names separated by ; (semicolon). For example: "Login;Create
Customer;Create Account;Activate Account;Create Service Package;Logout"

blnBreak =F al se
intCurAction =0
intMinAction = Environment("MIN_ACTION") 'MIN_ACTION would contain an integer

with the first action to run in the flow (default=1).
If (intMinAction =0 Or intMinAction ="") Then
intMinAction =L B ound(arrActions)'De faul t
End If
intMaxAction = Environment("MAX_ACTION")
If (intMaxAction =0 Or intMaxAction ="") Then
intMaxAction =UB ound(arrActions)'De faul t
End If
intCurAction = intMinAction
DoblnBreak = RunAction arrActions(intCurAction) 'it's also possible to build it with the
other parameters such as number of iterations, etc.
intCurAction = intCurAction+1
Loop Until (blnBreak Or intCurAction > intMaxAction)
Created by GeSHI
Another approach (as you suggested) is to define per action whether to run it or not.
Please note that this requires that the actions ARE NOT functionally dependent.

You can achieve this by defining an environment variable for each to-be-run action
(e.g., Create Service Package) and assigning it a value of, for instance, Y/N.
Then your loop code would change to:

GeSHi (qtp):
DoIf (Environment(arrActions(intCurAction)) ="Y") Then
blnBreak = RunAction arrActions(intCurAction)
End If
intCurAction = intCurAction+1
Loop Until (blnBreak Or intCurAction > intMaxAction)

Activity (14)

You've already reviewed this. Edit your review.
1 hundred reads
1 thousand reads
Kavitha Adi liked this
kasaramkiran liked this
dilse_shiva liked this
poonguzhaliv liked this
sateesh4u liked this
minemotorola liked this
agwadeyar liked this

You're Reading a Free Preview

/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->