Pages

Tuesday, 18 October 2011

Import a data table into your test at runtime.


' =============================================================
' function: ImportDataTable
' desc : Imports a data table
' params : strFile - full path of the xls file to import
' returns : void
' =============================================================

Function ImportDataTable(strFile)

 

Dim objFS

 

' create a file system object
Set objFS = CreateObject("Scripting.FileSystemObject")

 

' check that the source file exists
If objFS.FileExists(strFile) Then

 

    ' import the data table
    DataTable.Import strFile

 

Else

 

    ' fail if the xls was not found
    Reporter.ReportEvent micFail, "Import Data Table""Unable to Import Data Table From '" & strFile & "', File Does Not Exist"

 

End If

 

' destroy the object
Set objFS = Nothing

 

End Function 'ImportDataTable

0 comments:

Post a Comment