Send me the Driver Sript

344 views
Skip to first unread message

Tirumala B

unread,
Apr 15, 2012, 9:41:25 AM4/15/12
to mercu...@googlegroups.com
Hi All

Can any one send me the explanation for Driver Script Execution 
And Driver Script of Hybrid Framework.

Thanks
Tirumala

Anish Pillai

unread,
Apr 22, 2012, 12:26:48 PM4/22/12
to mercu...@googlegroups.com
Hi Tirumala,

Driver script is a code (usually VBScript) that acts as a starting point for your test case execution. Consider an example where you have 100 test cases in your suite. For this,you can create a driver script that would load each to these test cases in QTP one by one and ask QTP to run these TCs. You can have a variety of filters set in here. For example, you can write code where your driver script will run all the test cases, only some test cases (which you would specify beforehand), all the failed test cases etc etc.

Also in the driver script you can write code which will change QTP run settings like to run the TC in normal mode or fast mode, where to save the results after execution of TC. Also sending mails with the test run report.


The driver script code is completely dependent on the frameworks. You change the framework, your driver script will have to change. Since the structure of Hybrid framework can be anything, so there is no fixed format for the driver script.

Check the below code, which you can use to run a test case. This example is just to show on how you can use a driver script.

Dim testCasePath, resultPath
testCasePath = "D:\QTP\GMail Inbox1"
resultPath = "D:\QTP\Result"

'Open QTP
Set qtpApp = CreateObject("QuickTest.Application")
   
'If QTP is not open then open QTP application
If qtpApp.launched <> True Then
    qtpApp.Launch
End If
       
'Make the QuickTest application visible
qtpApp.Visible = True
   
'Set QuickTest run options
qtpApp.Options.Run.ImageCaptureForTestResults = "OnError"
qtpApp.Options.Run.RunMode = "Fast"
qtpApp.Options.Run.ViewResults = True

'Open the test in read-only mode
qtpApp.Open testCasePath, True
WScript.Sleep 2000

'set run settings for the test
Set qtpTest = qtpApp.Test

'Instruct QuickTest to perform next step when error occurs
qtpTest.Settings.Run.OnError = "NextStep"

'Create the Run Results Options object
Set qtpResult = CreateObject("QuickTest.RunResultsOptions")

'Set the results location
qtpResult.ResultsLocation = resultPath

'Run the test
WScript.Sleep 3000
qtpTest.Run qtpResult




--
Regards,
Anish Pillai
My QTP Blog

Reply all
Reply to author
Forward
0 new messages