Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Calling different scripts actions in QTP
#1
Solved: 11 Years, 5 Months ago
I have written many scripts eg. Login, Navigation, check Lookups, check searchdetails scripts. I would like to now have one script that will call these scripts.

I don't want to use "Call to Existing action" or the Test Batch Runner. I like the Batch Runner concept but i dont like the way it runs. Could some one please help me such that i can have one script that calls other scripts.
Reply
#2
Solved: 11 Years, 5 Months ago
"Call to existing action" is the standard way followed. What's the reason behind you not wanting to use this?
Want to fast track your QTP/UFT Learning? Join our UFT Training Course
Reply
#3
Solved: 11 Years, 5 Months ago
One way to accomplish this is by putting all your scripts into Subs/Functions and using a master Function to call all these. Something like this:

Code:
Public Sub Login()
    'your code
End Sub

Public Function LogOut()
    'your code
End Function

Code:
Public Function MasterFunc()
    Call Login
    Call Logout
End Function
Reply
#4
Solved: 11 Years, 5 Months ago
Hi ,

Though my question sounds silly but i want to make sure how the above one works...

i have 3 individual sripts that does Login, Manipulations , Logout... say...

in QTP.. when new test opens... do i need start with below 3 individual scripts and save them with their respective function names...

Public sub Login() public sub Manipulations() public Sub Logout()
. 'record/write the set of statements 'record/write the set of stmnts 'record/write the set of stmnt
. close the function end sub EndSub
End Sub


and now open new master test script

Should have the following set of statements in master test script

Public Function MasterFunc()
Call Login
Call Manipulations
Call Logout
End Function



correct me if i am wrong

thanks
Reply
#5
Solved: 11 Years, 5 Months ago
Hi ,

Though my question sounds silly but i want to make sure how the above one works...

i have 3 individual sripts that does Login, Manipulations , Logout... say...

in QTP.. when new test opens... do i need start with below 3 individual scripts and save them with their respective function names...

Code:
Public sub Login()
.'record/write the set of statements
. close the function end sub EndSub
End Sub

public sub Manipulations()
  'record/write the set of statements
End sub

public Sub Logout()
   'record/write the set of statements
End sub



and now open new master test script

Should have the following set of statements in master test script

Code:
Public Function MasterFunc()
Call Login
Call Manipulations
Call Logout
End Function



correct me if i am wrong

thanks
Reply
#6
Solved: 11 Years, 5 Months ago
I'm not quite sure what your question is, but the Original poster wanted to run a couple of scripts using one script. Is it what you are trying to do?

If yes, then I must tell you that it is not necessary, but just another way of accomplishing this. You can also call these scripts like this:

Code:
Call Login()
Call Manipulations()
Call LogOut()

instead of using:

Call MasterFunc()

Just a matter of preference, I guess.
Reply
#7
Solved: 11 Years, 5 Months ago
Hi,

Here you go with the automation framework design,

First make all your scripts eg. Login, Navigation, check Lookups, check searchdetails scripts. into functions

like
Function <Function Name>
script lines
End Function

Ex:
Function Login
script lines
End Function

In the same way create all scripts into functions and make them .vbs file and place them in the function library.

Now you create one script called (Driver Script - which drives which script to run, which script to not to run etc)

Please let me know if you need more info on this

Regards,
Pavan
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to call Actions from other Actions Naresh 1 8,039 09-25-2014, 10:26 AM
Last Post: vinod123
  Need Excel template for mapping manual scripts to Automation scripts. ACCBAJPA 0 2,989 09-19-2013, 03:02 PM
Last Post: ACCBAJPA
  Calling a HP Service Test Skript Gandalf2005 0 2,154 09-05-2012, 07:53 PM
Last Post: Gandalf2005
  Calling of function hamzaz 5 4,624 07-25-2012, 12:44 PM
Last Post: Shridevi.Salagare
  Function Calling after executing some steps TaranVohra 2 3,024 06-05-2012, 10:06 AM
Last Post: TaranVohra

Forum Jump:


Users browsing this thread: 2 Guest(s)