Test Combinations Generator also called TCG is a unique and versatile feature that HPE introduced along with UFT 14.0. As the name suggests, it provides you with the capability to generate multiple test data combinations or synthetic data to parameterize test to test the application with different sets of data.
When should we go for Test Combinations Generator in UFT?
Test Combinations Generator is very helpful in the scenarios where there are multiple fields in the test application and you have to test the application with each possible unique combination.
Let’s try to understand it with UFT Sample Flight Application.
In this Booking Flight window, there are four different parameters, representing the fields a user can select.
For each of the fields, there are different numbers of possible values:
For the Source and Destination fields, there are 10 possible values.
For the Class field, there are 3 possible values.
For the Tickets field, there are 99 possible values.
If you were to manually test every possible combination, you would have to create 10 x 10 x 3 x 99 = 29700 that is a humungous combination.
In such scenarios, you must use the Test Combinations Generator to generate all possible combinations automatically.
How to Generate Test Data Automatically using Test Combinations Generator
Before using Test Combinations Generator, ensure that you have created parameter names in the Datable else UFT will not able to generate test data.
Now follow the below steps to generate Test data automatically
Step 1: Go to Tools>Test Combination Generator
Step 2: A popup window might be displayed to suggest you save your test to enable TCG. Click Yes button
Step 3: Test Combination Generator GUI will be displayed. All parameter names defined in the UFT DataTable Global sheet will be available in the Parameter drop-down field as shown in the following snapshot.
Step 4: Select the required Parameter Name for which you want data to be automatically generated.
Step 5: You can manually enter the parameter values in the values in the Parameter Values grid as shown in the above snapshot or you can select one of the options given by UFT as shown in the below snapshot. You can select any of the options as per your need. For the drop-down field, UFT also gives an option to pull the values from the application.
For list-box or drop-down fields, it’s better to pull data from the UI of the application to avoid any runtime error. If you select the Pull from UI option from Generation type list box, TCG will exclusively give you the option to select the required object from where it should pull the data.
I am going to use the same option to select the value for Source field as it is a drop-down object.UFT has pulled all the values for the Source field (actual object’s name in the application is fromCity)
Step 6: After selecting the valid Generation type for the required parameter click on the Generate button. The values will be generated and the same will be added to the Parameters Values Grid
Repeat the above steps to automatically generate test values. I have done the same for all four parameters.
Step 7: Now we have all the required Parameter Values with us. TCG will be using these values to generate all possible test data combinations with the values available in the grid. Click on the View Combination label.
Step 8: UFT will display possible combinations based on the possible values supplied for test parameters. In this case, UFT has generated 16 combinations.
To generate automatically generate possible combinations UFT uses the Pairwise algorithm which the default one. There are three algorithms available in TCG as shown in the below image. All three will display a different set of combinations.
If you want to generate more combinations with the same values supplied for test parameters, change the algorithm. Now I am selecting the Triplewise algorithm and let see how many combinations can be generated.
UFT has generated 64 combinations. If you still want more combinations, switch to the Linear algorithm.
Step 9: Click on the Generate button.UFT pauses for a bit, generates the combinations, and in the Global Data Sheet. This test configuration can now be used in any test run.