The online community for software testing & quality assurance professionals
 
 
Calendar   Today's Topics
Sponsors:
Lost Password?

Home
BetaSoft
Blogs
Jobs
Training
News
Links
Downloads



Testing Tools >> HP Functional Testing / Mercury QuickTest Pro / QTP

Pages: 1
qtptester439
Junior Member


Reged: 06/01/06
Posts: 4
Driver Script in QTP
      #225322 - 06/15/06 07:38 AM

Right now we are in the process of preparing Automation Framework Document; QTP will be used as the automation tool;
We are discussing to have a Driver Script as part of our Automation Framework;
Did any one implement similar kind of framework with QTP and TestDirector; Please let me know if this is a good approach;


Post Extras: Print Post   Remind Me!   Notify Moderator  
jimhazen
Super Member


Reged: 01/31/02
Posts: 2003
Loc: Highlands Ranch, CO, USA
Re: Driver Script in QTP
      #225323 - 06/15/06 10:42 AM

Define what you mean/understand a 'Driver' script to be. That way we can better understand your context and try to provide a relavent solution.

My definition/design of a driver script is probably different than yours.


Post Extras: Print Post   Remind Me!   Notify Moderator  
qtptester439
Junior Member


Reged: 06/01/06
Posts: 4
Re: Driver Script in QTP
      #225324 - 06/15/06 11:14 AM

HI Jim...
This is what we are planning to achieve; Please let me know if this is possible;

Driver Script
Driver script is the single main script of the Driver Engine. It iteratively traverses through the data of business scenario flow and calls the respective reusable scripts sequentially. It also enables us to execute a reusable script any number of times in a particular data row of the variable test data sheet. It also updates the database for execution results of a particular script run.


Post Extras: Print Post   Remind Me!   Notify Moderator  
Mark M
Advanced Member


Reged: 10/05/04
Posts: 458
Re: Driver Script in QTP
      #225325 - 06/15/06 01:17 PM

That definitely is doable. You could achieve most of it through Test Director as well but I think your method would afford you more flexibility should you need it. The only drawback I see is you'd have to design numerous error handlers yourself (as opposed to the in-built recovery options of TestDirector) and scheduling per test based on time (if needed) would be difficult to achieve. Not impossible, but tedious.

Post Extras: Print Post   Remind Me!   Notify Moderator  
jimhazen
Super Member


Reged: 01/31/02
Posts: 2003
Loc: Highlands Ranch, CO, USA
Re: Driver Script in QTP
      #225326 - 06/15/06 02:27 PM

Got it. In this case you would have a 'Master Driver' script that would call other Driver scripts which are calling specific action scripts.

So in essence you would have a 3 layer (or more) architecture for the framework. The top driver (Master Driver) reads the data file to determine which tests to run. The 'Test Driver' then gets the data associated to that test. It in turn calls 'User Action' scripts to do the actual work.

This is what I would consider to be like the early Action based automation frameworks. This is not Keyword Driven (where the object, action, and data are fed in from a file/dB and the script code just drives it all), but the Action is a business process that is fed with external data.

For example, Master Driver reads data file for tests to run & calls the appropriate Test Driver(s) (AddUser, AddPolicy, ModifyPolicy, etc.), Test Driver then calls a set of Action scripts/functions (Add User - StartIE, StartWebApp, GoToRegistrationPage, EnterUserData, ValidateNewUser, GoToHomePage) to do the actual work. Each Action script/function reads the data it needs to do its work.

This is a very basic view, but you get the idea of what can be done. It is up to your imagination/creativity how to really implement it all. Good luck.


Post Extras: Print Post   Remind Me!   Notify Moderator  
msnreddy
Newbie


Reged: 04/26/09
Posts: 19
Re: Driver Script in QTP [Re: jimhazen]
      #565204 - 04/26/09 07:18 AM

Hi jim,

can u send me the drive script to execute tests as batch
i understood u but i dont know how to start intially


Post Extras: Print Post   Remind Me!   Notify Moderator  
msnreddy
Newbie


Reged: 04/26/09
Posts: 19
Re: Driver Script in QTP [Re: msnreddy]
      #588130 - 08/28/09 02:03 AM

Hi jim

can u send me the sample code of driver script (let u take example of flight reservation application)


Post Extras: Print Post   Remind Me!   Notify Moderator  
BlakeWalker84120
Advanced Member


Reged: 03/08/07
Posts: 527
Loc: Salt Lake City, UT, USA
Re: Driver Script in QTP [Re: msnreddy]
      #588236 - 08/28/09 08:47 AM

Wow, nothing like resurrecting a 3 year old post. I don't know if Jim's even still lurking on these boards but you're welcome to have my driver:

Code:
Dim intScriptCount, intScriptLoop, strRunScript

'Creates an environment variable to hold the user name. Initialized here to be empty until it is used somewhere.
Environment("strUserName") = ""

'Creates an environment variable to hold the account name. Initialized here to be empty until it is used somewhere.
Environment("strAccountName") = ""

'Creates an environment variable to hold the deposit amount. Initialized here to be empty until it is used somewhere.
Environment("strDepositAmount") = ""


For intMultiLoop = 1 to 1 'Just used for testing when I feel like making the script run over and over, otherwise it is set for = 1 to 1


'************************************************************************************************************
'***
'*** Now we're ready to actually run some tests
'***
'************************************************************************************************************


'We get the number of scripts in the local DataSheet
intScriptCount = DataTable.GetSheet("Main").GetRowCount

'We loop through each row and check to see if the Run column is blank.
'If it is blank, we skip that row.
'Otherwise, we run the script identified in the ScriptName column
For intScriptLoop = 1 to intScriptCount
DataTable.GetSheet("Main").SetCurrentRow intScriptLoop

strRunScript = DataTable("Run", dtLocalSheet)

If strRunScript <> "" Then
RunAction DataTable("ScriptName", dtLocalSheet), oneIteration
End If
Next

Next 'intMultiLoop 'Just used for testing


'This last line is here to stop test execution. Without it, QTP will finish this action then try to run other actions.
'Since all other actions are called by Main, there is no reason to also run them after Main is finished.
ExitTest



That's all there is to it.

In my DataTable, my first column is called "Run" and my second column is "ScriptName".

In the Run column, I leave the cell blank if I want to skip this particular script, or I put anything I want into it (usually just an 'x') to make it run. In the ScriptName column I have the name of every Reusable Action in my test suite - make sure to spell them exactly like you named them.

So the driver gets the count of the datatable rows, loops through them in order, checks the Run column, then executes whatever script is in the ScriptName column unless the Run column is blank.

Oh, the top part where I create those environment veriables is not really part of the driver. I just left them in so you can see some of the stuff I do in the driver before I actually start calling actions.

Hope that helps.

--------------------
"The last 10% of any software project will take 90% of the budgeted time. The first 90% will take the other 90%"


Post Extras: Print Post   Remind Me!   Notify Moderator  
chillyhouse
Active Member


Reged: 06/20/04
Posts: 960
Loc: Miami,FL
Re: Driver Script in QTP [Re: BlakeWalker84120]
      #588252 - 08/28/09 09:52 AM

The driver script is a good idea if you do not have Quality Center for Test Director.
Since you have QC I think you do not need a driver script "Main Script for execution" Simply you have to create a test set in TestLab were you can add all your scripts to be executed and also define the Execution Flow -if any script depends on other script-
nevertheless by using QC you will have the advantage of scheduling your run.
all these features are built in features in QC.

--------------------
"I realize it's an error, but no one is going to try to do that!"
From "Top 10 Stupid Comments from Developers".


Post Extras: Print Post   Remind Me!   Notify Moderator  
msnreddy
Newbie


Reged: 04/26/09
Posts: 19
Re: Driver Script in QTP [Re: BlakeWalker84120]
      #589160 - 09/03/09 05:29 AM

Hi
I have one doubt in ur script
RunAction DataTable("ScriptName", dtLocalSheet), oneIteration

what we have to give in "scriptname" place u mean we have to give path of the qtp script file right


Post Extras: Print Post   Remind Me!   Notify Moderator  
Pages: 1



Extra information
1 registered and 71 anonymous users are browsing this forum.

Moderator:  IanFraser, Rajkumar_Rajangam, thorwath, TReddy, AJ, Tarun Lalwani, mwsrosso 

Print Topic

Forum Permissions
      You cannot start new topics
      You cannot reply to topics
      HTML is disabled
      UBBCode is enabled

Rating:
Topic views: 17082

Rate this topic

Jump to

Contact Us | Privacy statement SQAForums

Powered by UBB.threads™ 6.5.5