Quality Testing

Quality is delighting customers

Introduction of External Data Sheet
In QTP, we have an option for Data Table which comes very useful when the user wants to parameterize his/her test. The parameters set by user appear by default in the Columns of the sheet. Not only is this helpful for parameterized operation of your test also when you want to work with the Output function of QTP you can use this table since the corresponding outputs can be viewed over here.
This option can be as per the user requirement and in this the user can make an Excel sheet with the required parameters in it. Also one can import and export the contents to his test while running it.
Import External Data File
The user shall perform the following operations:
In this once the user has created the Excel sheet and has recorded the test, (s)he shall right click on any of the cells in the Data Table and select the File>Import, user will get a window where (s)he will have to select the exact location of the excel sheet.

On Clicking the option, user will get a window pop-up box asking whether you will want to replace the contents of the current data table with the ones in the excel sheet. Click OK and proceed.
Select the exact location of the excel file on your PC which you want to import.
The contents of the excel sheet shall appear in the Data Table of QTP once you selected the required excel sheet.
Remember to use the same naming convention through-out the script, you have used in the file. Each of the column name in your excel file will become one parameter.
Secondly the actions for which the user shall be setting parameters need to be given the same name as in the imported excel file. As shown below, while recording the file the user has selected a particular value for the Action which he wants to parameterize which will appear in the constant option.

The user has to choose the Parameter option and then type the exact name as in the Data table for e.g.: “No_Pass”, here we are parameterizing the no of passengers for whom the tickets have to be booked and will re-run the script for that much time.

Points to note regarding which location to select OR whether to make a sheet global or local.
1. Globally implies the user has the Global sheet of the data table filled up with certain data. Now when he runs the test it will operate for the amount of rows that are filled in this sheet.
2. If you want a condition that for single row run of the global sheet there should be run of another sheet namely the “Action 1” of the data table we call the operation as Local.
3. In this it is important that the user selects the Parameter option as local and not global as in the above condition and the required contents will come in Action 1 sheet.
4. Now initially if while you are importing if there were two sheets created by you then by default the contents of the second sheet will be Action 1. It is only that the corresponding Action be parameterized properly.

Now, In the keyword view, Right click on the Action 1 and select Action Call Properties and then in the Run Tab select the no of rows for which you want to run the Local sheet.
When the user runs this script, for every single row of the Global sheet, the Action 1 sheet will run for all of its respective columns.
A similar method can be used to import a single sheet or a database file.
Also from within the script you can use Datatable.Import("path of file")
Export External Data File
Like importing data sheet we can also export the entire data table into an external excel file. This is basically useful if one wants to use the required parameters in some different test run within QTP.
Similar to the exporting of complete file we can also export an single sheet from the data table
Also from within the script you can use Datatable.Export("path of file")
Next post we shall see the different operations which can be performed on data sheet.
Related: QTP and Excel Part1

Karan Raka
+91 9890085662

Views: 252

Reply to This

Replies to This Discussion

This is good article but I am new in Descriptive programing in QTP . I want to learn from first step . How to start & how I can get all syntex and examples of this programming . any reference site for Descriptive programing in QTP ?
Please reply me as s


TTWT Magazine





© 2021   Created by Quality Testing.   Powered by

Badges  |  Report an Issue  |  Terms of Service