Micro Focus QTP (UFT) Forums
Calling different scripts actions in QTP - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: Calling different scripts actions in QTP (/Thread-Calling-different-scripts-actions-in-QTP)



Calling different scripts actions in QTP - Hitz - 02-21-2008

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.


RE: Calling different scripts actions in QTP - Ankur - 02-22-2008

"Call to existing action" is the standard way followed. What's the reason behind you not wanting to use this?


RE: Calling different scripts actions in QTP - Anshoo Arora - 05-11-2008

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



RE: Calling different scripts actions in QTP - navyasatish - 06-07-2008

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


RE: Calling different scripts actions in QTP - navyasatish - 06-07-2008

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


RE: Calling different scripts actions in QTP - Anshoo Arora - 06-07-2008

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.


RE: Calling different scripts actions in QTP - Pavan Kumar Munagala - 06-10-2008

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