Friday 16 September 2011

QTP - AOM - Open Driver Sctipt - Run Tests - Save Results

Leave a Comment


'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 Open Existing Script ) 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) and to Run Automatically
' Author : GAReddy @ OneTestingCenter @ QTP
'******************************************************************
'****************************************************************** 

Dim oQTP 
Dim QTPTest  
Dim QTPResultsOptions 
 
Set oQTP = CreateObject("QuickTest.Application") ' Create the Application object 
oQTP.Launch ' Start QuickTest 
oQTP.Visible = True ' Make the QuickTest application visible 
 
' Set QuickTest run options 
oQTP.Options.Run.ImageCaptureForTestResults = "OnError" 
oQTP.Options.Run.RunMode = "Fast" 
oQTP.Options.Run.ViewResults = False 
 
oQTP.Open "D:\GAReddy\OneTestingCenter\QTP\AprilBatch\KeywordDrivenFramework\TestScripts\DriverScript", True
' Open the test in read-only mode 
 
' set run settings for the test 
Set QTPTest = oQTP.Test 
 
QTPTest.Settings.Run.OnError = "NextStep"
' Instruct QuickTest to perform next step when error occurs 
 
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 
 
MsgBox QTPTest.LastRunResults.Status ' Check the results of the test run 
QTPTest.Close ' Close the test 
 
Set QTPResultsOptions = Nothing ' Release the Run Results Options object 
Set QTPTest = Nothing ' Release the Test object 
Set oQTP = Nothing ' Release the Application object  

'*********************************************************************
'*********************************************************************

0 comments:

Post a Comment

Friday 16 September 2011

QTP - AOM - Open Driver Sctipt - Run Tests - Save Results



'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 Open Existing Script ) 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) and to Run Automatically
' Author : GAReddy @ OneTestingCenter @ QTP
'******************************************************************
'****************************************************************** 

Dim oQTP 
Dim QTPTest  
Dim QTPResultsOptions 
 
Set oQTP = CreateObject("QuickTest.Application") ' Create the Application object 
oQTP.Launch ' Start QuickTest 
oQTP.Visible = True ' Make the QuickTest application visible 
 
' Set QuickTest run options 
oQTP.Options.Run.ImageCaptureForTestResults = "OnError" 
oQTP.Options.Run.RunMode = "Fast" 
oQTP.Options.Run.ViewResults = False 
 
oQTP.Open "D:\GAReddy\OneTestingCenter\QTP\AprilBatch\KeywordDrivenFramework\TestScripts\DriverScript", True
' Open the test in read-only mode 
 
' set run settings for the test 
Set QTPTest = oQTP.Test 
 
QTPTest.Settings.Run.OnError = "NextStep"
' Instruct QuickTest to perform next step when error occurs 
 
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 
 
MsgBox QTPTest.LastRunResults.Status ' Check the results of the test run 
QTPTest.Close ' Close the test 
 
Set QTPResultsOptions = Nothing ' Release the Run Results Options object 
Set QTPTest = Nothing ' Release the Test object 
Set oQTP = Nothing ' Release the Application object  

'*********************************************************************
'*********************************************************************

No comments:

Post a Comment