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...).
To add a Generate date step:
- Hover over the > (arrow symbol) between two steps, or the + (plus symbol) after the last step.
The action options are displayed.
- Click on the "M" (Testim predefined steps).
The Predefined steps menu opens.
- Click on Actions.
The Actions section expands.
- 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.
|Description||The name of the step.|
|Variable Name||The name of the variable.||Default - "dateValue"|
|Date Format||Can be any JS date format, you can read more here about different date's formats.||Default - 'YYYY-MM-DD'|
|Time difference||The 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 Scope||The 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 fails||Specify what to do if the step fails.|
|When to run step||Specify conditions for when to run the step. For more info, see Conditions|
You can see an example of how to use this step here.
Updated over 1 year ago