'Automation Object Model
'************************************************************************
'************************************************************************
' GAReddy @ OneTestingCenter @ QTP - AOM (Automation Object Model)
' What ==> This is a QTP - AOM Script to Open QTP , To Open Driver Script, To Add the functional LIBs to QTP and to Run the Test
' and store the results on to specified results directory (using the Run options)
' How ==> Need QuickTest.Application Automation Object to do so
' Why ==> To Open a Driver Script (which could call other tests)
' To Add the Functional Library files to QTP
' To Run the tests
' To Save the test results
' Author : GAReddy @ OneTestingCenter @ QTP
'**********************************************************************
'*******************************************************************
Dim oQTP
Dim QTPLibraries
' Open QuickTest
Set oQTP = CreateObject("QuickTest.Application") ' Create the Application object
oQTP.Launch ' Launch QuickTest
oQTP.Visible = True ' Set QuickTest to be visible
' Open a test and get its libraries collection
oQTP.Open "D:\GAReddy\OneTestingCenter\QTP\AprilBatch\KeywordDrivenFramework\TestScripts\DriverScript", False, False ' Open a test
Set QTPLibraries = oQTP.Test.Settings.Resources.Libraries ' Get the libraries collection object
' To check if the LIBs are added to QTP..If not ...add them
'If QTPLibraries.Find("D:\GAReddy\OneTestingCenter\QTP\AprilBatch\KeywordDrivenFramework\LIBs\TO_WebEdit.vbs") = -1 Then
' If the library cannot be found in the collection
' QTPLibraries.Add "D:\GAReddy\OneTestingCenter\QTP\AprilBatch\KeywordDrivenFramework\LIBs\TO_WebEdit.vbs", 1
' Add the library to the collection
'End If
' To add functional LIBs to QTP
QTPLibraries.Add "D:\GAReddy\OneTestingCenter\QTP\AprilBatch\KeywordDrivenFramework\LIBs\TO_WebEdit.vbs", 1
QTPLibraries.Add "D:\GAReddy\OneTestingCenter\QTP\AprilBatch\KeywordDrivenFramework\LIBs\TO_WebButtonvbs", 1
QTPLibraries.Add "D:\GAReddy\OneTestingCenter\QTP\AprilBatch\KeywordDrivenFramework\LIBs\TO_Link.vbs", 1
QTPLibraries.Add "D:\GAReddy\OneTestingCenter\QTP\AprilBatch\KeywordDrivenFramework\LIBs\Image.vbs", 1
QTPLibraries.Add "D:\GAReddy\OneTestingCenter\QTP\AprilBatch\KeywordDrivenFramework\LIBs\Generic.vbs", 1
QTPLibraries.Add "D:\GAReddy\OneTestingCenter\QTP\AprilBatch\KeywordDrivenFramework\LIBs\Driver.vbs", 1
Set QTPResultsOptions = CreateObject("QuickTest.RunResultsOptions") ' Create the Run Results Options object
QTPResultsOptions.ResultsLocation = "D:\GAReddy\OneTestingCenter\QTP\AprilBatch\KeywordDrivenFramework\TestResults\Res1" ' Set the results location
QTPTest.Run QTPResultsOptions ' Run the test
'Save the test and close QuickTest
oQTP.Test.Save ' Save the test
Set QTPLibraries = Nothing ' Release the test's libraries collection
oQTP.Quit ' Quit QuickTest
Set oQTP = Nothing ' Release the Application object
'************************************************************************
'************************************************************************
0 comments:
Post a Comment