Parametrization using file

How do we input values from file

Questions by monika agrawal   answers by monika agrawal

Showing Answers 1 - 6 of 6 Answers

akothuru

  • Jul 10th, 2008
 

Generally, QTP exports uses Excel file for data paramaterization.
1)Prepare test data in Excel sheet and import into QTP data table. Using DataTable methods, user can easily parameterize data and access them through out the script.
DaTaTable Methods:
Import
ImportSheet
Export
ExportSheet
GetSheet
SetCurrentRow
SetNextRow etc...

E.g:
DataTable.Import "Excel file path"
testData = DataTable(columnName, Sheetname)
(or)
testData = DataTable(columnName, dtGlobalSheet)



2)Prepare test data in Excel sheet. Instead of importing Excel file/sheet into Test script, create an Excel object in the script using CreateObject method. Using Excel object methods user can able access data from excel sheet.

E.g:
Set ExcelObj = CreateObject("Excel.Application")
ExcelObj.WorkBooks.Open "Excel file path", false, false
Set currentWorkSheet = ExcelObj.ActiveWorkBook.WorkSheets(1) 'first sheet
testData = currentWorkSheet.Cells(rownumber,columnnumber).Value
ExcelObj.Application.Quit

  Was this answer useful?  Yes

akothuru

  • Jul 10th, 2008
 

Generally, QTP exports uses Excel file for data paramaterization.
1)Prepare test data in Excel sheet and import into QTP data table. Using DataTable methods, user can easily parameterize data and access them through out the script.
DaTaTable Methods: Import, ImportSheet, Export, ExportSheet, GetSheet, SetCurrentRow, SetNextRow etc...

E.g:
DataTable.Import "Excel file path"
testData = DataTable(columnName, Sheetname)
(or)
testData = DataTable(columnName, dtGlobalSheet)


2)Prepare test data in Excel sheet. Instead of importing Excel file/sheet into Test script, create an Excel object in the script using CreateObject method. Using Excel object methods user can able access data from excel sheet.

E.g:
Set ExcelObj = CreateObject("Excel.Application")
ExcelObj.WorkBooks.Open "Excel file path", false, false
Set currentWorkSheet = ExcelObj.ActiveWorkBook.WorkSheets(1) 'first sheet
testData = currentWorkSheet.Cells(rownumber,columnnumber).Value
ExcelObj.Application.Quit

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions