It is now even easier to create data-driven tests with TestComplete 8. Data-driven tests usually consist of the following actions:
- Connects to a data storage (for instance, to an Excel sheet).
- Iterates through the rows of the storage.
- Uses data from each row to simulate user actions over the tested application.
Though previous versions of TestComplete included special features for connecting to data storages and retrieving data from them, you had to implement the iteration yourself. Also, you had to modify parameters of test commands so that they used values of the current data row.
TestComplete 8 includes three new enhancements that make the creation of data-driven tests a lot easier:
- DB Table variable type.
- Data-Driven Loop operation.
- Make Data Loop command.
DB Table Variables
The DB Table variable is a new type of project, project suite or keyword test variables. The DB Table variable provides a connection to an external data source and contains specific methods and properties that provide forward read-only access to data rows. Using these variables, you can easily retrieve data from Excel sheets, database tables or queries and CSV (comma-separated values) files.
Data-Driven Loop Operation
A new Data-Driven Loop operation is used to implement data-driven functionality in your keyword tests. The operation uses a DB Table variable to connect to external data storages and iterate through their rows. For each row, the operation executes child operations (these child operations, for instance, can simulate user actions over the tested application according to the data stored in the current data row).
Make Data Loop Command
You can add the operation to your test the same way you add other operations, or you can add the operation by using the new Make Data Loop command of the keyword test
editor’s context menu. This command makes the creation of data-driven tests as easy as 1-2-3:
Record test commands that will simulate user actions over your tested application.
In the keyword test editor, select the operations that you would like to add to the data-driven test. Then right-click the selection and choose Make Data Loop from the context
This will invoke the Data-Driven Loop wizard.
On the first page of the wizard, you specify a new or existing DB Table variable that will be used to retrieve data from an external data storage (Excel sheet, database table or CSV file).
If you chose to create a new variable, then on the next pages you specify the data storage type and the storage file:
Then you can specify which rows to be retrieved from the data storage. The Data-Driven Loop operation will iterate through these rows:
On the last page of the wizard, you can easily view the recorded (or hard-coded) values of operation parameters with data retrieved from the data storage:
If you want an operation to use the recorded values, leave [Use hard-coded value] for its parameters.
After you click Finish, TestComplete will add the Data-Driven Loop operation to your test, make the selected operation child operation of this Data-Driven Loop operation and, finally, update the parameters of the moved operations with the values specified in the Data-Driven Loop wizard.
As you can see, creation of a data-driven test includes only 3 steps:
Recording the needed test operations.
Choosing the Make Data Loop command.
Specifying the parameter values in the wizard.
These all simplify and speed up the creation of data-driven tests. We hope you enjoy these new improvements and if your haven’t tried them in TestComplete 8 Beta, you can apply for the Beta version.