Creating a Runtime Database Record Checkpoint - WinRunner

You can add a runtime database record checkpoint to your test in order to compare information displayed in your application during a test run with the current value(s) in the corresponding record(s) in your database. You add runtime database record checkpoints by running the Runtime Record Checkpoint wizard. When you are finished, the wizard inserts the appropriate db_record_check statement into your script.

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.

Using the Runtime Record Checkpoint Wizard

The Runtime Record Checkpoint wizard guides you through the steps of defining your query, identifying the application controls that contain the information corresponding to the records in your query, and defining the success criteria for your checkpoint.

To open the wizard, select Insert > Database Checkpoint > Runtime Record Check.

Define Query Screen

The Define Query screen enables you to select a database and define a query for your checkpoint. You can create a new query from your database using Microsoft Query, or manually define an SQL statement

Define Query Screen
You can choose from the following options:

  • Create new query: Opens Microsoft Query, enabling you to create a new query. Once you finish defining your query, you return to WinRunner.
  • Specify SQL statement: Opens the Specify SQL Statement screen in the wizard, enabling you to specify the connection string and an SQL statement.

Specify SQL Statement Screen

The Specify SQL Statement screen enables you to manually specify the database connection string and the SQL statement.
Specify SQL Statement Screen
Enter the required information:

  • Connection String: Enter the connection string, or click the Create button
  • Create: Opens the ODBC Select Data Source dialog box. You can select a *.dsn file in the Select Data Source dialog box to have it insert the connection string in the box for you.
  • SQL: Enter the SQL statement.

The Match Database Field screen enables you to identify the application control or text in your application that matches the displayed database field. You repeat this step for each field included in your query. This screen includes the following options:

  • Database field: Displays a database field from your query. Use the pointing hand to identify the control or text that matches the displayed field name.
  • Logical name: Displays the logical name of the control you select on your application.

(Displayed only when the Select text from a Web page check box is cleared.)

Specify SQL Statement Screen

  • Text before: Displays the text that appears immediately before the text to check.

(Displayed only when the Select text from a Web page check box is checked.)

  • Text after: Displays the text that appears immediately after the text to check.

(Displayed only when the Select text from a Web page check box is selected.)

Select text from a Web page check box is selected

  • Select text from a Web page: Enables you to indicate the text on your Web page containing the value to be verified.

The Matching Record Criteria screen enables you to specify the number of matching database records required for a successful checkpoint.

Run time record check point wizard

  • Exactly one matching record: Sets the checkpoint to succeed if exactly one matching database record is found.
  • One or more matching records: Sets the checkpoint to succeed if one or more matching database records are found.
  • No matching records: Sets the checkpoint to succeed if no matching database records are found.

When you click Finish on the Runtime Record Checkpoint wizard, a db_record_check statement is inserted into your script.

Comparing Data in Different Formats

Suppose you want to compare the data in your application to data in the database, but the data is in different formats. You can follow the instructions below to create a runtime database record checkpoint without using the Runtime Record Checkpoint Wizard. Note that this feature is for advanced WinRunner users only.

For example, in the sample Flight Reservation application, there are three radio buttons in the Class box. When this box is enabled, one of the radio buttons is always selected. In the database of the sample Flight Reservation application, there is one field with the values 1, 2, or 3 for the matching class.

To check that data in the application and the database have the same value, you must perform the following steps:

  1. Record on your application up to the point where you want to verify the data on the screen. Stop your test. In your test, manually extract the values from your application.
  2. Based on the values extracted from your application, calculate the expected values for the database. Note that in order to perform this step, you must know the mapping relationship between both sets of values. See the example below.
  3. Add these calculated values to any edit field or editor (e.g. Notepad). You need to have one edit field for each calculated value. For example, you can use multiple Notepad windows, or another application that has multiple edit fields.
  4. Use the GUI Map Editor to teach WinRunner:
    • the controls in your application that contain the values to check
    • the edit fields that will be used for the calculated values
  5. Add TSL statements to your test script to perform the following operations:
    • extract the values from your application
    • calculate the expected database values based on the values extracted from your application
    • write these expected values to the edit fields
  6. Use the Runtime Record Checkpoint wizard, described in “Using the Runtime Record Checkpoint Wizard,” to create a db_record_check statement.

When prompted, instead of pointing to your application control with the desired value, point to the edit field where you entered the desired calculated value.

Example of Comparing Different Data Formats in a Runtime Database Record Checkpoint

The following excerpts from a script are used to check the Class field in the database against the radio buttons in the sample Flights application. The steps refer to the instructions.

step 1 step 2

Step 3

Step 4

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

WinRunner Topics