Monday, March 17, 2014

VBScript Code Snippets for storing the QTP Test Results at our desired central location [FrmWrk-Folder Structure]

launch QTP in such way that it starts by saving results in the desired lcoation…here QTPResultspath is the location that has been created in QTPResults folder and then QTP is invoked and initiated to save results in the predetermined location….
qtResultsOpt.ResultsLocation = QTPResultspath
App.Test.Run qtResultsOpt
‘App.Test.Run
‘___________________CODE________________
MasterFolder = “C:TestAutomation”
Dim App, qtResultsOpt, fso, f
Set App = CreateObject(“QuickTest.Application”)
If App.Launched = False Then
App.Launch
End If
App.Visible = True
App.Options.Run.ImageCaptureForTestResults = “Always”
App.Options.Run.RunMode = “Fast”
App.Options.Run.ViewResults = True
App.Open MasterFolder&”TestsEFiles”,False,False
App.Test.Settings.Resources.Libraries.RemoveAll
App.Test.Settings.Resources.Libraries.Add MasterFolder&”Business FunctionsTestScripts.vbs”
‘__________________ START of creating a result folder _________________
Temp = Now
Temp1 = Replace (Temp, “/”,”-”)
Temp2 = Replace(Temp1,” AM”,”")
Temp3 = Replace(Temp2,” PM”,”")
Temp4 = Replace(Temp3,”:”,”")
FolderName = Replace(Temp4,” “,”_”)
‘QTPResultspath = “C:TestAutomationQTPResults”&FolderName
QTPResultspath = MasterFolder&”QTPResults”&FolderName
Set fso = CreateObject(“Scripting.FileSystemObject”)
If Not fso.FolderExists(QTPResultspath) Then
Set f = fso.CreateFolder(QTPResultspath)
End If
Set f = nothing
Set fso = nothing
‘__________________ END of creating a result folder _________________
Set qtResultsOpt = CreateObject(“QuickTest.RunResultsOptions”)
qtResultsOpt.ResultsLocation = QTPResultspath
App.Test.Run qtResultsOpt
‘App.Test.Run
Set App = nothing
Set qtResultsOpt = Nothing

No comments:

Post a Comment