0% found this document useful (0 votes)
46 views3 pages

Data Table in QTP

Data tables in QTP allow you to parameterize tests by storing test data in columns and rows like an Excel sheet. There are global and local data sheets. A step-by-step example demonstrates inserting output values into the data table during a test recording on Google.com. This stores checkpoint values in the data table that can be viewed during and after the test run. Values can be exported to an external file and imported. Data table values can also be used as variables during test runs using the datatable.value command.

Uploaded by

Sriram Srirangam
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
46 views3 pages

Data Table in QTP

Data tables in QTP allow you to parameterize tests by storing test data in columns and rows like an Excel sheet. There are global and local data sheets. A step-by-step example demonstrates inserting output values into the data table during a test recording on Google.com. This stores checkpoint values in the data table that can be viewed during and after the test run. Values can be exported to an external file and imported. Data table values can also be used as variables during test runs using the datatable.value command.

Uploaded by

Sriram Srirangam
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Data table in QTP

What is Data table in QTP?

Data table is simple excel kind of sheet with columns and rows which display data applicable to your
test. Data table will help you in parameterize your test.
To view data table Go to view->Data Table.

There are basically two kinds of data sheet one is Global sheet and other is local sheet (current action
sheet)

Practical example of Data table in QTP

I am going to give you step by step procedure from scratch to end for how to use data table in your
application, so you will be more clearer about data table in QTP.
Please go through following procedure.

1. Press “Record” button.


2. Go to start->run write http://google.com and click OK.
3. close the internet explorer window, you will have code like following.

------------------------------------
SystemUtil.Run "http://google.com","","",""

Browser("Google").Page("Google").sync

Browser("Google").Close
------------------------------------

4. Now put cursor on second sentence and do right click on that sentence.

5. Select “Insert output value”, you will have window like following select all three properties and click
ok. By default all the values will go to global sheet. You can modify this setting by pressing “modify”
button and selecting local sheet.(Note: You can also redirect these values to environment table and you
can access it. know more about environment variable in qtp and how to load and export environment
variable in qtp ) Refer following figure for more clarity.
6. So you will have code like following.

------------------------------------
SystemUtil.Run "http://google.com","","",""

Browser("Google").Page("Google").Output CheckPoint("Google")

Browser("Google").Page("Google").sync

Browser("Google").Close
------------------------------------
7. So when you run the above script you can view three parameter and its value in global data sheet. If
you are not able to view, please go to view->Data Table.

8. You can view values during test run, you can’t view that value after test is over.

9. You can export these values in external file with help of datatable.export command.
Put following sentence at last in your script

Datatable.export(“c:\qtp.xls”)
10. You can also use datatable.import command to import external excel file to your test in the start of
test.

How to use values in data table during run time in QTP?


You can do so using datatable.value command. For e.g.

intLink = datatable.value ("Google_number_of_links_out")

Values from “Google_number_of_links_out” parameter will be stored in intLink variable.

In addition to this you can also use datatable.getrowcount command to get row count in datatable. You
can also use addsheet, deleteSheet, getSheet, getSheetCount, setCurrentRow, setNextRow, setPrevRow
data table methods etc. You can use QTP help for more understanding on this kind of data table
commands.

You might also like