One of the popular data storage for data-driven tests is files that store comma-separated values. TestComplete supports this type of storage and allows you to retrieve data from it.
To access data stored in CSV files, you can use DB Table variables. These variables are used by the Data-Driven Loop operation that allows you to iterate through the storage’s records in keyword tests. See Creating Data-Driven Loops and Data-Driven Testing With Keyword Tests - Tutorial.
To retrieve data from CSV files, TestComplete uses the following drivers:
32-bit version of TestComplete: the Microsoft Jet Engine driver.
64-bit version of TestComplete: Microsoft Office 12.0 Access Database Engine OLE DB Provider (data provider or driver). If you have the 64-bit version of Microsoft Office 2010 or later on your computer, then, most likely, you have the provider. Otherwise, you will have to install it. The provider is part of Microsoft Access Database Engine 2010 Redistributable x64. You can download the installation package from the Microsoft website:
|If you have 32-bit Microsoft Office 2010, the installation of the 64-bit provider will fail. In this case, perform the following steps to install it:
The object assumes that each row in your CSV file contains data for one test run. Files that use multiple rows for one run are not supported.
The column names are specified by the first line of the file.
The format of the CSV file is determined by using a schema information file, named Schema.ini, and located in the same folder as the CSV file. Schema.ini can keep information about several files and for each file it provides data for the general format of the file, field names and field types, used character set, delimiter character, and a number of other data characteristics. For example:
// The contents of the Schema.ini
To read more about the structure of this file, refer to the Schema.ini File (Text File Driver) article in the MSDN Library.
When the Schema.ini file is not found the format of the CSV file is defined by the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Jet\4.0\Engines\Text registry settings. For instance, the delimiter character is specified by the Format key and can have one of the following values: TabDelimited, CSVDelimited, Delimited(custom_character), FixedLength.
The Jet Engine has a limitation of 64 connections per process. So, after your test finishes with a CSV file, it is recommended that you close the connection by calling the
|You can view and edit your CSV files directly in the TestComplete Code Editor. To do this, simply drag the desired file to the TestComplete Workspace. The file will be opened for editing. Pressing Save All will save the changes made to the file.
Data-Driven Testing - Basic Concepts
Preparing Data for Data-Driven Testing
Organizing Data Storages
Using Keyword Tests for Data-Driven Testing
Creating Data-Driven Loops
Data-Driven Testing With Keyword Tests - Tutorial
Using Scripts for Data-Driven Testing
Using DDT Drivers