How To create a Database Checkpoints in QTP

Database checkpoints in QTP can be used in the test to check databases accessed by the web site or application and to detect defects. A query can be defined on the database to create a database checkpoint that will check the results of the query.

Ways to define a database query:

  1. Use Microsoft Query, Microsoft Query can be installed from the custom installation of Microsoft office.
  2. Manually define an SQL statement.

How To create a Database Checkpoints in QTP:

  1. Open QTP with a new blank test(From Start Menu ->All Programs->Quick Test Professional(QTP) -> Quick Test Professional
  2. Select Insert->Checkpoint->Database Checkpoint from the menu of QTP.
  3. Database query wizard opens up with two options as mentioned below.

Create query using Microsoft Query: Opens Microsoft Query, enabling to create a new query, once the query is defined, return to Quick Test, This option is only available only if it is installed on the computer

  1. Manually Specify SQL statement: open the specify SQL statement screen in the wizard, which enables to specify the connection string and an SQL statement.

database checkpoints in qtp-Database Qery Wizard

  1. Click Next to specify the connection string and the SQL statement, Specify SQL statement screen opens up as shown below.

database checkpoints in qtp -Specfiy SQL

  1. To make a connection with corresponding database, click “Create…” button.”Select Data Source” dialog box opens up
  2. Select “Machine Data Source” tab and then select the data source name of the database to be checked or create a new DSN file for the database.

Ex. To Check the database of the Flight Reservation (Application), Select “Flight_32” as Data Source Name(DSN)

  1. Click “OK” and enter the query to access the database in the “SQL” statement textbox

For Ex. Write the query as “Select * from Orders”

Note: Order is one of the tables of Flight_32 database; Tester can check a database of an application by following methods

  1. Click on “Finish” to open “Database Checkpoint Properties” where the content of the database is displayed

database checkpoints in qtp -SQL Query

  1. Specify checkpoint setting, For ex. Example select “After Current step” option in the insert statement
  2. Click ok button then QTP adds the script for the database checkpoint in the test script, A tree item with a database checkpoint icon is also added to the test tree, the script looks like as below

DbTable(“DbTable”).Check Checkpoint(“DbTable”)

  1. Run the test and get the result, QTP gives the detail about the number of cells in a table, how many succeeded and failed

How To Get a Fail Result

After inserting the database checkpoint in the test script, make changes in the “orders” table of Flight_32 database, then run the script again, the fail result will be displayed

In the result window, QTP will highlight the cell where the expected value is not matched with the actual value, User can see the expected and actual value of a particular cell by double click on the cell as shown below.

Leave a Reply

Your email address will not be published. Required fields are marked *