Date and Time Generator

Applies to TestComplete 15.40, last modified on March 25, 2022

The Date and Time generator is used to generate date and time values with the Generate Values. Using this generator type you can populate the desired Excel file or TestComplete Table variable with various date and/or time values and then use this data in your tests. For more information on preparing test data, see Preparing Data for Data-Driven Testing.

To open the generator

  1. Click on the Tools toolbar or select Test > Generate Data from the main menu to call the Data Generator wizard.

  2. In the wizard, select the data storage.

  3. On the Data Generation Options page of the wizard, for the needed value, select Date and Time in the Data Generator column.

  4. Click Edit in the Parameters column.

Opening the data generator

Click the image to enlarge it.

– or –

  1. When adding a data-driven loop to a keyword test, select a table variable to store loop values.

  2. On the Variable’s Default Value page of the wizard, click on the toolbar.

Opening the data generator

Click the image to enlarge it.

– or –

When editing a table variable, click on the Edit Table Variable wizard toolbar.

Opening the data generator

Click the image to enlarge it.

Parameters

For the Date and Time generator, you can specify the following parameters:

Date/time format

Specifies a list of the available date and time formats. If you want to specify a custom format for the date and/or time to be generated, select Custom in the Formats drop-down list and enter the desired format in the Date/time format string edit box. The default value of the parameter is M/D/YYYY HH:MM (24-hour).

Symbol Description
d or dd Day as a number. If you use dd, the generator will add the leading zero to the days that are less than 10. If you use d, the leading zero is not added.
ddd Brief day name (Mon, Tue, Wed, and so on).
dddd Full day name (Monday, Tuesday, Wednesday, and so on).
M or MM Month as a number. If you use MM, the generator will add the leading zero if the month is less than 10. If you use M, the leading zero will not be added.
MMM Brief month name (Jan, Feb, Mar, and so on).
MMMM Full month name (January, February, March, and so on).
y or yy Two last digits of the year, for instance, 13 for 2013 and 95 for 1995.
yyy or yyyy    Full year (2013, 1995 and others).
H or HH Hours. If you use HH, the generator will append the leading zero to the hours that are less than 10. If you use H, the leading zero is not added to the hours.
m or mm Minutes. If you use mm, the generator will append the leading zero to the minutes that are less than 10. If you use m, the leading zero is not added to these values.
s or ss Seconds. If you use ss, the generator will append the leading zero to the seconds that are less than 10. If you use s, the leading zero is not added to these values.
tt Inserts either AM or PM if your local settings support this format. Otherwise, the corresponding letters will not be inserted.

Date/time format string

Specifies the format of the date or time to be generated. You can modify the parameter’s value only if you select the Custom item in the Date/time format drop-down list. The default value of the parameter is M/d/yyyy HH:mm.

Generation mode

Contains a drop-down list of the available generation modes. They are:

  • Random - Select this mode to generate random date/time values within the specified range.

  • Sequential - Default. Select this mode to generate a sequence of values that will start from the Minimum Value parameter. The sequence’s increment value is specified by the Increment value parameter.

Minimum value

Specifies the lower bound of the date/time values to be generated. The default value of the parameter is the current date and time.

Maximum value

Specifies the upper bound of the date/time values to be generated. The default value of the parameter is the current date and time + 100 days.

Note: The value of the Maximum value parameter must be greater than or equal to the value of the Minimum value parameter.

Increment value

Specifies an increment value for the generated sequence. Note that if you want to generate a descending sequence, specify a negative value for this parameter. The default value of the parameter is 1 day, 12 hours, 24 minutes, 48 seconds.

Note: These parameters are available only if you select the Sequential item in the Generation mode drop-down list.

Duplicate each value … time(s)

Specifies how many times each generated value will be duplicated. The default value of the parameter is False.

After you specify the needed parameters, you can obtain the sample values that have been generated by the engine. The values are displayed in the Sample field.

Also, you can discard all the changes you made in the generator’s parameters and restore the parameters set by default. For this purpose, click Set Default Values below the Sample field.

If you are going to use the same settings in several variables or if you configure one generator in the same manner from time to time, it is much easier to save the selected generator with the specified parameter values as a user-defined generator. For this purpose, click the Save to User-Defined button below the Sample field.

For more information on generating test data, see Using Data Generators.

See Also

Using Data Generators
Generators
Generate Data Dialog

Highlight search results