Sunday, September 23, 2007

How will you perform data driven testing inQTP

In automation, data driven testing is very inportant and if you are using QTP then you must be master of Keyword driven testing as well as data driven testing.

In QTP, data driven testing can be done by two ways
1. Using Global Sheet
2. Importing Excel Sheet in your script and fetching each row in a loop

The most professional and acceptable method is by importing excel sheet.

The following example uses the ImportSheet method to import the first sheet of the name.xls table to the name sheet in the test's run-time Data Table(I hope every body aware of run time data table)

DataTable.ImportSheet "C:\name.xls" ,1 ,"name"

To simply import excel sheet to run time data table then use.

Datatable.Import("c:\name.xls")

In order to fetch the current row you can make use of following method.

Datatable.GetCurrentRow

You can create one varible and store the value of current row and can use it, further in your script. This is more convienent in practice.

No comments: