Generating a Date

Creating a step to generate a date

Tests that involve dates and times or have a behavior, which is dependent on a date, can be tricky, because the date input format has to match the field's format, the local date/time of the machine may vary from the server, etc.. Testim allows you to easily create a step that will generate a date according to predefined properties. The generated date can be then used to populate a field. Through these properties you can specify the date format, which clock/time zone to use (e.g. browser local clock, UTC) and even account for time differences.

The step can be added to an existing test at any point (e.g. as a last step, in the middle...).

Adding a Generate Date step

To add a Generate date step:

  1. Hover over the > (arrow symbol) between two steps, or the + (plus symbol) after the last step.

The action options are displayed.

  1. Click on the "M" (Testim predefined steps).
    The Predefined steps menu opens.
  1. Click on Actions.
    The Actions section expands.
  1. Scroll down through the menu and select Generate date.


Alternatively, you can use the search box at the top of the menu to search for Generate date.

A "Generate date" step is added in the Editor.
5. On the newly created step, click Show Properties () and fill in the properties as described below.
6. In the Properties pane, you can click the Step Parameters drop down menu to view the current date that was generated using the current properties settings.

Generate Date properties

DescriptionThe name of the step.
Variable NameThe name of the variable.Default - "dateValue"
Date FormatCan be any JS date format, you can read more here about different date's formats.Default - 'YYYY-MM-DD'
Time differenceThe generated date/time can be set to before or after the browser time or UTC (if UTC was selected).
Click the measure field (right side) and select the measure (seconds, minutes, etc.).
In the value field click up/down to set the value. Positive values are after the browser/UTC time and negative values are before the browser/UTC time.
Variable ScopeThe scope in which the variable can be passed:

* Local: allows you to pass parameter between steps in the same scope (i.e. export parameter in a group allows you to pass parameters between steps in the same group).

* Test: allows you to pass parameters between steps and groups in the same test.

* Suite: allows you to pass parameters between tests in the same test suite.
When this step failsSpecify what to do if the step fails.
When to run stepSpecify conditions for when to run the step. For more info, see Conditions

You can see an example of how to use this step here.