How to Associate Dynamic Data
This task describes how to work with test configurations in ALM that access dynamic data.
Defining dynamic data enables you to specify sets of parameter values for the test from an external Microsoft Excel file.
Tip: The same Microsoft Excel file can be used as a data resource for different tests.
Note:
This task is part of a higher-level task. For details, see How to Work with Test Configurations.
-
To work with dynamic data for UFT automated tests, make sure that the Unified Functional Testing Add-in for Business Process Testing is installed on the client computer. The Unified Functional Testing Add-in for Business Process Testing available from the Application Lifecycle Management Add-ins page (Help > Add-ins).
-
Create a data table in Microsoft Excel
This data table contains rows of values which become parameter values for each iteration of your test configuration.
-
Create a spreadsheet:
-
In Microsoft Excel.
-
If working with business process tests, in Unified Functional Testing, you can export configuration values to a Microsoft Excel file, and use this file for your data table. See the information about exporting test iteration values into an Excel document in the Unified Functional Testing User Guide.
-
-
Put test-level parameters in the first sheet. The entire test runs once for each row listed in the first sheet.
-
Business Process Testing users can use subsequent sheets in the Excel file to override the business component iterations defined in business process tests and flows, according to the following guidelines:
-
The next sheets (meaning, all sheets but the first) represent components and their parameters.
Note: If a component does not contain parameters, the Excel does not contain a sheet for that component.
-
In each sheet, the column headings (first row) containing the parameter names must be in one of the following formats:
-
<COMPONENT NAME>.<COMPONENT PARAMETER NAME>
This format is the general, default format.
-
<COMPONENT INSTANCE NAME>.<COMPONENT PARAMETER NAME>
This format is useful for keeping sheet names short.
-
<COMPONENT PARAMETER NAME>
This format is useful if the name of the sheet is the same as the name of the component, and you need to keep the sheet names short.
Notes
-
If the same component has been added to the same test multiple times, the numerical instance of the component in the test is listed between the component name and the parameter name. The component instances are listed according to their order in the test script, not necessarily in the order of the original numerical instance of the component when inserted.
-
The sheet name cannot be more than 32 characters long and cannot contain special characters. (This is a Microsoft Excel limitation.)
Tip: When specifying column headings, it is helpful to use one of the last two formats listed above for parameter names in order to avoid this limitation.
-
-
Specify values for each parameter under the parameter names, each on a different row. Each row represents an iteration. Add iterations as necessary.
Example:
The first sheet, that corresponds to the OrderingBooks business process test. The test will run once, because it is designed to run only for one store, BooksOnline.
The second sheet corresponds to the Login business component. This business component will iterate only once, because only one user is listed as logging in.
The third sheet corresponds to the OrderBooks business component. This business component currently iterates only once, because only book is listed.
If we want to iterate the component multiple times, we could modify the third sheet (that corresponds to the OrderBooks business component) so that it more rows are added. This business component will iterate for every book listed—in this case, six times.
-
-
Save the file.
- Caution:
-
When editing the spreadsheet in Excel, if no values / iterations are specified for a particular parameter defined in the component, test, or flow, an exception will occur at run-time.
-
If a component, group, or flow has input parameters that reference the output parameters of a different business component or flow, differences between the number of iterations can result in an error. The parameter name in the Iterations dialog box is displayed in red, indicating an iteration range mismatch.
-
-
-
Create ALM test resources by uploading the Excel file
In ALM, upload the Microsoft Excel data table as a test resource. For task details, see How to Use Test Resources.
-
Select the Test Resources module.
-
Either create or select a test resource folder.
-
Click New Resource to create a new test resource. The New Resource dialog box opens.
-
Enter Data Table as the resource type and click OK.
-
Click the Resource Viewer tab.
-
Click the Upload File button.
-
Navigate and select the Microsoft Excel file you created and click Open.
-
Click OK when prompted that the upload completed successfully. The Resource Viewer lists the default Microsoft Excel sheets. The data is now available in ALM.
You can double-click the spreadsheet to view the data you created.
Note: The data in the Microsoft Excel file starts with row number 2. It is assumed that the first row in the Microsoft Excel file contains the names for the data columns, which are mapped to parameter names in ALM.
-
-
Associate the data table test resource with the test and/or configuration
Do one of the following:
Associate the data table with a test:You can associate the data table with a test. All test configurations for the test will run using the data in this table (unless overridden in Test Configurations > Data).
To associate the data table with an entire test:
-
In the Test Plan module Parameters tab for a test, click the down arrow next to the Data Resource field in the toolbar.
-
Navigate to, and select, the data resource and click OK. The Microsoft Excel file is now the default external data file for the test.
Associate the data table with configurations:You can associate the data table with a test configuration. Each test configurations in the test run using the data table specified for the individual configuration, overriding the data table specified in the Test Plan module Parameters tab.
To associate the data table, see Associate an alternate data table with the test configuration—optional.
-
-
Map test parameters to resource parameters
The test parameter names in the Excel data table do not have to match the parameter names defined in the test. They can be mapped.
-
In the Parameters tab for the test, click Map Parameters . The Map Parameters dialog box is displayed. For user interface details on the Map Parameters dialog box, see Map Parameters Dialog Box.
-
Do one of the following:
-
For each test parameter, click in the cell for its corresponding resource parameter. Type or select the corresponding resource parameter and click OK.
-
Business Process Testing: Click Automap . ALM maps each test parameter to the corresponding resource parameter based on the column headings in the first row of the data table.
Tip: The mapping of resource parameters to test parameters facilitates reuse of the same resource file by different tests.
-
-
Filter the data by selecting iteration ranges—optional
To filter the data so that the test runs only on a subset of the parameter values, either by row or by value, click Data Resource Settings. The Data Resource Settings dialog box opens. For user interface details on the Data Resource Settings dialog box, see Data Resource Settings Dialog Box.
-
Associate an alternate data table with the test configuration—optional
You can create configurations that process alternate dynamic data resource files instead of the dynamic data resource file associated with the business process test.
Tip: The same file can be used as a data resource for different tests.
- In the Data tab, select Dynamic.
- Select Override test data resource and specify an alternate data resource.
- Click Data Resource Settings to map the test parameter names to the resource parameter names in the Data Resource Settings dialog box. For user interface details on the Data Resource Settings dialog box, see Data Resource Settings Dialog Box.
Tip: You can have one business process test run the same component a different numbers of times. Do this by defining different numbers of iterations in each sheet of the data table for that component.