1) UPLOAD MULTIPLE SCRIPTS TO QC PLEASE FIND THE BELOW CODE
Dim qtApp
Dim qtUpdateRunOptions
Dim qtRunResultsOptions
Dim blsSupportsVerCtrl
Set qtApp = CreateObject("QuickTest.Application")
qtApp.Launch
qtApp.Visible = True
'''' Open the file which contains the list of QTP scripts to be uploaded''''
Set objFSO = CreateObject("Scripting.FileSystemObject")
' Make changes in a test on Quality Center with version control
qtApp.TDConnection.Connect "url", _
"Domain", "project", "username", "password", False
' Connect to Quality Center
'For i = 0 to Ubound(arrFileLines) - 1 'if there are multiple scipts are there in the fodler please uncomment this
If qtApp.TDConnection.IsConnected Then ' If connection is successful
qtApp.Open "C:\Dileepsc\network", True' Open the test it is single scipts
qtApp.Test.SaveAs "[QualityCenter] Subject\Archive\network" 'Save it to Quality
qtApp.TDConnection.Disconnect
Else
MsgBox "Cannot connect to Quality Center" ' If connection is not successful, display an
End If
'Next
'qtApp.Quit ' Exit QuickTest
Set qtUpdateRunOptions = Nothing ' Release the Update Run Options object
Set qtRunResultsOptions = Nothing ' Release the Run Results Options object
Set qtApp = Nothing ' Release the Application object
Regards
Dileep Sarkar
2)Descriptive Programming to SAP Windows to check the Status Bar error handling
we can check the error in the status bar in two ways
a) 'Function to handle the error in status bar
Function StatusBarError
'Descriptive Programming for session window
Set objSession=Description.Create()
objsession("guicomponenttype").value="12"
'Descriptive Programming for windows
Set objWindows=Description.Create()
objWindows("guicomponenttype").value="21"
'Descriptive Programming for Status Bar
Set objStatusbar=description.Create()
objStatusbar("guicomponenttype").value="103"
dt=SAPGuiSession(objSession).SAPGuiWindow(objWindows).SAPGuiStatusBar(objStatusbar).GetROProperty("messagetype")
Do
If dt = "E" Then
Reporter.ReportEvent micFail, "Screen name :"& SAPGuiSession(objSession).SAPGuiWindow(objWindows).GetROProperty("text") ,"Error Message : " & SAPGuiSession(objSession).SAPGuiWindow(objWindows).SAPGuiStatusBar(objStatusbar).GetROProperty("text")
ExitTest
End If
If dt="W" Then
SAPGuiSession(objSession).SAPGuiWindow(objWindows).SendKey ENTER
' Reporter.ReportEvent micWarning, "Screen name :"& SAPGuiSession(objSession).SAPGuiWindow(objWindows).GetROProperty("text"),"Warning Message :" & SAPGuiSession(objSession).SAPGuiWindow(objWindows).SAPGuiStatusBar(objStatusbar).GetROProperty("text")
End If
If dt="I" Then
SAPGuiSession(objSession).SAPGuiWindow(objWindows).SendKey ENTER
'Reporter.ReportEvent micWarning, "Screen name :"& SAPGuiSession(objSession).SAPGuiWindow(objwindows).GetROProperty("text"),"Warning Message :" & SAPGuiSession(objSession).SAPGuiWindow(objWindows).SAPGuiStatusBar(objStatusbar).GetROProperty("text")
End If
Loop Until dt = ""
End Function
b)By using CheckProperty we can check the error status in the Status Bar.You can directly add this code into scripts
If SAPGuiSession("Session").SAPGuiWindow("Create Sales Order: Initial").SAPGuiStatusBar("StatusBar").CheckProperty("messagetype","E") then
Reporter.ReportEvent micFail, " Warning message ","Warning message is there in the Create Sales Order"
ExitAction(1)
End If
If SAPGuiSession("Session").SAPGuiWindow("Create Sales Order: Initial").SAPGuiStatusBar("StatusBar").CheckProperty("messagetype","W") Then
Reporter.ReportEvent micWarning," Warning message ","Warning message is there in the Create Sales Order"
End If
If SAPGuiSession("Session").SAPGuiWindow("Create Sales Order: Initial").SAPGuiStatusBar("StatusBar").CheckProperty("messagetype","I") Then
Reporter.ReportEvent micWarning, " Warning message ","Warning message is there in the Create Sales Order"
End If
Important :
For Custom report code you can reach out to dileep8816@gmail.com
No comments:
Post a Comment