TestComplete samples (both built-in and additional) are located in the <Users>\Public\Public Documents\TestComplete 14 Samples folder.
Some file managers display the Public Documents folder as Documents.
This topic provides you with general information on Data-Driven testing:
Automated tests play back a recorded (or programmed) sequence of user actions that cover a certain area of the tested application. To get larger coverage, you can perform tests with different input data. Suppose, for example, you recorded actions that input data into an application’s form. The recorded test contains only those values that you entered during the recording and, most likely, these values do not cause errors in the application, but other data may cause them. So, you have to run your test with different set of input data to ensure that the application works as expected for various input values. This testing approach is called data-driven testing.
Of course, you can record many tests with various input data, but the best solution is to separate data from test commands. Data-driven tests will read data from data storages, for example, from a file or database, rather than use hard-coded values. Such a separation makes tests logically simpler. A test containing several sets of hard-coded values can be rather difficult to modify and maintain. For instance, if you need more input data, you will have to modify the test commands.
For data-driven tests in TestComplete, you can use the following types of data storages:
|Note:||Normally, the storages contain both input data and verifying values. This approach let you easily specify verification data for each portion of test data.|
To prepare and access your test data, see Preparing Data for Data-Driven Testing.
To organize your test data files, see Organizing Data Storages.
Typically, a data-driven test performs the following operations in a loop:
Retrieves the portion of test data from a storage.
Enters the data in an application form and simulates other actions.
Continues testing with the next set of input data.
TestComplete includes special scripting functions and objects that simplify performing these steps. These objects, for instance, let you easily extract data from CSV (comma-separated values) files, database tables and Excel worksheets. For more information, see the following topics:
TestComplete also includes a sample project that illustrates data-driven testing:
<TestComplete Samples>\Common\Data-Driven Testing\TestBook.xlsx
TestComplete project suites:
<TestComplete Samples>\Common\Data-Driven Testing\Scripts
|Note:||If you do not have the sample, download the TestComplete Samples installation package from the support.smartbear.com/downloads/testcomplete/samples/ page of our website and run it.|
Follow the step-by-step instructions to learn how to create data-driven tests step by step:
You can explore the following script example to learn how to use an Excel file as a data source for your test and how to extract data from the Excel file:
To learn more about data-driven testing, you can also read the following article:
|Note:||To view this file you must have Adobe Acrobat Reader installed.|
When iterating through data sets, you can use the
Log.PushLogFolder methods, or the
aqTestCase.End methods to isolates operations performed for each data set. The
aqTestCase.End methods will also add each iteration to the Summary report as a separate test case.
Using Keyword Tests for Data-Driven Testing
Using Scripts for Data-Driven Testing
Organizing Data Storages
Using Excel Files as Data Storages
Using CSV Files as Data Storages
Using Database Table as Data Storages