Interview Questions

How to Create a Test Using Winrunner (7)

Introduction To WinRunner Basics


(Continued from previous question...)

How to Create a Test Using Winrunner (7)


Testing Date Operations

The recommended workflow while checking dates in the application is as follows:

Define the date format(s) currently used in the application.
Create baseline tests by recording tests on the application. While recording, insert checkpoints that will check the dates in the application.
Run the tests (in Debug mode) to check that they run smoothly. If a test incorrectly identifies non-date fields as date fields or reads a date field using the wrong date format, user can override the automatic date recognition on selected fields.
Run the test (in Update mode) to create expected results.
Run the tests (in Verify mode). If the user wants to check how the application performs with future dates, user can age the dates before running the test.


Analyze test results to pinpoint where date-related problems exist in the application. If the user change date formats in the application, user should repeat the workflow described above after redefining the date formats used in the application.

To specify date formats:
Go to Date > Set Date Formats. The Set Date Formats dialog box opens. User can select each date format used in the application. User should move the most frequently-used date format in the application to the top of the list. WinRunner considers the top date format first.

Checking Dates in GUI Objects
User can use GUI checkpoints to check dates in GUI objects (such as edit boxes or static text fields).
The default check for edit boxes and static text fields is the date.
The default check for tables performs a case-sensitive check on the entire contents of a table, and checks all the dates in the table.

Overriding Date Settings
When debugging the tests, user may want to override user can override in the following ways:

Aging of a specific date format: - User can override the aging of a specific date format so that it will be aged differently than the default aging setting.

To override the aging of a date format:
Go to Date > Set Date Formats. The Set Date Formats dialog box opens.
Click the Advanced button. The Advanced Settings dialog box opens.
In the Format list, select a date format.
Click Change. The Override Aging dialog box opens.

User can increment the date format by a specific number of years, months and days. If the user wants no aging then use 0. User can choose a specific date for the selected date format by selecting the "Change all date to" option or user can stick to the default aging.

Overriding Aging or date format of a specific object: - User can define that a specific object that resembles a date should not be treated as a date object.

To override settings for an object:
Go to Date > Override Object Settings. The Override Object Settings dialog box opens.
Click the pointing hand button and then click the date object.
To override date format settings or to specify that the object is not a date object, clear the Use default format conversion check box

Note: When WinRunner runs tests, it first examines the general settings defined in the Date Operations Run Mode dialog box. Then, it examines the aging overrides for specific date formats. Finally, it considers overrides defined for particular objects.

Checking Dates with TSL

User can enhance the recorded test scripts by adding the following TSL date functions:

date_calc_days_in_field (field_name1, field_name2);
field_name1 The name of the 1st date field.
field_name2 The name of the 2nd date field.

The date_calc_days_in_field function calculates the number of days between the dates appearing in two date fields. Note that the specified date fields must be located in the same window.

date_calc_days_in_string (string1, string2);
string1 The name of the 1st string.
string2 The name of the 2nd string.

The date_calc_days_in_string function calculates the number of days between two numeric dates’ strings. Note that the specified strings must be located in the same window.

date_field_to_Julian (date_field);
date_field The name of the date field.

The date_field_to_Julian function translates a date string to a Julian number. For example, if the date 121398 (December 13, 1998) appears in the specified date field, WinRunner translates the date to the Julian number 2451162.

date_string_to_Julian (string)
string The numeric date string.

The date_string_to_Julian function translates a date string to a Julian number. For example, it calculates the string 12/13/98 (December 13, 1998) to 2451162.

date_is_field (field_name, min_year, max_year);
field_name The name of the field containing the date.
min_year Determines the minimum year allowed.
max_year Determines the maximum year allowed.

The date_is_field function checks that a field contains a valid date by determining whether the date falls within a specified date range.

date_is_string (string, min_year, max_year);
string The numeric string containing the date.
min_year Determines the minimum year allowed.
max_year Determines the maximum year allowed.

The date_is_string function checks that a numeric string contains a valid date by determining whether the date falls within a specified date range.

date_is_leap_year (year);
year A year, for example "1998".

The date_is_leap_year function determines whether a year is a leap year. The function returns "0" if the year is not a leap year or "1" if the year is a leap year.

date_month_language (language);
language The language used for month names.

The date_month_language function enables user to select the language used for month names in the application so that WinRunner can identify dates. User can select English, French, German, Spanish, Portuguese, or Italian. If the application uses a different language, select "Other" and define the names for all 12 months.

Data-Driven Testing

The Different stages of the data-driven testing process in WinRunner are:
Creating a test
Converting a test to a Data-Driven test
Create a corresponding data table.
Running the Test
Analyzing test results

Creating a test

In order to create a data-driven test user must create a basic test by recording a test, as usual with one set of data.

(Continued on next question...)

Other Interview Questions