Monday, 19 October 2015

Data Driven Testing using vb script UFT

Find below the code for DDT

First, we have to create object of "excel.application"
Then we have to use this object for performing various functions.



Set oExcel=createobject("excel.application")
Set oExcelWorkbook=oExcel.Workbooks.Open("D:\DataSheet\Datasheet.xls")
Set OExcelSheet=oExcelWorkbook.Worksheets("DataSheet")
oExcelCount=OExcelSheet.usedrange.rows.count

For i=2 to oExcelCount
  user= OExcelSheet.cells(i,1)
' msgbox user
 password= OExcelSheet.cells(i,2)
' msgbox password
print user
print password
Next

oExcel.Workbooks.Close

No comments:

Post a Comment