Sometimes we will have to create unique parameters, for which we can append the date and time value to our parameter names.
Creating Date & Time parameter in Jmeter.
In Jmeter we have __time function to create Date & Time parameters. This function has the below list of arguments that can be passed on to generate Date & Time in different formats.
Function | Example Result for 01/12/2018 02:00PM |
${__time(YMD)} | 20181201 |
${__time(yyyyMMdd)} | 20181201 |
${__time(yyMMdd)} | 181201 |
${__time(dd-MM-yyyy)} | 01-12-2018 |
${__time(dd/MM/yyyy hh:mm:ss)} | 01/12/2018 14:00:00 |
${__time(dd/MM/yyyy HH:mm:ss a)} | 01/12/2018 02:00:00 PM |
${__time()} | 1454358328739 |
${__time(yyyy-MM-dd’T’hh:mm:ssX)} | 2018-12-01T14:00:00+13 |
In the below image (Fig 1) email id is parameterized with date & time parameter. It can be seen that _time function is appended to the name mani (highlighted) thus the email id becomes mani${_time(YMD)}@ex.in
|
Fig 1 |
Once it is executed we can see that the date and time parameter is passed in the Response data in Fig 2. We can pass any of the above listed arguments to the _time function.
|
Fig 2 |