About Checking Databases - WinRunner

When you create database checkpoints, you define a query on your database, and your database checkpoint checks the values contained in the result set. The result set is a set of values retrieved from the results of the query.

There are several ways to define the query that will be used in your database checkpoints:

  • You can use Microsoft Query to create a query on a database. The results of a query on a database are known as a result set. You can install Microsoft Query from the custom installation of Microsoft Office.
  • You can define an ODBC query manually, by creating its SQL statement.
  • You can use Data Junction to create a conversion file that converts a database to a target text file. (For standard database checkpoints only). Note that Data Junction is not automatically included in your WinRunner package. To purchase Data Junction, contact your Mercury Interactive representative.

About Runtime Database Record Checkpoints

You can create runtime database record checkpoints in order to compare the values displayed in your application during the test run with the corresponding values in the database. If the comparison does not meet the success criteria you specify for the checkpoint, the checkpoint fails. You can define a successful runtime database record checkpoint as one where one or more matching records were found, exactly one matching record was found, or where no matching records are found. Your can include your databasecheckpoint in a loop. If you run your database checkpoint in a loop, the results for each iteration of the checkpoint are displayed in the test results as separate entries. The results of the checkpoint can be viewed in the Test Results window.

Runtime record checkpoints are useful when the information in the database changes from one run to the other. Runtime record checkpoints enable you to verify that the information displayed in your application was correctly inserted to the database or conversely, that information from the database is successfully retrieved and displayed on the screen.

Note that when you create a runtime database record checkpoint, the data in the application and in the database are generally in the same format. If the data is in different formats, you can follow the instructions in “Comparing Data in Different Formats” to create a runtime database record checkpoint. Note that this feature is for advanced WinRunner users only.

About Standard Database Checkpoints

You can create standard database checkpoints to compare the current values of the properties of the result set during the test run to the expected values captured during recording or otherwise set before the test run. If the expected results and the current results do not match, the database checkpoint fails.

Standard database checkpoints are useful when the expected results can be established before the test run. There are two types of standard database checkpoints: Default and Custom.

You can use a default check to check the entire contents of a result set, or you can use a custom check to check the partial contents, the number of rows, and the number of columns of a result set. Information about which result set properties to check is saved in a checklist. WinRunner captures the current information about the database and saves this information as expected results. A database checkpoint is automatically inserted into the test script. This checkpoint appears in your test script as a db_check statement.

For example, when you check the database of an application for the first time in a test script, the following statement is generated:

db_check("list1.cdl", "dbvf1");

where list1.cdl is the name of the checklist containing information about the database and the properties to check, and dbvf1 is the name of the expected results file. The checklist is stored in the test’s chklist folder.If you are working with Microsoft Query or ODBC, it references a *.sqlquery file, which contains information about the database and the SQL statement. If you are working with Data Junction, it references a *.djs conversion file, which contains information about the database and the conversion. When you define a query, WinRunner creates a checklist and stores it in the test’s chklist folder. The expected results file is stored in the test’s exp folder.

When you run the test, the database checkpoint compares the current state of the database in the application being tested to the expected results. If the expected results and the current results do not match, the database checkpoint fails. Your can include your database checkpoint in a loop. If you run your database checkpoint in a loop, the results for each iteration of the checkpoint are displayed in the test results as separate entries. The results of the checkpoint can be viewed in the Test Results window.

You can modify the expected results of an existing standard database checkpoint before or after you run your test. You can also make changes to the query in an existing database checkpoint. This is useful if you move the database to a new location on the network.

When you create a database checkpoint using ODBC/Microsoft Query, you can add parameters to an SQL statement to parameterize your checkpoint. This is useful if you want to create a database checkpoint on a query in which the SQL statement defining your query changes.

Setting Options for Failed Database Checkpoints

You can instruct WinRunner to send an e-mail to selected recipients each time a database checkpoint fails and you can instruct WinRunner to capture a bitmap of your window or screen when any checkpoint fails. You set these options in the General Options dialog box.

To instruct WinRunner to send an e-mail message when a database checkpoint fails:

  1. Choose Tools > General Options. The General Options dialog box opens.
  2. Click the Notifications category in the options pane. The notification options are displayed.
  3. Select Database checkpoint failure.
  4. Click the Notifications E-mail category in the options pane. The e-mail options are displayed.
  5. Select the Active E-mail service option and set the relevant server and sender information.
  6. Click the Notifications > Recipient category in the options pane. The e-mail recipient options are displayed.
  7. Add, remove, or modify recipient details as necessary to set the recipients to whom you want to send an e-mail message when a database checkpoint fails.

The e-mail contains summary details about the test and checkpoint and details about the connection string and SQL query used for the checkpoint.

To instruct WinRunner to capture a bitmap when a checkpoint fails:

  1. Choose Tools > General Options. The General Options dialog box opens.
  2. Click the Run > Settings category in the options pane. The run settings options are displayed.
  3. Select Capture bitmap on verification failure.
  4. Select Window, Desktop, or Desktop area to indicate what you want to capture when checkpoints fail.
  5. If you select Desktop area, specify the coordinates of the area of the desktop that you want to capture.

When you run your test, the captured bitmaps are saved in your test results folder.


All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

WinRunner Topics