NeoLoad – Current Date Variable

‘Current Date’ is a type of variable in NeoLoad to generate the current date and time in the desired format in the script. You can define a pattern of the date or time as per the script requirement. NeoLoad provides an option to increment the date or time value by an interval of a second, millisecond, minute, hour, day, month and year so that different values can also be passed in the request for different virtual users.

The specific use of the ‘Current Date’ variable type is to provide the current timestamp in the request. In many cases, the timestamp is in epoch format.

Inputs of ‘Current Date’ type variable

  1. Name: To provide the name of the variable to be used in the script. This is a mandatory input.
  2. Description: To describe the use of the variable. This is an optional input.
  3. Parameters: To define the value and pattern
    1. Date pattern: To define the pattern of the current date/time e.g. dd/MM/yyyy HH:mm:ss. You can select the pre-defined from the drop-down list or write the custom pattern.
    2. Increment value: Pass 0 to use the same value else you can provide the interval value. The date or time interval will be in:
      1. Millisecond
      2. Second (Default)
      3. Minute
      4. Hour
      5. Day
      6. Month
      7. Year

Example

Consider, an order submission page in which the current date and time are passed while clicking the ‘Submit Order’ button. To parameterize the current timestamp, we need to define a ‘Current Date’ type variable. Refer to the below screenshot for a better understanding:

NeoLoad - Current Date Variable
Figure 01

To use the variable, you have to write ${<variable name>} in the script.

Example: ${currentDT}

NeoLoad - Current Date Variable - Script
Figure 02

Note: You can also validate the value of the variable by using the ‘Test’ option. The variable should return the correct value.

NeoLoad - Current Date Variable - Test
Figure 03

You may be interested:


Leave a Comment