Professional Documents
Culture Documents
www.ramupalanki.com
Sample of Driver script to run multiple QTP scripts
Hi,
If you just wish to control the execution of QTP Actions, you don't need anything special.
I'll describe a simple way of achieving your goal with really minimum development effort.
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.
TEST_FLOW
MIN_ACTION
MAX_ACTION
You can define these in the test or in an external xml file to be loaded at run-time with:
Code
GeSHi (qtp):
Environment.Load(<Pathname>)
Code
GeSHi (qtp):
blnBreak = False
intCurAction = 0
End If
intMaxAction = Environment("MAX_ACTION")
End If
intCurAction = intMinAction Do
blnBreak = RunAction arrActions(intCurAction) 'it's also possible to build it with the other
parameters such as number of iterations, etc.
intCurAction = intCurAction+1
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.
Code
GeSHi (qtp):
Do
End If
intCurAction = intCurAction+1
Give a try with this code from vbs file. It might work.
qtApp.Launch
qtApp.Visible = False
If Not(qtApp.TDConnection.IsConnected) Then
End If
qtApp.Test.Run
qtApp.Test.Run
qtApp.Test.Run
qtApp.quit
End Function
Call testFunc()