Knowledge Share

Knowledge is NOT Power IMPLEMENTATION of knowledge is Power!!!
HomePortalGalleryCalendarFAQRegisterUsergroupsLog in


 QTP Notes

Go down 

Posts : 142
Points : 410
Reputation : 0
Join date : 2007-12-29
Location : Chennai

QTP Notes Empty
PostSubject: QTP Notes   QTP Notes Icon_minitimeMon Dec 01, 2008 10:08 am

Working with Data Tables
8.1 Introduction
Purpose: Insert data table parameters into the test to run it several times on different sets of data.
Iteration: Run the test on one set of data
Design-Time Data Table: This is the sheet used to store the data for the test, which is displayed at the bottom of the screen while creating and editing the test. It has the same characteristics of Microsoft excel spreadsheet that means can insert formulas within the cells.
Run-Time Data Table: This is the sheet created by quick test to hold live version of data table when you run your test. It is displayed in the Test Results window.
8.2 Working with Global and Action Sheets
There are two types of sheets within the Data Table—Global and Action. You can access the different sheets by clicking the appropriate tabs below the Data Table.
· Global Sheet data is available to all actions in your test, which is mainly used to pass parameters from one action to another.
· Action Sheet data available to only one action in your test.
For example, suppose you are creating a test on the sample Mercury Tours Web site. You might create one action for logging in, another for booking flights, and a third for logging out. You may want to create a test in which the user logs onto the site once, and then books flights for five passengers. The data about the passengers is relevant only to the second action, so it should be stored in the action tab corresponding to that action.
8.3 Editing and Saving Data Table
By default, QuickTest automatically saves the test’s Data Table as an .xls file in the test folder. You can save the Data Table in another location and instruct the test to use this Data Table when running a test.
Attach External Data Table: Specify a name and location for the data table in the resources tab of the test setting dialog box.
1. Run the same test with different sets of input values
For example, you can test the localization capabilities of your application by running your test with a different Data Table file for each language you want to test.
2. The same input information for different tests
For example, you can test a Web version and a standard Windows version of the same application using different tests, but the same Data Table.
Note: The column names in the external Data Table match the parameter names in the test and that the sheets in the external Data Table match the actions in the test.
Edit information in the table by typing directly into the table.
Import data into Data Table from Microsoft Excel 95, Excel 97, Excel 2000, tabbed text files (.txt), or ASCII format by using File àImport from File Option.
Note: Microsoft Excel 2002 is not supported.
8.4 Importing Data from a Database
You can import data from a database by selecting a query from Microsoft Query or by manually specifying an SQL statement.
To import data from a database:
1. Right-click on the Data Table sheet to which you want to import the data and select Sheet > Import > from Database. The Database Query Wizard opens.
2. Select your database selection preferences and click Next. You can choose from the following options:
o Create query using Microsoft Query—Opens Microsoft Query, enabling you to create a new query. Once you finish defining your query, you exit back to QuickTest. This option is only available if you have Microsoft Query installed on your computer.
o Specify SQL statement manually—Opens the Specify SQL statement screen in the wizard, which enables you to specify the connection string and an SQL statement.
o Maximum number of rows—Select this check box and enter the maximum number of database rows to import. You can specify a maximum of 32,000 rows.
o Show me how to use Microsoft Query—displays an instruction screen before opening Microsoft Query when you click next. (Enabled only when Create query using Microsoft Query is selected).
3. If you chose Create query using Microsoft Query in the previous step, Microsoft Query opens. Choose a data source and define a query.
Specify the connection string and the SQL statement and click Finish.
o Connection string—Enter the connection string or click Create to open the ODBC Select Data Source dialog box. You can select a .dsn file in the ODBC Select Data Source dialog box or create a new .dsn file to have it insert the connection string in the box for you.
o SQL statement—Enter the SQL statement.
4. QuickTest takes several seconds to capture the database query and restore the QuickTest window. The resulting data from the database query is displayed in the Data Table.
Note: Contrary to importing an Excel file (File > Import From File), existing data in the Data Table is not replaced when you import data from a database. If the database you import contains a column with the same name as an existing column, the database column is added as a new column with the column name followed by a sequential number. For example, if your Data Table already contains a column called departures, a database column by the same name would be inserted into the Data Table as departures1.
8.5 Using Formulas in the Data Table
This enables to create contextually relevant data during the test run.
Also formulas can be used as part of a checkpoint to check that objects created on-the-fly (dynamically generated) or other variable objects in the Web page or application have the values expected for a given context.
Note: When ever you compare the values, must be of the same type, i.e. integers, strings, etc.
To do this, you can use the TEXT and VALUE functions to convert values from one type to another as follows:
· TEXT(value) returns the textual equivalent of a numeric value, so that, for example, TEXT(8.2)="8.2".
· VALUE(string) returns the numeric value of a string, so that, for example, VALUE("8.2")=8.2.
8.6 Using Data Table Scripting Methods
QuickTest provides several Data Table methods that enable you to retrieve information about the run-time Data Table and to set the value of cells in the run-time Data Table.
From a programming perspective, the Data Table is made up of three types of objects—DataTable, Sheet (sheet), and Parameter (column). Each object has several methods and properties that you can use to retrieve or set values.
Back to top Go down
QTP Notes
Back to top 
Page 1 of 1
 Similar topics
» Are tannins your trigger? I'd like to compare notes.

Permissions in this forum:You cannot reply to topics in this forum
Knowledge Share :: Testing :: Automation-
Jump to: