Working With Databases

Applies to TestComplete 14.72, last modified on April 22, 2021

TestComplete supports working with databases and allows both reading data from and writing it to databases. You can connect to the needed database directly from your test and specify some additional parameters that will be used to get access to database records. For example, you can create a data-driven loop that will extract the values from the database, each time storing the current record to a DB Table variable, and specify the records that will be processed. For example, you can specify the start and end records to be data-driven. For more information, see Creating Data-Driven Loops.

TestComplete uses database drivers that have the same bitness.    

If you use the Microsoft Open Database Connectivity Data Source Administrator tool to connect to a database, make sure the version you use has the same bitness as TestComplete. On a 64-bit operating system, you can find the 32-bit version of the tool (Odbcad32.exe) in the <Windows>\SysWOW64 folder.

List of Possible Approaches to Working With Databases

The list below contains possible approaches that you can use to work with databases via TestComplete:

  • You can connect to the needed databases by using the ADO DB functionality included in Microsoft Windows. To learn more and to access a code example that demonstrates instantiating Microsoft ADO DB objects in your scripts and using them to iterate through table records, see Using ADO Components.

  • You can connect to and work with databases by using methods and properties of the TestComplete ADO and BDE program objects. To learn how to work with these objects, see Working With Databases Using ADO and BDE Objects.

  • You can work with databases via DB Table variables that allow reading data from the databases and using the resulted values in data loops, for instance. To learn more, see Working With Databases Using DB Table Variables.

  • To work with databases, you can also use methods of the DDT object. For more information, see Using DDT Drivers.

  • You can check whether the specified database contains the appropriate data. For this purpose, you can use database checkpoints, for example. For more information about using these checkpoints, see Alternatives to Database Checkpoints.

Tutorials

Using the approaches described above, you can retrieve data from the needed database (or file), store records to variables and then use these variables in your tests. For more information that illustrates working with databases via TestComplete, we recommend that you get acquainted with the following tutorials:

Data-Driven Testing With Keyword Tests - Tutorial

This tutorial will help you in creating data-driven keyword tests.

Data-Driven Testing With Scripts - Tutorial

This tutorial will help you in creating data-driven tests with the script engine.

See Also

Working With Application Objects and Controls
Script Tests
ADO Object
BDE Object
Variables of the Table Type

Highlight search results