Wednesday, August 26, 2015

Capture and Reuse Run Time data

Adding a Standard Output Value

You can create a standard output value from an object property value. When you run the test, Quick Test retrieves the current value of the property and enters it in the run-time Data Table as an output value.
To create a standard output value while recording:
  • Choose Insert > Output Value > Standard Output Value.
The mouse pointer turns into a pointing hand.
  • Click the object in your application.
If the location you clicked is associated with more than one object, the Select an Object dialog box opens.
  • Select the object for which you want to specify an output value.
  • Click OK.
The Output Value Properties dialog box opens.
  • Specify the settings for the output value.
  • Click OK to close the Output Value Properties dialog box.
  • An output value step is added to your test tree.

  Creating Image Output Values

You can create an image output value from the property value of a Web image. When you run the test, Quick Test retrieves the current value of the property and enters it in the run-time Data Table as an output value.
To create an image output value while recording:
  • Choose Insert > Output Value > Standard Output Value .
The mouse pointer turns into a pointing hand.
  • Click the image.
  • If the location you clicked is associated with more than one object, the Select an Object dialog box opens.
  • Select the Image item you want to specify for an output value.
  • Click OK.
The Image Output Value Properties dialog box opens.
  • Specify the settings for the output value.
  • Click OK to close the Image Output Value Properties dialog box.
  • An output value step is added to your test.

Creating Table Output Values

You can create a table output value from the contents of a table cell. When you run the test, Quick Test retrieves the current value of a table cell and enters it in the run-time Data Table as an output value.

To create a table output value while recording:
  • Choose Insert > Output Value > Standard Output Value. The mouse pointer turns into a pointing hand.
  • Click the table. If the location you clicked is associated with more than one object, the Select an Object dialog box opens.
    Select a Table item and click OK.
  • The Output Value Properties dialog box opens.
  • Specify the settings for the output value.
  • Click OK to close the Output Value Properties dialog box.
  • An output value step is added to your test tree.

Example: Consider the following problem for flight reservation application:
Create a new reservation and verify the reservation details.
Hint: you need order number to verify the reservation details.

Steps to solve the problem:
1. Create two actions à Create New Order and Open Order.
2. Create an output value for the order number field in Create New Order Action.
3. Parameterize Order Number in Open Order Action.


Output and Correlation

About Outputting Values

An output value is a step in which one or more values are captured at a specific point in your test or component and stored for the duration of the run session. The values can later be used as input at a different point in the run session.
You can output the property values of any object. You can also output values from text strings, table cells, databases, and XML documents.
When you create output value steps, you can determine where the values are stored during the run session and how they can be used. During the run session, Quick Test retrieves each value at the specified point and stores it in the specified location. When the value is needed later in the run session, Quick Test retrieves it from this location and uses it as required.
Output values are stored only for the duration of the run session. When the run session is repeated, the output values are reset.
Note: You can insert an output value by using commands on the Insert menu or by clicking the arrow beside the Insert Checkpoint button
     
on the Test toolbar. This displays a menu of options that are relevant to the selected step in the test tree..

                Creating Page Output Values

You can create a page output value from a Web page property value. When you run the test, Quick Test retrieves the current value of the property and stores it in the run-time Data Table as an output value.
For example, the number of links on a Web page may vary based on the selections a user makes on a form on the previous page. You could make an output value to store the number of links on the page during each test run or iteration.

                Creating Text Output Values

You can create a text output value from a text string. When you run the test, Quick Test retrieves the current value of the text string and enters it in the run-time Data Table as an output value.
Quick Test allows you to create text output values by adding one of the following to your test:
o    Text Output Value—enables you to output the text displayed in a screen or Web page, according to specified criteria. It is supported for all environments.
o    Standard Output Value—enables you to output an object’s text property. This is the preferred way of outputting the text displayed in many Windows applications.
o    Text Area Output Value—enables you to output the text string displayed within a defined area of a Windows-application screen, according to specified criteria. It is supported for Standard Windows, Visual Basic, and ActiveX environments.
Note: Text Area output values are only supported by the following operating systems: Windows NT, Windows 2000, and Windows XP.

                Creating Standard Output Values 

You can create a standard output value from an object property value. When you run the test, Quick Test retrieves the current value of the property and enters it in the run-time Data Table as an output value.

                 Creating Image Output Values

You can create an image output value from the property value of a Web image. When you run the test, Quick Test retrieves the current value of the property and enters it in the run-time Data Table as an output value.

                Creating XML Output Values

You can create an XML output value from an element value or attribute of an XML file or Web page/frame. When you run the test, Quick Test retrieves the current value of the element or attribute and enters it in the run-time Data Table as an output value.
When you run your test, you can view summary results of the XML output value in the Test Results window. You can also view detailed results by opening the XML Output Value Results window.

                Creating Table Output Values

You can create a table output value from the contents of a table cell. When you run the test, Quick Test retrieves the current value of a table cell and enters it in the run-time Data Table as an output value.

                Creating Database Output Values


You can create a database output value from the contents of a database cell. When you run the test, Quick Test retrieves the current value of a database cell and enters it in the run-time Data Table as an output value. 

Monday, August 24, 2015

Working with Data Tables


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.

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.

Editing and Saving Data Table

By default, Quick Test 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. 
Usage:
 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.
  1. 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.

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 Quick Test. 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.     Quick Test takes several seconds to capture the database query and restore the Quick Test 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.

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.

Using Data Table Scripting Methods

Quick Test 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—Data Table, Sheet (sheet), and Parameter (column). Each object has several methods and properties that you can use to retrieve or set values.