Tutorial: Use the Test Combinations Generator
Relevant for: GUI tests and business process tests
This topic provides a tutorial for using the Test Combinations generator.
In this scenario, we'll use the MyFlights sample app that comes installed with UFT One. You must test how the app performs with different sets of data. However, you have up to 5 fields that users can change, and the number of possible combinations is huge. Manually creating these data combinations will take too much time.
Use the Test Combinations Generator to help you create this large set of data, making test coverage all the more manageable.
If you've performed the tutorial, you already have a GUI test with actions for each page in the app. In this scenario, we'll use the Book Flight page, which is the page where a user enters the flight details they want to search for.
Create test parameters and generate values
First create the parameters in your test that you want to generate values for. Then, use the Test Combinations Generator to generate those values.
Do the following:
Add the following parameters to your test in the Data pane, and then save your test.
Click the Test Combinations Generator toolbar button to open the dialog.
Select a parameter name from the Parameter drop-down, or select it in the grid on the right.
For all but the departureDate parameter, do the following:
- Define the Generation type as Capture from UI.
- In the Object Name field, click to switch back to the MyFlight app, and select the list item in the app that corresponds to the selected parameter. Back in the Test Combinations Generator dialog, the values are listed under Captured list of values.
- Click Select All, and then Generate to generate values for the grid on the right.
For the departureDate parameter, define the Generation type as Date instead. Then define a date range for the dates you want to test, as well as a date format and the number of entries you want to add.
Click Generate to generate date values for the grid on the right.
- When you have all of your data ready, click CREATE CONFIGURATIONS at the bottom right of the Test Combinations Generator dialog to display a preview of the possible data combinations.
- Switch the combination algorithm from Pairwise to Linear or Triplewise to display other possible combinations.
- Click Generate at the bottom right to generate your data, and add the values to the spreadsheet in the Data pane.
Your data is ready to use in your MyFlights GUI test.