Running a Test to Check Date Operations - WinRunner

Once you have created a test that checks date operations, as described in “Checking Dates,” you run your test to check how your application responds to date information in your test.

Note that the Enable date operations option must be selected in the General category of the Options dialog box when you run a test with date checkpoints. Otherwise, the date checkpoints will fail.

When you run a test that checks date operations, WinRunner interprets the test script line-by-line and performs the required operations on your application. At each checkpoint in the test script, it compares the expected dates with the actual dates in your application.

Before you run your test, you first specify date operations settings and the general run mode of the script.
Date operations run mode settings specify:

  • Date format, to determine whether to use the script’s original date formats or to convert dates to new formats.
  • Aging, to determine whether or not to age the dates in the script. You can age dates incrementally (by specifying the years, months, and days by which you want to age the dates) or statically (by defining a specific date).

The general run mode settings, Verify, Debug, and Update, are described earlier in this chapter. Note that during a test run in Update mode, dates in the script are not aged or translated to a new format.

Setting the Date Operations Run Mode

Before you run a test that checks date operations, you set the date operations run mode.

To set the date operations run mode:

  1. Choose Tools > Date > Run Mode (available only when the Enable date operations check box is selected in the General category of the General Options dialog box). The Date Operations Run Mode dialog box opens.
  2. To set the date operations run mode

    You can also open this dialog box from the Run Test dialog box by clicking the Change button (only when the Enable date operations check box is selected in the General category of the General Options dialog box). For more information on the General Options dialog box, see “Setting Global Testing Options

  3. If you are running the test on an application that was converted to a new date format, select the Convert to new date format check box.
  4. If you want to run the test with aging, select the Apply Aging check box and do one of the following:
    • To increment all dates, click Add to recorded date and specify the years, months or days. You can also align dates to a particular day by clicking the Align to check box and specifying the day.
    • To change all dates to a specific date, click Change all dates to and select a date from the list.
  5. Click OK.

Running Tests to Check Date Operations

After you set the date operations run mode, you can run your test script.

To run a test that checks date operations:

  1. If the test is not already open, open it.
  2. Choose a general run mode (Verify, Debug, or Update) from the list of modes on the Test toolbar.
  3. Choose the appropriate Test menu command or click one of the Run buttons. For more information on Run commands, see “WinRunner Run Commands”
  4. Note that in Update mode, dates in the script are not aged or translated to a new format. In Debug mode the test script immediately starts to run using the date operations run mode settings defined in the Date Operations Run Mode dialog box.

    If you selected Verify mode, the Run Test dialog box for date operations opens.

    To run a test that checks date operations

  5. Assign a name to the test run. Use the default name appearing in the Test Run Name field, or type in a new name.
  6. If you want to change the date operations run mode settings, click Change and specify the date operations run mode settings.

Changing Date Operations Run Mode Settings with TSL

You can set conditions for running a test checking date operations using the following TSL functions:

  • The date_align_day function ages dates to a specified day of the week or type of day. It has the following syntax:

date_align_day ( align_mode, day_in_week );

  • The date_disable_format function disables a date format. It has the following syntax:

date_disable_format ( format );

  • The date_enable_format function enables a date format. It has the following syntax:

date_enable_format ( format );

  • The date_leading_zero function determines whether to add a zero before single-digit numbers when aging and translating dates. It has the following syntax:

date_leading_zero ( mode );

  • The date_set_aging function ages the test script. It has the following syntax:

date_set_aging ( format, type, days, months, years );

  • The date_set_run_mode function sets the date operations run mode. It has the following syntax:

date_set_run_mode ( mode );

  • The date_set_year_limits function sets the minimum and maximum years valid for date verification and aging. It has the following syntax:

date_set_year_limits ( min_year, max_year );

  • The date_set_year_threshold function sets the year threshold (cut-year point). If the threshold is 60, all years from 60 to 99 are recognized as 20th century dates and all dates from 0 to 59 are recognized as 21st century dates. This function has the following syntax:

date_set_year_threshold ( number );


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

WinRunner Topics