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.
A database checkpoint is a test operation that verifies data retrieved from the database by comparing that data with the baseline copy stored in your project. That may be needed, for example, when you test an application that modifies a database and want to verify that the appropriate tables are updated correctly.
In keyword tests, database checkpoints are performed using the Database Table Checkpoint operation:
In scripts, database checkpoints are performed using the DBTables.DBTableCheckpointName.Check
method:
JavaScript, JScript
Python
DBTables.DBTable1.Check()
VBScript
DelphiScript
C++Script, C#Script
Baseline data used by the checkpoint for verification is stored in your project as a DBTable element of the Stores | DBTables collection. Each element contains connection settings for a database and a baseline copy of the data to be used for verification.
You can configure your database checkpoint to verify all records stored in the database or only some records.
How to Create Database Checkpoints
You can add database checkpoints to your test during test recording and at design time.
TestComplete provides the Checkpoint wizard that guides you through the process of creating and modifying database checkpoints. For detailed instructions on using the wizard, see Creating Database Checkpoints.
When you create a database checkpoint, you specify connection settings for the desired database, choose the desired data source (table, view existing query or custom query) and choose individual fields for verification. TestComplete uses the specified settings to retrieve data from the database and stores that data in the DBTable element. That data will be used during verification as the baseline data.
How Database Checkpoints Work
During the test run, the database checkpoint uses the connection settings stored by the corresponding DBTable element to connect to the database and retrieve actual data from it. Then it checks the retrieved data against the baseline data stored in the DBTable element of your project and reports the results. For detailed information on how the verification procedure works, see How the Database Verification Procedure Works.
Database Checkpoint Results
If the actual data retrieved from the database equals the baseline data stored in your project, the database checkpoint posts a success message to the test log.
Otherwise, the checkpoint fails and posts an error message to the test log. The Details panel reports differences found during verification.
Note: | To change the type of the message posted to the test log on verification failure or customize the log message of the checkpoints, use one of the alternative approaches described below. |
Alternatives to Database Checkpoints
In addition to database checkpoints, you can use the following approaches to verify databases:
-
Use the
DBTables.DBTableElementName.Compare
scripting method. The method is similar to database checkpoint, but it allows you to specify what kind of message will be posted to the test log if verification fails. -
Create a custom verification procedure that connects to the database, retrieve the data and compare it with the expected data.
For more information, see Alternatives to Database Checkpoints.
Updating Database Checkpoints
If your database checkpoint fails because the actual data of the database has been modified, update the checkpoint’s baseline data with new data in order for the checkpoint to be passed successfully.
For information on how to do that, see Updating Database Checkpoints.
Samples
TestComplete includes a sample project that demonstrates how to create database checkpoints:
<TestComplete Samples>\Desktop\Checkpoints\Database
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. |
See Also
Database Checkpoints
About Checkpoints
Database Table Checkpoint Operation
Check Method
Creating Database Checkpoints
How the Database Verification Procedure Works
Working With Databases