QTP,check point Enhancement & Functions

Checkpoint Enhancements
. Ability to alter properties of all checkpoints during run-time. E.g. Expected bitmap of a bitmap checkpoint, expected values of a Table/DB checkpoint etc
. Ability to create checkpoints at run-time
. Ability to load checkpoints from a external file at run-time
. Ability to enumerate all checkpoints present in current script

Set oDosW = Description.Create
oDosW("regexpwndtitle").Value = "C:\\Windows\\System32\\cmd\.exe"
oDosW("regexpwndtitle").RegularExpression = False  
Window(oDosW).Activate
'Launch the window with title MyPuttyTesting
SystemUtil.Run "cmd", "/K title MyPuttyTesting" 
'Launch the window with title MyFTPTesting
SystemUtil.Run "cmd", "/K title MyFTPTesting" 
'Uniquely Recognize console application simultaneously without any ordinal identifier
Window("title:=MyPuttyTesting").Activate
Window("title:=MyFTPTesting").Activate
To get the current script name we can use the below line of code

Msgbox Environment("TestName")
'Description: Function to import the all the sheets present in the file
'Params:
'@FileName - File to import
Function ImportAllSheets(ByVal FileName)
      Dim oExcel, oBook 
      'Launch excel
      Set oExcel = GetObject("", "Excel.Application"
      'Open the file in read only mode
      Set oBook = oExcel.WorkBooks.Open(FileName,,True
      'Enumerate through all the sheets present in the file
      For each oSheet in oBook.WorkSheets  
            'Check if a DataTable with current name already exists
            If Not IfDataSheetExist(oSheet.Name) Then
                  'DataTable cannot be imported if the sheet does not exist
                  DataTable.AddSheet oSheet.Name
            End If 
            'Import the sheet
            DataTable.ImportSheet FileName, oSheet.Name,oSheet.Name
      Next  
      Set oBook = Nothing  
      'Quit Excel
      oExcel.Quit
      Set oExcel = Nothing
End Function
'Function to check if a DataTable sheet exists or not
Function IfDataSheetExist(ByVal SheetName)
      IfDataSheetExist = True
      On error resume next
      Dim oTest
      Set oTest = DataTable.GetSheet(SheetName)
      If err.number Then IfDataSheetExist = False
      On error goto 0
End Function
Smart identification is a algorithm which QTP uses when it is not able to identify a object. The algorithm tries to figure out if there is a unique control on the page which matches the some of the properties of the failed object.
This happens because when QTP SI starts looking for a Logout button there is none, but there is only one button on the page. So QTP SI assumes that it is the Logout button which we were looking for.
Setting("DisableReplayUsingAlgorithm") = 1
'or using AOM code
CreateObject("QuickTest.Application").Test.Settings.Run.DisableSmartIdentification = True

Post a Comment

أحدث أقدم