Thursday, July 1, 2010

How do we associate a library file with in the test


  • ·         The file can contain function, sub procedure, classes etc.... You can also invoke the file using the following command like….
          (Eg) : ExecuteFile "MyFunctions.vbs"


  • ·         To associate a library file with your script File->Test Settings

How can i check if a parameter exists in DataTable

On Error Resume next
Dim Myval
Myval=DataTable("ParamName",dtGlobalSheet)
            if err.number<> 0 then
                        Msgbox “Parameter doesn’t Exist”
            else
                        Msgbox “Parameter Exist”
            end if

How can i save the Data during runtime in the Data Table

  • ·         QTP doesn’t support the run time changes to the actual data sheet.
  • ·         Using Excel or Notepad save the test data while run times
Create the Object:

  • Set ExlApp = CreateObject("Excel.Application")
    Set ExlB = ExlApp.Workbooks.open("C:\vbsample.xls")

Data Table In QTP

Data Table
Global data sheet: Accessible to all the actions
Local data sheet: Accessible to the associated action only



Example:

DataTable("Column Name",dtGlobalSheet) for Global data sheet
DataTable("Column Name",dtLocalSheet) for Local data sheet

·         During the run-time user not able to enter the data in Data Table
·         The run-time data table is accessible only through test result.
·         The run-time data table can also be export  using DataTable.Export or DataTable.ExportSheet