Define iterations for components, flows, and groups
This section describes how configure a group, component, flow, or test to run a specified number of iterations during a single run. Each iteration can use different values for parameters.
Iterations overview
You can configure the followings when defining iterations:
Configure how many times a single component, test, flow, and group runs |
You can configure how many times a single component, test, flow, and group runs
The number of iterations is set according to the number of data values supplied. For example, a test or flow with ten sets of data runs ten times, and a component with six sets of component parameter values runs six times before proceeding to the next component in the run. |
Specify a single iteration or a range of iterations to run in a business process test or flow. | This enables you to run and check one or more specific iterations without having to run all the defined iterations. Iteration ranges for components, flows, and test configurations that use static data are specified using the Select Iterations dialog box. |
Use the same business process test or flow definition for different scenarios |
Different combinations of iterations can be run for different test runs. Iteration ranges for test configurations that use dynamic data are specified using one of the following:
|
Group iterations |
In some cases, it may be helpful to iterate several business components together as a group. Component groups in the Test Script tab are identified by a group node listed above its member components. The group node contains the group icon and displays the number of iterations for the group. The group node can be expanded and collapsed to show or hide its member components.
|
When BPT Packaged Apps Kit users run tests and flows with iterations in Change Detection mode, only the first iteration of the selected range of iterations runs. For details about change detection, see Run tests in change detection mode.
Example: Iteration usage:
-
You can create iterations for a flow that searches for different loans in a test for a banking application by supplying different loan IDs.
-
You can create iterations for a test that prepares loans with different interest rates to see which rate is most affordable for the customer.
-
You can create iterations for a component that orders books online. Each time the test runs, several book orders are made because the component is iterated in the test. A different number of books are ordered by the same test by specifying different book names for varying numbers of component iterations.
Set data for iterations
Create iterations and define their corresponding values.
Prerequisites and considerations
Take the following guidelines into account when working with iterations:
Match an application’s post-condition with the next iteration’s precondition |
For a business component to run iterations successfully, it is essential that the post-condition (the state of the application after the last step in the component runs) match the precondition (the state of the application before the first step in the component runs). |
Link output parameters to input parameters |
Iterations in a business process test or flow can result in multiple output parameter values. In these cases, each iteration passes its output value as input to the corresponding target component or flow. This is called parameter linkage. For details, see Link parameters. |
Components or flows in a group with input parameters must have the same number of iterations. | When grouping, ALM requests confirmation that the iteration range should be set to that of the first component's iteration range. For example, if the first component in the group is set to run iterations 2 to 3, the entire group will be set to run iterations 2 to 3. |
State of the application at the end of the last item in the group must match the state of the application before the first item in the group. |
|
Moving a group or a member within a group could cause a parameter reference conflict |
For example, a group is moved to a position preceding the component that provides an input component parameter needed by a parameter in the group. If the resulting warning message is ignored, the conflicting link to the source parameter is deleted. The value for the source parameter will be empty. You can then either supply a value for the parameter or reinstate the link in the Group Iterations dialog box. |
Iterate components, flows, and groups
You use the Iteration pages to set the parameter values that a component, group, or flow uses for each iteration.
Tip: Alternatively, when working with dynamic data sets, if you prefer working directly in a spreadsheet, you can use Microsoft Excel. For details, see Associate dynamic data with test configurations.
Set the value of each input parameter for each iteration. For user interface details, see Set Values Dialog Box.
If you want the group, component, or flow to run for a specific range of iterations, click the Select Iterations button and select the relevant iterations in the Select Iterations dialog box. The headings of the iterations that are not in the selected range are dimmed.
Note: 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 at runtime. The parameter name in the Iterations dialog box is displayed in red, indicating an iteration range mismatch.
You use the Test Iterations tab in the Test Lab module to set the parameter values that a flow instance uses for each iteration. For user interface details, see Iteration Pages and Test Iterations tab.
You use the Data tab in the Test Configurations tab in the Test Plan module to set the parameter values that a test configuration uses for each iteration. For user interface details, see Iteration Pages.
Note: Iterations for test configurations that access dynamic data are set according to the number of rows of data in external data resource tables, and are not defined using the Iteration pages.
Import data from an external file:
You can import parameter values for component or flow iterations from a .csv file.
When you import a file, all the records in the file become iterations in the business process test or flow.
Note: The parameter values that you import from a .csv file are the values that were defined when the file was last saved before the import. The values in the .csv file do not change dynamically according to value changes that may be implemented in ALM. Conversely, the parameter values in ALM do not change dynamically when you make changes to the .csv file.
-
Prepare external file for import.
Parameter values are imported and saved in .csv (comma separated value) files. This is a file format in which each line is a record, and each data value field in the record is separated by a comma.
You can create a .csv file manually in a text editor, save a spreadsheet file as a .csv file from a program such as Microsoft Excel, or save a set of already defined parameters in a business process test or flow as a .csv file.
Tip: You can enter a few rows in the Component Iterations or Flow Iterations dialog box and then use the Export option to create an initial .csv file in the proper format. Edit and save the .csv file in a text editor or spreadsheet program to enter actual data.
Before importing a .csv file, ensure that it is set up in the proper format, as shown in the following example.
- The first row, Version 1.0, is reserved as a title row. It can contain any text.
- The second row ("CustomerName","CustomerPhone","CustomerAddress") contains the column headers.
- The subsequent rows contain the parameter values that are used in iterations of the business process test or flow.
-
Start the import.
-
In the Test Plan tree, select the business process test that contains the relevant business component or flow.
Tip: Make sure the business component has at least one input parameter.
-
In the Test Script tab, open its Iterations dialog box.
-
Click Import . Select the .csv file that contains the required data and click Open.
-
In the Map Imported Data dialog box, expand the components to locate the relevant parameters for mapping. After mapping, the values from the .csv file are imported and displayed in the Iterations dialog box.
Tip: If the Iterations dialog box already has values defined for one or more iterations, these values are overwritten by the imported values. If the Iterations dialog box has more iterations currently defined than the number of records in the imported file, the surplus iterations in the dialog box are removed.
-
Export (save) data to an external file
You can save (export) parameter values that you have defined for iterations to a .csv file. You can then apply the same values to other component or flow iterations by importing the saved data.
Tip: Saving parameters is also a useful way to create an initial .csv file that you can edit in a spreadsheet program, and then re-import to the component or flow.
-
In the Test Plan tree, select the business process test that contains the relevant business component or flow, and in the Test Script tab, open its Iterations dialog box.
-
To save iteration values, click Export.
-
In the Save CSV (Comma Delimited) File dialog box, enter a descriptive name in the File Name box and click Save.
The component or flow parameter values are saved in a .csv file. The .csv file is saved in a comma delimited table format.
Each column in the table represents the list of values for a single parameter. The first row of the table is a title row. The second row contains the parameter names (column headers). Each subsequent row in a column represents a value for the displayed parameter during a single iteration of the business process test or flow.
Iterations examples
Component iteration example
Consider the following business process test for a banking application comprising three business components: Login, CreateLoan, and Logout:
As illustrated above:
- The entire business process test is iterated three times.
- Different values for the test parameters BankURL, Username, and Password can be used for each test iteration.
- Within each of the three test iterations, the CreateLoan component is iterated twice. This means that the CreateLoan component iterates a total of six times.
- Different values for the CustomerName, CustomerPhone, CustomerAddress, and the Amount input parameters are used for each iteration of the CreateLoan component. Six different input parameters can be supplied in total.
- The CreateLoan component provides an output value for the LoanID parameter for each iteration (six output values provided in total).
Group iteration example
Consider a business process test that contains four business components; C1, C2, C3, and C4. The test requires that the components be iterated as follows:
- Component C1 - Two iterations
- Component C2 - Three iterations
- Component C3 - Three iterations
- Component C4 - One iteration
Instead of running all the iterations of component C2 followed by all the iterations of component C3, you could group these two components together, enabling the business process test to run in the following order:
- The first iteration of C1
- The second iteration of C1
- The first iteration of C2
- The first iteration of C3
- The second iteration of C2
- The second iteration of C3
- The third iteration of C2
- The third iteration of C3
- C4
This is illustrated as follows: